Commit 9f01d2f8 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'sync-security-branches' into 'master'

Sync security branches using the Merge Train

Closes #38387

See merge request gitlab-org/gitlab!21647
parents 0cd46931 aaa51000
---
# Syncs any changes pushed to a stable branch to the corresponding CE stable
# branch. We run this prior to any tests so that random failures don't prevent a
# sync.
sync-stable-branch:
# Syncs any changes pushed to a stable branch to the corresponding
# gitlab-foss/CE stable branch. We run this prior to any tests so that random
# failures don't prevent a sync.
.merge-train-sync:
# We don't need/want any global before/after commands, so we overwrite these
# settings.
image: alpine:edge
stage: sync
# This job should only run on EE stable branches on the canonical GitLab.com
# repository.
only:
variables:
- $CI_SERVER_HOST == "gitlab.com"
refs:
- /^[\d-]+-stable-ee$/@gitlab-org/gitlab
before_script:
- apk add --no-cache --update curl bash
after_script: []
script:
- bash scripts/sync-stable-branch.sh
only:
variables:
- $CI_SERVER_HOST == "gitlab.com"
sync-stable-branch:
extends: .merge-train-sync
variables:
SOURCE_PROJECT: gitlab-org/gitlab
TARGET_PROJECT: gitlab-org/gitlab-foss
only:
refs:
- /^[\d-]+-stable-ee$/@gitlab-org/gitlab
sync-security-branch:
extends: .merge-train-sync
variables:
SOURCE_PROJECT: gitlab-org/security/gitlab
TARGET_PROJECT: gitlab-org/security/gitlab-foss
only:
refs:
- /^[\d-]+-stable-ee$/@gitlab-org/security/gitlab
......@@ -23,10 +23,24 @@ then
exit 1
fi
if [[ "$SOURCE_PROJECT" == '' ]]
then
echo 'The variable SOURCE_PROJECT must be set to a non-empy value'
exit 1
fi
if [[ "$TARGET_PROJECT" == '' ]]
then
echo 'The variable TARGET_PROJECT must be set to a non-empy value'
exit 1
fi
curl -X POST \
-F token="$MERGE_TRAIN_TRIGGER_TOKEN" \
-F ref=master \
-F "variables[MERGE_FOSS]=1" \
-F "variables[SOURCE_BRANCH]=$CI_COMMIT_REF_NAME" \
-F "variables[TARGET_BRANCH]=${CI_COMMIT_REF_NAME/-ee/}" \
-F "variables[SOURCE_PROJECT]=$SOURCE_PROJECT" \
-F "variables[TARGET_PROJECT]=$TARGET_PROJECT" \
"$MERGE_TRAIN_TRIGGER_URL"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment