Skip to content

Commit 9470c9b

Browse files
atarix83vins01-4science
authored andcommitted
Merged in task/dspace-cris-2024_02_x/DSC-2687 (pull request DSpace#4071)
Task/dspace cris 2024 02 x/DSC-2687 Approved-by: Vincenzo Mecca
2 parents 82e3114 + 5dbaa48 commit 9470c9b

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

bitbucket-pipelines.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ definitions:
215215
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
216216
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
217217
- cd dspace-values
218-
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" "test/${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "test/${BRANCH_FILE}"'
218+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "/^angular:/,/^[^ ]/s/\(tag: \).*/\1${BRANCH_NAME}-${HASH_COMMIT}/" */test/"${BRANCH_FILE}" && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" */test/"${BRANCH_FILE}"'
219219
- git config --global user.email "${BB_EMAIL}"
220220
- git config --global user.name "${BB_USER}"
221221
- git commit -am "Update TAG with ${BRANCH_NAME}-${HASH_COMMIT}" || echo "No changes to commit"
@@ -260,7 +260,7 @@ definitions:
260260
- export BRANCH_FILE=$(echo "$BITBUCKET_BRANCH" | awk -F'/' '{if(NF==1)val=$1;else if(NF==2)val=$2;else if(NF==3)val=$2;else val=$3;gsub(/_/, "-", val);print tolower(val)}')
261261
- git clone https://x-token-auth:${DSPACE_VALUES_ACCESS_TOKEN}@${DSPACE_VALUES_REPO}
262262
- cd dspace-values
263-
- '[ -f "test/${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
263+
- '[ -f */test/"${BRANCH_FILE}" ] && sed -i "s/^\([[:space:]]*replicaCount:\) 0/\1 1/" "staging/${BRANCH_FILE}"'
264264
- git config --global user.email "${BB_USER}"
265265
- git config --global user.name "${BB_EMAIL}"
266266
- git commit -am "Enable test environment for ${BRANCH_NAME}" || echo "No changes to commit"
@@ -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:
@@ -353,6 +370,13 @@ pipelines:
353370
- step: *deploy-on-staging
354371
- step: *find-cloudfront-staging
355372
- step: *invalidate-cloudfront
373+
deploy-on-test:
374+
- step: *check-branch-name-allowed
375+
- step: *angular-build
376+
- step: *build-and-push
377+
- step: *deploy-on-test
378+
- step: *find-cloudfront-test
379+
- step: *invalidate-cloudfront
356380
turn-on-dev:
357381
- step: *turn-on-dev
358382
turn-on-staging:
@@ -389,6 +413,7 @@ pipelines:
389413
- step: *deploy-on-staging
390414
- step: *find-cloudfront-staging
391415
- step: *invalidate-cloudfront
416+
- step: *merge-prod-into-test
392417
"test/**":
393418
- step: *check-branch-name-allowed
394419
- step: *preliminary-operation

0 commit comments

Comments
 (0)