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

hack/update-bazel.sh fails with several complaints about "too few values in struct initializer" #60447

Closed
MikeSpreitzer opened this issue Feb 26, 2018 · 17 comments · Fixed by #60442
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience.

Comments

@MikeSpreitzer
Copy link
Member

Is this a BUG REPORT or FEATURE REQUEST?:

Uncomment only one, leave it on its own line:

/kind bug

/kind feature

What happened:

$ ./hack/update-bazel.sh 
Cloning into '/tmp/tmp.TJKUY3llxw/go/src/github.com/kubernetes/repo-infra'...
remote: Counting objects: 848, done.
remote: Total 848 (delta 0), reused 0 (delta 0), pack-reused 848
Receiving objects: 100% (848/848), 261.63 KiB | 6.38 MiB/s, done.
Resolving deltas: 100% (385/385), done.
Cloning into '/tmp/tmp.TJKUY3llxw/go/src/github.com/bazelbuild/rules_go'...
remote: Counting objects: 9243, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 9243 (delta 0), reused 0 (delta 0), pack-reused 9237
Receiving objects: 100% (9243/9243), 2.08 MiB | 8.25 MiB/s, done.
Resolving deltas: 100% (5975/5975), done.
# github.com/bazelbuild/rules_go/go/tools/gazelle/merger
go/tools/gazelle/merger/fix.go:93:28: too few values in struct initializer
go/tools/gazelle/merger/merger.go:498:19: too few values in struct initializer
go/tools/gazelle/merger/merger.go:502:19: too few values in struct initializer
# github.com/bazelbuild/rules_go/go/tools/gazelle/rules
go/tools/gazelle/rules/generator.go:196:16: too few values in struct initializer
go/tools/gazelle/rules/sort_labels.go:30:16: too few values in struct initializer
!!! [0226 14:06:43] Call tree:
!!! [0226 14:06:43]  1: ./hack/update-bazel.sh:34 kube::util::go_install_from_commit(...)
!!! Error in /home/mspreitz/go/src/k8s.io/kubernetes/hack/lib/util.sh:487
  Error in /home/mspreitz/go/src/k8s.io/kubernetes/hack/lib/util.sh:487. '((i<3-1))' exited with status 2
Call stack:
  1: /home/mspreitz/go/src/k8s.io/kubernetes/hack/lib/util.sh:487 kube::util::go_install_from_commit(...)
  2: ./hack/update-bazel.sh:34 main(...)
Exiting with status 1
!!! [0226 14:06:43] Call tree:
!!! [0226 14:06:43]  1: ./hack/update-bazel.sh:34 kube::util::go_install_from_commit(...)
!!! Error in /home/mspreitz/go/src/k8s.io/kubernetes/hack/lib/util.sh:472
  Error in /home/mspreitz/go/src/k8s.io/kubernetes/hack/lib/util.sh:472. '((i<3-1))' exited with status 1
Call stack:
  1: /home/mspreitz/go/src/k8s.io/kubernetes/hack/lib/util.sh:472 kube::util::go_install_from_commit(...)
  2: ./hack/update-bazel.sh:34 main(...)
Exiting with status 1

What you expected to happen:
I expected the update to run successfully.

How to reproduce it (as minimally and precisely as possible):
Checkout. build/run.sh make. hack/update-bazel.sh

Anything else we need to know?:
I get this in both master and release-1.9. I tested most carefully in release-1.9 (because I am working on a cherry-pick right now). In particular, I blew away the container and image I had used earlier for building. Before running hack/update-bazel.sh I established this state:

mspreitz@ubu17dev:~/go/src/k8s.io/kubernetes$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
hello-world         latest              f2a91732366c        3 months ago        1.85kB
mspreitz@ubu17dev:~/go/src/k8s.io/kubernetes$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
mspreitz@ubu17dev:~/go/src/k8s.io/kubernetes$ 

Then I ran build/run.sh make --- which took a while but eventually completed. It left me this state:

mspreitz@ubu17dev:~/go/src/k8s.io/kubernetes$ docker ps -a
CONTAINER ID        IMAGE                                    COMMAND                  CREATED             STATUS                      PORTS               NAMES
dae3627e1150        kube-build:build-da2f51b002-5-v1.9.2-1   "chown -R 1000:1000 …"   20 minutes ago      Exited (0) 17 minutes ago                       kube-build-data-da2f51b002-5-v1.9.2-1
mspreitz@ubu17dev:~/go/src/k8s.io/kubernetes$ docker images
REPOSITORY                            TAG                           IMAGE ID            CREATED             SIZE
kube-build                            build-da2f51b002-5-v1.9.2-1   b90e5435889f        20 minutes ago      2.18GB
hello-world                           latest                        f2a91732366c        3 months ago        1.85kB
gcr.io/google_containers/kube-cross   v1.9.2-1                      ba98259b52f7        3 months ago        1.74GB

After that is when I ran the hack/update-bazel.sh that is exhibited at the start of this issue.

Environment:

  • Kubernetes version (use kubectl version): Commit 77487e4 (current release-1.9)
  • Cloud provider or hardware configuration: local VM
  • OS (e.g. from /etc/os-release): Ubuntu 17.10
  • Kernel (e.g. uname -a): Linux ubu17dev 4.13.0-21-generic Update README.md #24-Ubuntu SMP Mon Dec 18 17:29:16 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Install tools:
  • Others:
    Docker 17.12.0-ce
@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. kind/bug Categorizes issue or PR as related to a bug. labels Feb 26, 2018
@MikeSpreitzer
Copy link
Member Author

@kubernetes/sig-contributor-experience-bugs

@k8s-ci-robot k8s-ci-robot added sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 26, 2018
@BenTheElder
Copy link
Member

Ah, there's another bug for this, this is being fixed. #60439 (same issue, verify uses update internally)

@grodrigues3
Copy link
Contributor

Any workaround?

@BenTheElder
Copy link
Member

#60442

aledbf pushed a commit to aledbf/kubernetes that referenced this issue Feb 26, 2018
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

bzl: fix update-bazel.sh

pickup bazelbuild/bazel-gazelle@a85b63b

fixes kubernetes#60439, fixes kubernetes#60447
we need to vendor gazelle.

```release-note
NONE
```
@ixdy
Copy link
Member

ixdy commented Feb 27, 2018

/reopen

It looks like the 1.8 and 1.9 release branches are broken for the same reason, but the fix is a bit less trivial, since we can't just use the latest gazelle, since this would require a huge mass of changes to the BUILD files. (Luckily, 1.7 doesn't use gazelle, so it's unaffected.)

Some additional background: gazelle doesn't vendor bazelbuild/buildtools, though it does have a bazel dependency on a particular version. As a result, go get is always grabbing the latest version of bazelbuild/buildtools, even with our hacks to check out an older version of gazelle.

An additional complication for the 1.8 and 1.9 branches is that we're installing gazelle from bazelbuild/rules_go instead of bazelbuild/bazel-gazelle.

Various options under consideration to fix these release branches:

  1. Fully vendor gazelle, similar to Vendor gazelle and kazel #57600 (but not a straight cherrypick, since versions are different)
  2. Clone the bazelbuild/rules_go repo somewhere (where?) and then explicitly vendor and older version of bazelbuild/buildtools, and then use that fork instead of the upstream fork
  3. Extend the hack in kube::util::go_install_from_commit() to also check out a particular bazelbuild/buildtools revision (so hacky)

Anyone have a better idea?

@k8s-ci-robot
Copy link
Contributor

@ixdy: you can't re-open an issue/PR unless you authored it or you are assigned to it.

In response to this:

/reopen

It looks like the 1.8 and 1.9 release branches are broken for the same reason, but the fix is a bit less trivial, since we can't just use the latest gazelle, since this would require a huge mass of changes to the BUILD files. (Luckily, 1.7 doesn't use gazelle, so it's unaffected.)

Some additional background: gazelle doesn't vendor bazelbuild/buildtools, though it does have a bazel dependency on a particular version. As a result, go get is always grabbing the latest version of bazelbuild/buildtools, even with our hacks to check out an older version of gazelle.

An additional complication for the 1.8 and 1.9 branches is that we're installing gazelle from bazelbuild/rules_go instead of bazelbuild/bazel-gazelle.

Various options under consideration to fix these release branches:

  1. Fully vendor gazelle, similar to Vendor gazelle and kazel #57600 (but not a straight cherrypick, since versions are different)
  2. Clone the bazelbuild/rules_go repo somewhere (where?) and then explicitly vendor and older version of bazelbuild/buildtools, and then use that fork instead of the upstream fork
  3. Extend the hack in kube::util::go_install_from_commit() to also check out a particular bazelbuild/buildtools revision (so hacky)

Anyone have a better idea?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ixdy
Copy link
Member

ixdy commented Feb 27, 2018

/assign
/reopen

@k8s-ci-robot
Copy link
Contributor

@ixdy: you can't re-open an issue/PR unless you authored it or you are assigned to it.

In response to this:

/assign
/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@BenTheElder
Copy link
Member

BenTheElder commented Feb 27, 2018

I think we should start with 2) to get things fixed and then solve 1) for the current branch and come back to the release branches if we think we still need that.

@mikedanese
Copy link
Member

@BenTheElder can you describe 1) and 2) here?

@ixdy
Copy link
Member

ixdy commented Feb 27, 2018

I ended up implementing option 3 in #60522; it wasn't quite as gross as I thought it'd be. LMK what you think.

@BenTheElder
Copy link
Member

@mikedanese 1) and 2) from the bullets in #60447 (comment)

@mikedanese
Copy link
Member

ahh, thanks.

@liggitt
Copy link
Member

liggitt commented Feb 27, 2018

many thanks... would the same fix work in release-1.7 and release-1.8? trying to get those in shape as well

@BenTheElder
Copy link
Member

BenTheElder commented Feb 27, 2018

@liggitt PRs are out for 1.8 and 1.9. The same thing would work for 1.7 AFAIK
Edit: see below, I am wrong WRT 1.7

@ixdy
Copy link
Member

ixdy commented Feb 27, 2018

@liggitt 1.7 is unaffected because it doesn't use gazelle. I just opened #60523 with the same hacky fix for 1.8.

apologies for all these breakages. my technical debt caught up to me. :(

k8s-github-robot pushed a commit that referenced this issue Feb 28, 2018
Automatic merge from submit-queue.

hack: when installing gazelle, checkout older version of buildtools

**What this PR does / why we need it**: #60522, but for the 1.8 release branch. This fixes `hack/verify-bazel.sh` by ensuring we use a compatible version of bazelbuild/buildtools when installing gazelle. This is basically the hacky third option on #60447 (comment).

**Release note**:

```release-note
NONE
```

fixes #60482

/assign @BenTheElder @mikedanese 
/cc @cblecker
k8s-github-robot pushed a commit that referenced this issue Feb 28, 2018
Automatic merge from submit-queue.

hack: when installing gazelle, checkout older version of buildtools

**What this PR does / why we need it**: fixes `hack/verify-bazel.sh` by ensuring we use a compatible version of bazelbuild/buildtools when installing gazelle. This is basically the hacky third option on #60447 (comment).

**Release note**:

```release-note
NONE
```

/assign @BenTheElder @mikedanese
@ixdy
Copy link
Member

ixdy commented Feb 28, 2018

/close

this should be fixed everywhere, for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants