Google容器生成器:如何在构建步骤中安装govendor依赖关系? [英] Google Container Builder: How to install govendor dependencies during build step?

本文介绍了Google容器生成器:如何在构建步骤中安装govendor依赖关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用Google Cloud Container Builder使用GCP构建触发器来自动构建容器

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

我的代码位于Go中,并且我有一个 vendor 文件夹放在我的项目根目录中,它包含我所有的Go依赖项(我使用 govendor )。但是,这个供应商文件夹没有签入到源代码控制中。

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.

我有一个 cloudbuild.yaml 文件,我首先将我的Go源码构建到主要可执行文件中,然后使用此可执行文件构建Docker镜像。 Container Builder确保这些构建步骤可以访问我的主分支。

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.

问题是Go编译步骤失败,因为 vendor 文件夹没有签入到源代码控制中,所以我的依赖关系都不可用于任何构建步骤。

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.

有没有办法创建一个构建步骤使用 govendor 供应商文件夹中安装所有依赖关系?如果是这样,或者是唯一的选项来检查我的供应商目录到源代码管理(这对我来说似乎不必要)?

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

推荐答案

根据@JimB和@ Peter对我的问题的评论,一个简单的解决方案是将我的供应商目录添加到Git中,必须在构建步骤中下载我所有的依赖项。

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.

这篇关于Google容器生成器:如何在构建步骤中安装govendor依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆