Commit 12ad7ce6 authored by Adelina Eleonora Lintuluoto's avatar Adelina Eleonora Lintuluoto Committed by Clemens Lange
Browse files

CI two build templates

parent 77be5d35
...@@ -13,7 +13,7 @@ check_changed_files: ...@@ -13,7 +13,7 @@ check_changed_files:
script: script:
- ./check.sh - ./check.sh
.build_image_template: &build_image .build_cms_cvmfs_template: &build_cms_cvmfs
image: image:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
entrypoint: [""] entrypoint: [""]
...@@ -21,21 +21,36 @@ check_changed_files: ...@@ -21,21 +21,36 @@ check_changed_files:
- export DATE=$(date +"%Y-%m-%d") - export DATE=$(date +"%Y-%m-%d")
- echo "Pipeline source - $CI_PIPELINE_SOURCE" - echo "Pipeline source - $CI_PIPELINE_SOURCE"
- echo "Building image - $IMAGE_NAME" - echo "Building image - $IMAGE_NAME"
- printf "Release - $RELEASE\nScram Arch - $SCRAM_ARCH\nBase image - $BASE_IMAGE\n" - export DOCKER_AUTH="$(echo -n $DOCKER_USER:$DOCKER_PASS | base64)"
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}, \"$DOCKER_REGISTRY\":{\"auth\":\"${DOCKER_AUTH}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR/$IMAGE_NAME --dockerfile $CI_PROJECT_DIR/$IMAGE_NAME/Dockerfile --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DATE-$CI_COMMIT_SHORT_SHA --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest --destination $DOCKER_GROUP/$IMAGE_NAME:latest --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$CI_COMMIT_SHORT_SHA"
.build_standalone_template: &build_standalone
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- export DATE=$(date +"%Y-%m-%d")
- export RELEASE_CAP=$(echo $RELEASE | tr '[:lower:]' '[:upper:]')
- echo "Pipeline source - $CI_PIPELINE_SOURCE"
- echo "Building image - $IMAGE_NAME"
- printf "Release - $RELEASE_CAP\nScram Arch - $SCRAM_ARCH\nBase image - $BASE_IMAGE\n"
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR/$REPO_NAME --dockerfile $CI_PROJECT_DIR/$REPO_NAME/Dockerfile --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:${IMAGE_TAG}$DATE-$CI_COMMIT_SHORT_SHA --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$CI_COMMIT_SHORT_SHA" --build-arg BASEIMAGE="$BASE_IMAGE" --build-arg SCRAM_ARCH="$SCRAM_ARCH" --build-arg CMSSW_VERSION="$RELEASE" - /kaniko/executor --context $CI_PROJECT_DIR/$REPO_NAME --dockerfile $CI_PROJECT_DIR/$REPO_NAME/Dockerfile --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DATE-$CI_COMMIT_SHORT_SHA --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$CI_COMMIT_SHORT_SHA" --build-arg BASEIMAGE="$BASE_IMAGE" --build-arg SCRAM_ARCH="$SCRAM_ARCH" --build-arg CMSSW_VERSION="$RELEASE_CAP"
build_cms_cvmfs_pipeline: build_cms_cvmfs_pipeline:
<<: *build_image <<: *build_cms_cvmfs
stage: build stage: build
only: only:
variables: variables:
- $IMAGE_NAME - $IMAGE_NAME
variables: variables:
REPO_NAME: $IMAGE_NAME DOCKER_GROUP: cmscloud
DOCKER_REGISTRY: https://index.docker.io/v1/
build_standalone_pipeline: build_standalone_pipeline:
<<: *build_image <<: *build_standalone
stage: build stage: build
only: only:
variables: variables:
...@@ -43,7 +58,6 @@ build_standalone_pipeline: ...@@ -43,7 +58,6 @@ build_standalone_pipeline:
tags: tags:
- docker-privileged-xl - docker-privileged-xl
variables: variables:
IMAGE_NAME: cmssw IMAGE_NAME: $RELEASE-$SCRAM_ARCH
REPO_NAME: standalone REPO_NAME: standalone
IMAGE_TAG: $RELEASE-$SCRAM_ARCH-
BASE_IMAGE: "clelange/$OS-cms:latest" BASE_IMAGE: "clelange/$OS-cms:latest"
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment