Skip to content

Commit bd9d5db

Browse files
committed
[DSC-2687] Add step to merge prod into test
1 parent 52aad49 commit bd9d5db

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

bitbucket-pipelines.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,23 @@ definitions:
332332
exit 1
333333
fi
334334
335+
- step: &merge-prod-into-test
336+
name: Merge prod into test
337+
image: atlassian/default-image:4
338+
script:
339+
- export PROD_BRANCH="$BITBUCKET_BRANCH"
340+
- export TEST_BRANCH="test/${PROD_BRANCH#prod/}"
341+
- git fetch origin $TEST_BRANCH || true
342+
- if git ls-remote --exit-code --heads origin $TEST_BRANCH; then
343+
git remote set-branches --add origin $TEST_BRANCH;
344+
git fetch origin $TEST_BRANCH;
345+
git checkout -b $TEST_BRANCH origin/$TEST_BRANCH;
346+
git merge --no-ff origin/$PROD_BRANCH -m "Merge $PROD_BRANCH into $TEST_BRANCH [ci skip]";
347+
git push https://${DSPACE_REPO_USER}:${DSPACE_REPO_TOKEN}@${DSPACE_REPO} $TEST_BRANCH;
348+
else
349+
echo "Branch $TEST_BRANCH does not exist, no merge performed.";
350+
fi
351+
335352
pipelines:
336353
custom:
337354
e2e-on-custom-backend:
@@ -389,6 +406,7 @@ pipelines:
389406
- step: *deploy-on-staging
390407
- step: *find-cloudfront-staging
391408
- step: *invalidate-cloudfront
409+
- step: *merge-prod-into-test
392410
"test/**":
393411
- step: *check-branch-name-allowed
394412
- step: *preliminary-operation

0 commit comments

Comments
 (0)