Gitlab-ci.yml 创建合并请求
Gitlab-ci.yml to create merge reqeust
我在 DEV 分支中有以下 gitlab-ci.yml 文件 运行ning,目标也是 DEV。由于我无法将 TARGET 指向 MASTER,因此不会自动创建 MR。我想知道是否可以在 gitlab-ci 脚本本身中创建合并请求。
dev:
stage: deploy
script:
- url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
- git remote set-url origin "https://gitlab-ci-token:${CI_TAG_UPLOAD_TOKEN}@${url_host}"
- databricks workspace export_dir -o /mynotebooks.
- git add .
- git commit -m 'Add notebooks to Repo' -a || true
- git push origin HEAD:dev
tags:
- test
我搜索并引用了我的网站,但看不到任何关于以编程方式创建合并请求的说明。
这个想法是各种开发人员都在一个数据块集群上工作,而 gitlab 计划定期 运行。更改将被推送到 DEV 分支,并将使用 Merge 请求推送到 MASTER 分支。
我想知道这个 MR 创建是否可以自动化。请是 GITLAB 新手。
谢谢。
您可以使用 git 推送选项在 Gitlab 中创建 MR。
要创建 MR 以使用 git、运行 将 dev
合并到 master
中,请使用以下命令
git push origin HEAD:dev -o merge_request.create -o merge_request.target=master
阅读更多关于 Gitlab 的 push options for merge requests。
实际上有一种更好的可编程方式来创建 MR。
Gitlab 有它的官方 Gitlab API you can access to create/update/delete almost anything. Of course doing those HTTP requests by yourself will be tedious. Try use the python library for gitlab 可以为所欲为。你真的可以让任何东西都可编程!
具体对付MR,可以看this chapter.
我在 DEV 分支中有以下 gitlab-ci.yml 文件 运行ning,目标也是 DEV。由于我无法将 TARGET 指向 MASTER,因此不会自动创建 MR。我想知道是否可以在 gitlab-ci 脚本本身中创建合并请求。
dev:
stage: deploy
script:
- url_host=`git remote get-url origin | sed -e "s/https:\/\/gitlab-ci-token:.*@//g"`
- git remote set-url origin "https://gitlab-ci-token:${CI_TAG_UPLOAD_TOKEN}@${url_host}"
- databricks workspace export_dir -o /mynotebooks.
- git add .
- git commit -m 'Add notebooks to Repo' -a || true
- git push origin HEAD:dev
tags:
- test
我搜索并引用了我的网站,但看不到任何关于以编程方式创建合并请求的说明。
这个想法是各种开发人员都在一个数据块集群上工作,而 gitlab 计划定期 运行。更改将被推送到 DEV 分支,并将使用 Merge 请求推送到 MASTER 分支。
我想知道这个 MR 创建是否可以自动化。请是 GITLAB 新手。
谢谢。
您可以使用 git 推送选项在 Gitlab 中创建 MR。
要创建 MR 以使用 git、运行 将 dev
合并到 master
中,请使用以下命令
git push origin HEAD:dev -o merge_request.create -o merge_request.target=master
阅读更多关于 Gitlab 的 push options for merge requests。
实际上有一种更好的可编程方式来创建 MR。
Gitlab 有它的官方 Gitlab API you can access to create/update/delete almost anything. Of course doing those HTTP requests by yourself will be tedious. Try use the python library for gitlab 可以为所欲为。你真的可以让任何东西都可编程!
具体对付MR,可以看this chapter.