Skip to content
Snippets Groups Projects
Commit 704e86b9 authored by Kay Effenberger's avatar Kay Effenberger
Browse files

FEAT(gitlab-ci):Push from Feature Branch

If a Merge Request on a feature Branch is created,
the Image will pushed to gitlab registry
parent e3133988
No related branches found
No related tags found
1 merge request!16FEAT(gitlab-ci):Push from Feature Branch
Pipeline #3175 passed
......@@ -56,12 +56,24 @@ docker-push:
then docker build -t $AURA_IMAGE_NAME:unstable .
else docker build -t $AURA_IMAGE_NAME -t $AURA_IMAGE_NAME:$CI_COMMIT_TAG .
fi
# If a merge request on a featrue branch is created
# docker builds are tagged with branch name
# hint: The name of feature branches must begin with "feat"
- |
if [ "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" =~ ^feat && "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" != "$CI_DEFAULT_BRANCH" ]
then
docker build -t $AURA_IMAGE_NAME -t $AURA_IMAGE_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
else
docker login -u "$DOCKER_ID" -p "$DOCKER_HUB_AUTH"
# TODO: maybe isolate docker build and docker push
- docker push "$AURA_IMAGE_NAME" --all-tags
rules:
- *release-rules
# every commit on master/main branch should trigger a push to docker-hub as unstable without a release
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
# every commit on master/main or feature branch should trigger a push
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^feature/ && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME != $CI_DEFAULT_BRANCH
exists:
- Dockerfile
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment