Search code examples
gogoogle-cloud-platformgoogle-container-registrygovendorgoogle-container-builder

Google Container Builder: How to install govendor dependencies during build step?


I am trying to use Google Cloud Container Builder to automate the building of my containers using GCP Build Triggers

My code is in Go, and I have a vendor folder in my project root which contains all of my Go dependencies (I use govendor). However, this vendor folder is NOT checked in to source control.

I have a cloudbuild.yaml file where I first build my Go source into a main executable, and then build a Docker image using this executable. Container Builder ensures these build steps have access to my master branch.

The problem is that the Go compilation step fails, because the vendor folder is not checked in to source control, so none of my dependencies are available for any build step.

Is there a way to create a build step that uses govendor to install all dependencies in the vendor folder? If so, how? Or is the only option to check in my vendor directory into source control (which seems unnecessary to me)?


Solution

  • As per @JimB and @Peter's comments to my question, an easy solution is to add my vendor directory to Git so I don't have to download all my dependencies during the build steps.