From ee6fb2b1eec9645f82eaa0796ca283a4a146278a Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 29 Nov 2018 16:10:23 +0100 Subject: Automatically merge CE master into EE master This sets up GitLab CI to automatically push CE master changes into EE master, or revert them if the changes cause merge conflicts. The CI configuration contains a single job to do this: `merge:master`. This job is executed for every push to master, and periodically using a CI schedule. The periodic job is necessary because incremental jobs may not be able to revert commits if newly added commits depend on these commits. By re-running the job periodically (including all changes since a large enough time frame), we can ensure that such commits are also reverted (if they still conflict at that time). The job runs in its own "merge" stage, _after_ the build and prepare stages, but _before_ running the tests. This ensures that randomly failing tests won't prevent code from being merged into EE. Running the stage after the "prepare" stage reduces the chances of the job reverting CE changes just because it ran before a corresponding EE MR was merged into EE master. --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to '.gitlab-ci.yml') diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79ec1b881d4..0a8e0201c4b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -48,6 +48,7 @@ after_script: stages: - build - prepare + - merge - test - post-test - pages @@ -1025,3 +1026,26 @@ schedule:review-cleanup: - gem install gitlab --no-document script: - ruby -rrubygems scripts/review_apps/automated_cleanup.rb + +merge:master: + image: registry.gitlab.com/gitlab-org/merge-train + stage: merge + # The global before_script/after_script blocks break this job, or aren't + # necessary. These two lines result in them being ignored. + before_script: [] + after_script: [] + only: + refs: + - master + - schedules + variables: + - $CI_PROJECT_PATH == "gitlab-org/gitlab-ce" + - $MERGE_TRAIN_SSH_PUBLIC_KEY + - $MERGE_TRAIN_SSH_PRIVATE_KEY + - $MERGE_TRAIN_API_TOKEN + script: + - scripts/merge-train + cache: + paths: + - gitlab-ee + key: "merge:master" -- cgit v1.2.3