@@ -299,6 +299,18 @@ definitions:
299299 - export CLOUDFRONT_DISTRIBUTION_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Comment=='test--${CLOUDFRONT_NAME}'].Id" --output text)
300300 - aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*" || echo "CloudFront distribution $CLOUDFRONT_DISTRIBUTION_ID not found — skipping invalidation."
301301
302+ - step : &check-branch-name-allowed
303+ name : Check allowed branch name
304+ image : alpine:latest
305+ script :
306+ - |
307+ if [ "$BITBUCKET_BRANCH" = "main-cris" ] || "$BITBUCKET_BRANCH" = "dspace-cris-20*_02_x" ] || [[ "$BITBUCKET_BRANCH" == prod/* ]] || [[ "$BITBUCKET_BRANCH" == test/* ]]; then
308+ echo "Branch $BITBUCKET_BRANCH is allowed."
309+ else
310+ echo "This pipeline can only run on main-cris, dspace-cris-20*_02_x, prod/**, or test/**"
311+ exit 1
312+ fi
313+
302314pipelines :
303315 custom :
304316 e2e-on-custom-backend :
@@ -312,14 +324,21 @@ pipelines:
312324 - step : *build-and-push
313325 - step : *deploy-on-dev
314326 - step : *find-and-invalidate-cloudfront-dev
327+ deploy-on-staging :
328+ - step : *check-branch-name-allowed
329+ - step : *angular-build
330+ - step : *build-and-push
331+ - step : *deploy-on-staging
332+ - step : *find-and-invalidate-cloudfront-staging
315333 turn-on-dev :
316334 - step : *turn-on-dev
317335 turn-on-staging :
318336 - step : *turn-on-staging
319337 turn-on-test :
320338 - step : *turn-on-test
321339 branches :
322- ' dspace-cris-2024_02_x ' :
340+ ' dspace-cris-20*_02_x ' :
341+ - step : *check-branch-name-allowed
323342 - step : *preliminary-operation
324343 - step : *angular-build
325344 - parallel : *parallel-run-tests
@@ -329,6 +348,7 @@ pipelines:
329348 - step : *deploy-on-staging
330349 - step : *find-and-invalidate-cloudfront-staging
331350 ' prod/** ' :
351+ - step : *check-branch-name-allowed
332352 - step : *preliminary-operation
333353 - step : *angular-build
334354 - parallel : *parallel-run-tests
@@ -338,6 +358,7 @@ pipelines:
338358 - step : *deploy-on-staging
339359 - step : *find-and-invalidate-cloudfront-staging
340360 ' test/** ' :
361+ - step : *check-branch-name-allowed
341362 - step : *preliminary-operation
342363 - step : *angular-build
343364 - parallel : *parallel-run-tests
0 commit comments