Commit 2d82e2ec authored by Avielle Wolfe's avatar Avielle Wolfe Committed by Stan Hu

Use $CI_DEFAULT_BRANCH in CI templates

Since not every repository uses a branch named `master` as its default
branch, we've implemented the $CI_DEFAULT_BRANCH variable to allow us
to implement CI template logic for default branches of any name.

Now's the time to use that power in our own templates!

https://gitlab.com/gitlab-org/gitlab/issues/33601
parent 1d43dfa6
......@@ -113,9 +113,9 @@ promoteBeta:
promoteProduction:
extends: .promote_job
stage: production
# We only allow production promotion on `master` because
# We only allow production promotion on the default branch because
# it has its own production scoped secret variables
only:
- master
- $CI_DEFAULT_BRANCH
script:
- bundle exec fastlane promote_beta_to_production
......@@ -10,7 +10,7 @@ docker-build-master:
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- master
- $CI_DEFAULT_BRANCH
docker-build:
# Official docker image.
......@@ -24,4 +24,4 @@ docker-build:
- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
- $CI_DEFAULT_BRANCH
......@@ -25,7 +25,7 @@ review:
kubernetes: active
except:
refs:
- master
- $CI_DEFAULT_BRANCH
variables:
- $REVIEW_DISABLED
......@@ -49,7 +49,7 @@ stop_review:
kubernetes: active
except:
refs:
- master
- $CI_DEFAULT_BRANCH
variables:
- $REVIEW_DISABLED
......@@ -74,7 +74,7 @@ staging:
url: http://$CI_PROJECT_PATH_SLUG-staging.$KUBE_INGRESS_BASE_DOMAIN
only:
refs:
- master
- $CI_DEFAULT_BRANCH
kubernetes: active
variables:
- $STAGING_ENABLED
......@@ -99,7 +99,7 @@ canary:
when: manual
only:
refs:
- master
- $CI_DEFAULT_BRANCH
kubernetes: active
variables:
- $CANARY_ENABLED
......@@ -127,7 +127,7 @@ production:
<<: *production_template
only:
refs:
- master
- $CI_DEFAULT_BRANCH
kubernetes: active
except:
variables:
......@@ -142,7 +142,7 @@ production_manual:
allow_failure: false
only:
refs:
- master
- $CI_DEFAULT_BRANCH
kubernetes: active
variables:
- $STAGING_ENABLED
......@@ -152,7 +152,7 @@ production_manual:
- $INCREMENTAL_ROLLOUT_ENABLED
- $INCREMENTAL_ROLLOUT_MODE
# This job implements incremental rollout on for every push to `master`.
# This job implements incremental rollout for every push to the default branch.
.rollout: &rollout_template
extends: .auto-deploy
......@@ -179,7 +179,7 @@ production_manual:
# This selectors are backward compatible mode with $INCREMENTAL_ROLLOUT_ENABLED (before 11.4)
only:
refs:
- master
- $CI_DEFAULT_BRANCH
kubernetes: active
variables:
- $INCREMENTAL_ROLLOUT_MODE == "manual"
......@@ -194,7 +194,7 @@ production_manual:
start_in: 5 minutes
only:
refs:
- master
- $CI_DEFAULT_BRANCH
kubernetes: active
variables:
- $INCREMENTAL_ROLLOUT_MODE == "timed"
......
......@@ -64,7 +64,7 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
# WARNING: This template is using the `julia` images from [Docker
# Hub][3]. One can use custom Julia images and/or the official ones found
......
......@@ -6,7 +6,7 @@
# This template will build and test your projects
# * Caches downloaded dependencies and plugins between invocation.
# * Verify but don't deploy merge requests.
# * Deploy built artifacts from master branch only.
# * Deploy built artifacts from the default branch only.
variables:
# This will suppress any download for dependencies and plugins or upload messages which would clutter the console log.
......@@ -33,7 +33,7 @@ cache:
script:
- 'mvn $MAVEN_CLI_OPTS verify'
except:
- master
- $CI_DEFAULT_BRANCH
# Verify merge requests using JDK8
verify:jdk8:
......@@ -42,7 +42,7 @@ verify:jdk8:
# To deploy packages from CI, create a ci_settings.xml file
# For deploying packages to GitLab's Maven Repository: See https://docs.gitlab.com/ee/user/project/packages/maven_repository.html#creating-maven-packages-with-gitlab-cicd for more details.
# Please note: The GitLab Maven Repository is currently only available in GitLab Premium / Ultimate.
# For `master` branch run `mvn deploy` automatically.
# For the default branch run `mvn deploy` automatically.
deploy:jdk8:
stage: deploy
script:
......@@ -51,4 +51,4 @@ deploy:jdk8:
fi
- 'mvn $MAVEN_CLI_OPTS deploy -s ci_settings.xml'
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -25,7 +25,7 @@ before_script:
release:
stage: deploy
only:
- master
- $CI_DEFAULT_BRANCH
artifacts:
paths:
- build/release/MyProject.exe
......
......@@ -49,7 +49,7 @@ review:
only:
- branches
except:
- master
- $CI_DEFAULT_BRANCH
stop-review:
<<: *deploy
......@@ -66,7 +66,7 @@ stop-review:
only:
- branches
except:
- master
- $CI_DEFAULT_BRANCH
staging:
<<: *deploy
......@@ -78,7 +78,7 @@ staging:
name: staging
url: http://$CI_PROJECT_NAME-staging.$OPENSHIFT_DOMAIN
only:
- master
- $CI_DEFAULT_BRANCH
production:
<<: *deploy
......@@ -91,4 +91,4 @@ production:
name: production
url: http://$CI_PROJECT_NAME.$OPENSHIFT_DOMAIN
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -25,4 +25,4 @@ build:
- find . -maxdepth 1 -name '*.json' -print0 | xargs -t0n1 packer build
when: manual
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -12,4 +12,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -10,4 +10,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -14,4 +14,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -9,4 +9,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -12,4 +12,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -14,4 +14,4 @@ pages:
- node_modules
key: project
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -8,10 +8,10 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
test:
script:
- hugo
except:
- master
- $CI_DEFAULT_BRANCH
......@@ -11,7 +11,7 @@ test:
- pip install hyde
- hyde gen
except:
- master
- $CI_DEFAULT_BRANCH
pages:
stage: deploy
......@@ -22,4 +22,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -17,7 +17,7 @@ test:
paths:
- test
except:
- master
- $CI_DEFAULT_BRANCH
pages:
stage: deploy
......@@ -27,4 +27,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -34,4 +34,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -9,4 +9,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -13,4 +13,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -12,7 +12,7 @@ test:
- bundle install --path vendor
- bundle exec middleman build
except:
- master
- $CI_DEFAULT_BRANCH
pages:
script:
......@@ -24,4 +24,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -9,4 +9,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -12,4 +12,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -26,4 +26,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -48,4 +48,4 @@ pages:
paths:
- public
only:
- master
- $CI_DEFAULT_BRANCH
......@@ -22,7 +22,7 @@ archive_project:
- xcodebuild clean archive -archivePath build/ProjectName -scheme SchemeName
- xcodebuild -exportArchive -exportFormat ipa -archivePath "build/ProjectName.xcarchive" -exportPath "build/ProjectName.ipa" -exportProvisioningProfile "ProvisioningProfileName"
only:
- master
- $CI_DEFAULT_BRANCH
artifacts:
paths:
- build/ProjectName.ipa
......
......@@ -53,4 +53,4 @@ apply:
- plan
when: manual
only:
- master
- $CI_DEFAULT_BRANCH
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