Open oinkbark opened 2 years ago
Hi @oinkbark apologies for the delayed response, and thank you for the provided logs. Looking at the logs I see the error "gcloud not found". Which means that Packer is unable to access the Google Cloud CLI gcloud
.
Do you know if the host machine running the Packer build has the gcloud CLI installed?
Actually, it looks like you are running Packer as a Docker container. The Packer container does not contain the Google SDK, which would explain the gcloud not found error. I don't believe you will be able to access the installed gcloud CLI from the runner as it is outside of the Packer container. The path forward here would be to install and run Packer directly on the runner after installing the Google Cloud CLI.
I have to look into Cloud Build to understand the options for installing and running Packer. But to get this working with IAP Packer needs access to the gcloud
executable.
Overview of the Issue
I am trying to use Google Cloud Build to create Packer images, but with the machines being configured to have no external IP. The IAP options seem perfect for this, but I have yet to get a standard build to finish with those options being set. It always fails when trying to establish the SSH connection.
I have verified that it is not a permissions issue with the firewall rules or the service account IAM permissions as I can impersonate it on the CLI and there is no problem connecting through SSH to the private machines.
Reproduction Steps
IAP-secured Tunnel User
but others will probably be required.Plugin and Packer version
Plugin: 1.0.13 Packer: Docker image, light-1.8.2
Simplified Packer Buildfile
Note: I have tried with a dynamic and static IAP localhost port, with no setting making a difference.
Operating system and Environment details
Log Fragments and crash.log files
These are the relevant lines from packer.log, with the entire gist still being linked:
Potential Workarounds
Internally, it appears that this plugin is using this command, which is causing the issue:
I have been able to get the build to work using these two alternatives: