Rules_docker: `container_image` rule emits weird gazelle warning logs

Created on 7 May 2021  路  4Comments  路  Source: bazelbuild/rules_docker

馃悶 bug report

Affected Rule


The issue is caused by the rule: container_image

Is this a regression?


Yes, the previous version in which this bug was not present was: 0.16.0

Description

container_image rules start to emit these logs after upgraded from 0.16.0 to 0.17.0, seem to be harmless, though:

DEBUG: /root/.cache/bazel/_bazel_root/b2fa2b4102717e3751086b071dc87499/external/bazel_gazelle/internal/go_repository.bzl:189:18: com_github_google_go_containerregistry: gazelle: finding module path for import github.com/vdemeester/k8s-pkg-credentialprovider: go: downloading github.com/vdemeester/k8s-pkg-credentialprovider v1.21.0
go get: github.com/vdemeester/[email protected] updating to
        github.com/vdemeester/[email protected] requires
        k8s.io/[email protected]: reading k8s.io/kubelet/go.mod at revision v0.0.0: unknown revision v0.0.0
gazelle: finding module path for import github.com/vdemeester/k8s-pkg-credentialprovider: go: downloading github.com/vdemeester/k8s-pkg-credentialprovider v1.21.0
go get: github.com/vdemeester/[email protected] updating to
        github.com/vdemeester/[email protected] requires
        k8s.io/[email protected]: reading k8s.io/kubelet/go.mod at revision v0.0.0: unknown revision v0.0.0
gazelle: finding module path for import github.com/vdemeester/k8s-pkg-credentialprovider: go: downloading github.com/vdemeester/k8s-pkg-credentialprovider v1.21.0
go get: github.com/vdemeester/[email protected] updating to
        github.com/vdemeester/[email protected] requires
        k8s.io/[email protected]: reading k8s.io/kubelet/go.mod at revision v0.0.0: unknown revision v0.0.0
gazelle: finding module path for import github.com/vdemeester/k8s-pkg-credentialprovider: go: downloading github.com/vdemeester/k8s-pkg-credentialprovider v1.21.0
go get: github.com/vdemeester/[email protected] updating to
        github.com/vdemeester/[email protected] requires
        k8s.io/[email protected]: reading k8s.io/kubelet/go.mod at revision v0.0.0: unknown revision v0.0.0
gazelle: finding module path for import github.com/vdemeester/k8s-pkg-credentialprovider: go: downloading github.com/vdemeester/k8s-pkg-credentialprovider v1.21.0
go get: github.com/vdemeester/[email protected] updating to
        github.com/vdemeester/[email protected] requires
        k8s.io/[email protected]: reading k8s.io/kubelet/go.mod at revision v0.0.0: unknown revision v0.0.0
## 馃敩 Minimal Reproduction ## 馃敟 Exception or Error





## 馃實 Your Environment **Operating System:**
  

  

Output of bazel version:

  
$ bazel version
Bazelisk version: development
Build label: 4.0.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Jan 21 07:33:24 2021 (1611214404)
Build timestamp: 1611214404
Build timestamp as int: 1611214404
  

Rules_docker version:

  
0.17.0
  

Anything else relevant?

All 4 comments

After adding the following to the WORKSPACE file, the log is no longer output.

load("@bazel_gazelle//:deps.bzl", "go_repository")

go_repository(
    name = "com_github_vdemeester_k8s_pkg_credentialprovider",
    version = "v1.21.0",
    importpath = "github.com/vdemeester/k8s-pkg-credentialprovider",
)

After adding the following to the WORKSPACE file, the log is no longer output.

load("@bazel_gazelle//:deps.bzl", "go_repository")

go_repository(
    name = "com_github_vdemeester_k8s_pkg_credentialprovider",
    version = "v1.21.0",
    importpath = "github.com/vdemeester/k8s-pkg-credentialprovider",
)

@Karibash Thanks! Since I prefer to add at least the sum of it for reproducibility, and I cannot get the sum of v1.21.0 via go command line (go get github.com/vdemeester/[email protected] failed for dependency issues), I ended up adding v1.21.0-1 to my WORKSPACE instead and it works:

# See https://github.com/bazelbuild/rules_docker/issues/1847
go_repository(
    name = "com_github_vdemeester_k8s_pkg_credentialprovider",
    importpath = "github.com/vdemeester/k8s-pkg-credentialprovider",
    sum = "h1:7Ajl3rjeYoB5V47jPknnLbyxYlhMXTTJiQsye5aT7f0=",
    version = "v1.21.0-1",
)

Can you clarify where you put the repository rule? I added the rule but I still get the warnings. I suspect some sort of race condition based on when the container go_deps is called.

go get: github.com/vdemeester/[email protected] updating to
    github.com/vdemeester/[email protected] requires
    k8s.io/[email protected]: reading k8s.io/kubelet/go.mod at revision v0.0.0: unknown revision v0.0.0

@jschaf I added it to the end of my WORKSPACE file, but I don't think we are using go_deps rules, at least not directly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JoostvDoorn picture JoostvDoorn  路  4Comments

henrywong-seekers picture henrywong-seekers  路  7Comments

jmhodges picture jmhodges  路  8Comments

alexandrvb picture alexandrvb  路  6Comments

uhthomas picture uhthomas  路  4Comments