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

Adding additional build options

parent 429fac65
No related branches found
No related tags found
3 merge requests!20Release,!13Docker image branch,!12Docker image branch
......@@ -15,10 +15,12 @@ initial_build:
# 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:latest; then export DOCKER_LATEST_IMAGE_EXISTS=true; else export DOCKER_LATEST_IMAGE_EXISTS=false; fi
- if crane manifest $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH; then export DOCKER_LATEST_IMAGE_EXISTS=true; else export DOCKER_LATEST_IMAGE_EXISTS=false; fi
# if the image does not exist, build it
- if $DOCKER_LATEST_IMAGE_EXISTS=false; then /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest; else echo "Docker image already exists"; fi
- if $DOCKER_LATEST_IMAGE_EXISTS=false; then /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH; else echo "Docker image already exists"; fi
rules: # if the image is pushed into main branch, the build_main job will run
- if: $CI_COMMIT_BRANCH
changes:
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
when: never
......@@ -75,7 +77,7 @@ test_latest: # This test will run only for tag latest
# specify auths for crane executor
- if DOCKER_TAG_IMAGE_EXISTS=true; then echo "Docker image already exists"; else crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY; fi
# validate the image with tag latest
- if ! crane validate --remote $CI_REGISTRY_IMAGE:latest; then exit 1; fi > test_latest.log
- if ! crane validate --remote $CI_REGISTRY_IMAGE:$CI_COMMIT_BRANCH; then exit 1; fi > test_latest.log
artifacts:
paths:
- test_latest.log
......@@ -94,7 +96,7 @@ test_tag: # This test will run only for tags
# specify auths for crane executor
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# validate the image with tag latest
- if ! crane validate --remote $CI_REGISTRY_IMAGE:$TAG; then exit 1; fi > test_tag.log
- if ! crane validate --remote $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME; then exit 1; fi > test_tag.log
artifacts:
paths:
- test_tag.log
......
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