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.
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.
I would like to know if this MR creation can be automated. NEW TO GITLAB please.
Thanks.
You can create a MR in Gitlab using git push options.
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
Read more about Gitlab's push options for merge requests.