diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6079fdc4..848cd620 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -43,13 +43,12 @@ deploy_to_test: oci_calculator: # A convenient way for users to run the CARA calculator. stage: deploy + rules: + # Only run if branch is master (the default branch). + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH image: name: gitlab-registry.cern.ch/ci-tools/docker-image-builder entrypoint: [""] script: - # Prepare Kaniko configuration file - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - # Build and push the image from the Dockerfile at the root of the project. - # To push to a specific docker tag, amend the --destination parameter, e.g. --destination $CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME - # See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html#variables-reference for available variables - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE/calculator:latest