GoogleCloudPlatform / GoogleCloudPlatform/cloud-builders-community

Can not build image with packer

Open
#641 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.3k
Forks
848
PR merge metrics
No merged PRs in 30d

Description

# Problem you have encountered:

I try to build gce image with packer, but it does not work. I encounter an error about `impersonate: scopes must be provided`. The detail is following
```
Step #0: cd9cf4263797: Pull complete
Step #0: e93ab6b80197: Pull complete
Step #0: c96596971c22: Pull complete
Step #0: 4c35a9a01dc8: Verifying Checksum
Step #0: 4c35a9a01dc8: Download complete
Step #0: 4c35a9a01dc8: Pull complete
Step #0: be0e7cfe939e: Pull complete
Step #0: 2607eac0764d: Pull complete
Step #0: 79074cc50ec6: Pull complete
Step #0: Digest: sha256:50d758dcbb3813dc0a5c5c3d5401e5c319563fd7103d392de82e29bb7cd40f95
Step #0: Status: Downloaded newer image for gcr.io/my-project-name/packer:latest
Step #0: gcr.io/my-project-name/packer:latest
Step #0: Installed plugin github.com/hashicorp/googlecompute v1.1.4 in "/builder/home/.config/packer/plugins/github.com/hashicorp/googlecompute/packer-plugin-googlecompute_v1.1.4_x5.0_linux_amd64"
Finished Step #0
Starting Step #1
Step #1: googlecompute.test-image: output will be in this color.
Step #1:
Step #1: Build 'googlecompute.test-image' errored after 862 microseconds: impersonate: scopes must be provided
Step #1:
Step #1: ==> Wait completed after 1 millisecond 60 microseconds
Step #1:
Step #1: ==> Some builds didn't complete successfully and had errors:
Step #1: --> googlecompute.test-image: impersonate: scopes must be provided
Step #1:
Step #1: ==> Builds finished but no artifacts were created.
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/my-project-name/packer" failed: step exited with non-zero status: 1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

BUILD FAILURE: Build step failure: build step 1 "gcr.io/my-project-name/packer" failed: step exited with non-zero status: 1
```

# What you expected to happen:

Get a new gce image artifact.

# Steps to reproduce:

1. git clone https://github.com/GoogleCloudPlatform/cloud-builders-community.git
2. go into the dir ```packer``` of the repo, build a packer image with cloud build
```
gcloud builds submit .
```

3. go into the dir ```packer/examples/gce``` of the repo
4. following the ```README.md``` to configuring service account for packer
5. modify the packer variables ```variables.pkrvars.hcl```
6. run build with script
```
gcloud builds submit --config=cloudbuild.yaml .
```

# Other information (workarounds you have tried, documentation consulted, etc):

It works well until November 23rd with the same steps above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.