doucong3048 2017-09-24 21:45
浏览 5
已采纳

Google Container Builder:如何在构建步骤中安装govendor依赖项?

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)?

  • 写回答

1条回答 默认 最新

  • dongzantai7570 2017-09-25 14:51
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?