社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

在google cloud build中使用git容器提交git

Hubert Ströbitzer • 4 年前 • 121 次点击  

我在玩google cloud build。在我的用例中,我必须在构建期间更改一个文件并将其提交到Git中。

我画了下面的构建步骤,它们可以工作。但这是一个简单的Git承诺的很多仪式。

你有什么建议如何缩短这些东西吗?

steps:
- name: alpine
  args: ["touch", "some-file.txt"]
- name: gcr.io/cloud-builders/git
  args: [ "config", "--global", "user.name", "batman" ]
- name: gcr.io/cloud-builders/git
  args: [ "config", "--global", "user.email", "batman@gotham.city" ]
- name: gcr.io/cloud-builders/git
  args: [ "add", "-A" ]
- name: gcr.io/cloud-builders/git
  args: [ 'commit', '-m', 'batmans commit' ]
- name: gcr.io/cloud-builders/git
  args: [ 'push', 'https://source.developers.google.com/p/$PROJECT_ID/r/my-repo', 'master']
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/38536
 
121 次点击  
文章 [ 1 ]  |  最新文章 4 年前
Yann C.
Reply   •   1 楼
Yann C.    5 年前

没有快速的方法可以大幅度减少这个cloudbuild.yml的大小。你最终可以合并 git add -A 具有 git commit -am 但是如果你有新的文件,它就不起作用了。唯一的方法是将自制脚本放在存储库中,或者放在专用的Docker映像中,在一个命令中执行这些步骤。

steps:
- name: alpine
  args: ["touch", "some-file.txt"]
- name: hubertstr/gitcommiter:v0.1
  args: [ "-m", "batmans commit", "-u", "batman", "-e", "batman@gotham.city"]