Gitlab-ci.yml 创建合并请求 [英] Gitlab-ci.yml to create merge reqeust

查看:67
本文介绍了Gitlab-ci.yml 创建合并请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 DEV 分支中运行了以下 gitlab-ci.yml 文件,目标也是 DEV.由于我无法将 TARGET 指向 MASTER,因此不会创建自动 MR.我想知道是否可以在 gitlab-ci 脚本本身中创建合并请求.

I have the following gitlab-ci.yml file running in DEV branch, with target as DEV as well. Since i couldnt point the TARGET as MASTER, there is no automatic MR getting created. I would like to know if its possible to create a merge request in the gitlab-ci script itself.

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

我已经搜索并引用了我的网站,但看不到有关以编程方式创建合并请求的任何注释.

I have searched and referred my websites, but couldnt see any notes about programmatically creating Merge Requests.

这个想法是各种开发人员正在开发数据砖集群,并且 gitlab 计划定期运行.更改将被推送到 DEV 分支,并将使用合并请求推送到 MASTER 分支.

The idea is various developers are working on a databrick cluster, and gitlab is scheduled to run at regular intervals. The changes would be pushed to DEV branch and will be pushed to MASTER branch using the Merge requests.

我想知道这个 MR 创建是否可以自动化.请对 GITLAB 不熟悉.

I would like to know if this MR creation can be automated. NEW TO GITLAB please.

谢谢.

推荐答案

您可以在 Gitlab 中使用 git push 选项创建 MR.

You can create a MR in Gitlab using git push options.

要创建 MR 以使用 git 将 dev 合并到 master,请运行以下命令

To create a MR to merge dev into master using git, run the following command

git push origin HEAD:dev -o merge_request.create -o merge_request.target=master 

详细了解 Gitlab 的 合并请求的推送选项.

Read more about Gitlab's push options for merge requests.

这篇关于Gitlab-ci.yml 创建合并请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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