Skip to content
Snippets Groups Projects
Commit 5a8b60de authored by (INACTIVE) Marcel Bajdel (new marcel.bajdel)'s avatar (INACTIVE) Marcel Bajdel (new marcel.bajdel) :rocket:
Browse files

Correcting the check branch image

parent fcbdfd61
No related branches found
No related tags found
3 merge requests!20Release,!13Docker image branch,!12Docker image branch
......@@ -2,7 +2,7 @@ stages:
# List of stages for jobs, and their order of execution
- build_branch # builds if the image does not exist
- branch_scan # Check whether the image is already existing or not for the tag
- check_image_tag # Check whether there are any vulnerabilities in the image
- check_branch_image # Check whether there are any vulnerabilities in the image
- build_develop # builds when the merge request is made into development branch
- test_latest # tests when the image with tag latest is pushed
- build_tag # builds when the tag is pushed
......@@ -47,8 +47,8 @@ branch_scan:
when: on_success
expire_in: 10 minutes
check_image_tag:
stage: check_image_tag
check_branch_image:
stage: check_branch_image
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
......@@ -70,9 +70,7 @@ check_image_tag:
fi
artifacts:
paths:
- docker_latest_image.txt
- docker_latest_image
build_develop: # This build will run only for main branch
stage: build_develop
......@@ -87,6 +85,9 @@ build_develop: # This build will run only for main branch
rules:
- if: '$CI_COMMIT_BRANCH == "develop"'
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"'
- changes:
- README.md
when: never
test_latest: # This test will run only for tag latest
stage: test_latest
......@@ -102,6 +103,9 @@ test_latest: # This test will run only for tag latest
paths:
- test_latest.log
rules:
- changes:
- README.md
when: never
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
- if: '$CI_COMMIT_BRANCH == "develop"'
......@@ -115,10 +119,8 @@ build_tag: # This build will run only for tags
script:
# specify auths for kaniko executor
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
# check if dockers images exists
- if crane manifest $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; then export DOCKER_TAG_IMAGE_EXISTS=true; else export DOCKER_TAG_IMAGE_EXISTS=false; fi
# if the image does not exist, build it with the added tag
- if [ "$DOCKER_LATEST_IMAGE_EXISTS" == "false" ]; then /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; else echo "Docker image already exists"; fi
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
test_tag: # This test will run only for tags
stage: test_tag
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment