Skip to content
Snippets Groups Projects
Commit 7d0318e1 authored by Vineet Reddy Rajula's avatar Vineet Reddy Rajula
Browse files

Update CI

parent 71301014
No related branches found
No related tags found
1 merge request!10Add restore site task & restructure job templates
stages:
- build
.build:
build:
stage: build
image:
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
entrypoint: [""]
image:
# We recommend using the CERN version of the Kaniko image: gitlab-registry.cern.ch/ci-tools/docker-image-builder
name: gitlab-registry.cern.ch/ci-tools/docker-image-builder
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $IMAGE_DESTINATION
- echo "Image pushed successfully to ${IMAGE_DESTINATION}"
#####################################################
################### Merge Requests ##################
build_mr:
extends: .build
variables:
IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}/openshift-cli:${CI_COMMIT_REF_SLUG}
rules:
- if: $CI_MERGE_REQUEST_ID
when: manual
allow_failure: true
- when: never
######################################################
#################### Master branch ###################
build_master:
extends: .build
variables:
IMAGE_DESTINATION: ${CI_REGISTRY_IMAGE}/openshift-cli:latest
rules:
- if: $CI_COMMIT_BRANCH == 'master'
- when: never
- |
case "$CI_COMMIT_BRANCH" in
v*) export DATE=$(date -u +%Y.%m.%dT%H-%M-%SZ); export TAG="RELEASE"-${DATE}; echo "TAG=$TAG" >> build.env ;;
*) export TAG=$CI_COMMIT_SHORT_SHA ;;
esac
- wget --no-check-certificate https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /yq && chmod +x /yq
# This is not the common Authentication config, unknown reason why common config fails
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(echo -n ${CI_REGISTRY_USER}:${CI_REGISTRY_PASSWORD} | base64)\"}}}" > /kaniko/.docker/config.json
# Image builder
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination ${CI_REGISTRY_IMAGE}/velero-restore:${CI_COMMIT_BRANCH}-${TAG}
- echo "Image pushed successfully to ${CI_REGISTRY_IMAGE}/velero-restore:${CI_COMMIT_BRANCH}-${TAG}"
artifacts:
reports:
dotenv: build.env
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