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

查看:549
本文介绍了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.

谢谢.

推荐答案

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

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

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

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-ci.yml创建合并需求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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