Add job to create ecr token for pipeline
What does this MR do?
Add a new job that will only run on the default branch and when a new release is tagged. This job will create an ECR token used to publish images.
Variables have been created inside of the Settings > CI/CD variables
We can also see the dotenv variables working for both Windows and Linux in https://gitlab.com/steveazz/playground/-/pipelines/226162557
Why was this MR needed?
To create a temporary token for ECR public registry. This token can be used for both Windows and Linux environments to push images to the registry. Another merge request that will actually use the token will be created after this merge request.
What's the best way to test this MR?
-
Fork https://gitlab.com/steveazz-playground/release-rules. This project has the same rule structure added in this merge request.
-
Try to create a pipeline for the
main
branch. It will not run, because of the namespace check. Screen_Shot_2020-12-07_at_10.05.34 -
Update the namespace check
example patch
diff --git a/.gitlab/ci/rules.gitlab-ci.yml b/.gitlab/ci/rules.gitlab-ci.yml index 28252a8..cd74738 100644 --- a/.gitlab/ci/rules.gitlab-ci.yml +++ b/.gitlab/ci/rules.gitlab-ci.yml @@ -1,5 +1,5 @@ .if-not-canonical-namespace: &if-not-canonical-namespace - if: '$CI_PROJECT_NAMESPACE !~ /^steveazz-playground($|\/)/' + if: '$CI_PROJECT_NAMESPACE !~ /^steveazz($|\/)/' .if-default-branch: &if-default-branch if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
-
Push change, now you should see a pipeline running for
main
https://gitlab.com/steveazz/release-rules/-/pipelines/226152355. -
Create test tags
git tag -s malformed-tag -m "Version malformed-tag" git tag -s v1.0.0 -m "Version v1.0.0" git tag -s v1.0.0-rc1 -m "Version v1.0.0-rc1"
-
Push tags:
git push -u origin --tags
-
Pipelines created only for
v1.0.0
andv1.0.0-rc1
https://gitlab.com/steveazz/release-rules/-/pipelines
What are the relevant issue numbers?
reference #27269 (closed)