Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running container_push #2015

Closed
mattjs opened this issue Feb 6, 2022 · 6 comments
Closed

Error running container_push #2015

mattjs opened this issue Feb 6, 2022 · 6 comments
Labels
Can Close? Will close in 30 days unless there is a comment indicating why not

Comments

@mattjs
Copy link

mattjs commented Feb 6, 2022

🐞 bug report

Affected Rule

container_push

Is this a regression?

Worked on 0.12.1

Description

When running container_push

ERROR: .../BUILD:51:15: every rule of type container_push_ implicitly depends upon the target '@io_bazel_rules_docker//container/go/cmd/pusher:pusher', but this target could not be found because of: error loading package '@io_bazel_rules_docker//container/go/cmd/pusher': at /private/var/tmp/_bazel_matthew/7b254c56ef02c3a8ccbb58cecfd5fda6/external/bazel_gazelle/def.bzl:34:5: at /private/var/tmp/_bazel_matthew/7b254c56ef02c3a8ccbb58cecfd5fda6/external/bazel_gazelle/internal/gazelle_binary.bzl:22:5: Label '@io_bazel_rules_go//go/private:rules/aspect.bzl' is invalid because '@io_bazel_rules_go//go/private/rules' is a subpackage; perhaps you meant to put the colon here: '@io_bazel_rules_go//go/private/rules:aspect.bzl'?

🌍 Your Environment

Operating System:

Mac

Output of bazel version:

Build label: 5.0.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Jan 19 14:15:55 2022 (1642601755)
Build timestamp: 1642601755
Build timestamp as int: 1642601755

Rules_docker version:

0.23.0

@marksmithson
Copy link

Getting the same issue on with Bazel 4.2.2.

Tried downgrading to rules 0.12.1 and still get the same issue.

@JackTreble
Copy link

found this issue that seems to be related, #943

@dastbe
Copy link

dastbe commented Mar 17, 2022

You're likely running into a conflict between the version of rules_go and bazel-gazelle. Assuming you're using the recommended setup, rules_docker will implicitly load any repositories that haven't been loaded already in your WORKSPACE, and so if you only pre-load one of them they're likely to not be in sync.

The easiest path forward is to explicitly load both of them prior to instantiating rules_docker.

@tferi
Copy link

tferi commented May 14, 2022

I can confirm that @dastbe's suggestion works. With the following snippet, container_push rules will start working again.

http_archive(
    name = "io_bazel_rules_go",
    sha256 = "f2dcd210c7095febe54b804bb1cd3a58fe8435a909db2ec04e31542631cf715c",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
        "https://github.com/bazelbuild/rules_go/releases/download/v0.31.0/rules_go-v0.31.0.zip",
    ],
)

http_archive(
    name = "bazel_gazelle",
    sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
        "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
    ],
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################

go_rules_dependencies()

go_register_toolchains(version = "1.18")

gazelle_dependencies()

# rules_docker
# 0.23 breaks something around cc toolchains
http_archive(
    name = "io_bazel_rules_docker",
    sha256 = "59536e6ae64359b716ba9c46c39183403b01eabfbd57578e84398b4829ca499a",
    strip_prefix = "rules_docker-0.22.0",
    urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.22.0/rules_docker-v0.22.0.tar.gz"],
)

load(
    "@io_bazel_rules_docker//repositories:repositories.bzl",
    container_repositories = "repositories",
)

container_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

@github-actions github-actions bot added the Can Close? Will close in 30 days unless there is a comment indicating why not label Nov 11, 2022
@github-actions
Copy link

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can Close? Will close in 30 days unless there is a comment indicating why not
Projects
None yet
Development

No branches or pull requests

5 participants