Commit 7816f2fc authored by Clemens Lange's avatar Clemens Lange
Browse files

Introduce build template

parent 4b516b77
stages: stages:
- check - check
- build - build
before_script: before_script:
- export DATE=$(date +"%Y-%m-%d") - export DATE=$(date +"%Y-%m-%d")
variables: variables:
COMMIT_HASH: $CI_COMMIT_SHORT_SHA COMMIT_HASH: $CI_COMMIT_SHORT_SHA
check changed files: check_changed_files:
stage: check stage: check
only: only:
changes: [cc7-cms/*, cc7-cvmfs/*, slc6-cms/*, slc6-cvmfs/*, slc5-cms/*] changes: [cc7-cms/*, cc7-cvmfs/*, slc6-cms/*, slc6-cvmfs/*, slc5-cms/*]
...@@ -19,7 +19,7 @@ check changed files: ...@@ -19,7 +19,7 @@ check changed files:
script: script:
- ./check.sh - ./check.sh
build standalone: build_standalone:
stage: build stage: build
only: only:
variables: variables:
...@@ -37,11 +37,8 @@ build standalone: ...@@ -37,11 +37,8 @@ build standalone:
- 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:$CMSSW_VERSION-$DATE-$COMMIT_HASH --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$COMMIT_HASH" --build-arg BASEIMAGE="clelange/$BASE_IMAGE-cms:latest" --build-arg SCRAM_ARCH="$SCRAM_ARCH" --build-arg CMSSW_VERSION="$CMSSW_VERSION" - /kaniko/executor --context $CI_PROJECT_DIR/$REPO_NAME --dockerfile $CI_PROJECT_DIR/$REPO_NAME/Dockerfile --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$CMSSW_VERSION-$DATE-$COMMIT_HASH --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$COMMIT_HASH" --build-arg BASEIMAGE="clelange/$BASE_IMAGE-cms:latest" --build-arg SCRAM_ARCH="$SCRAM_ARCH" --build-arg CMSSW_VERSION="$CMSSW_VERSION"
build cms cvmfs:
stage: build .build_cms_cvmfs_template: &build_cms_cvmfs
only:
variables:
- $CI_PIPELINE_SOURCE == "pipeline" && $IMAGE_NAME
image: image:
name: gcr.io/kaniko-project/executor:debug name: gcr.io/kaniko-project/executor:debug
entrypoint: [""] entrypoint: [""]
...@@ -49,3 +46,11 @@ build cms cvmfs: ...@@ -49,3 +46,11 @@ build cms cvmfs:
- echo "Building image for $IMAGE_NAME" - echo "Building image for $IMAGE_NAME"
- 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/$IMAGE_NAME --dockerfile $CI_PROJECT_DIR/$IMAGE_NAME/Dockerfile --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DATE-$COMMIT_HASH --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$COMMIT_HASH" - /kaniko/executor --context $CI_PROJECT_DIR/$IMAGE_NAME --dockerfile $CI_PROJECT_DIR/$IMAGE_NAME/Dockerfile --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:$DATE-$COMMIT_HASH --destination $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest --build-arg=BUILD_DATE="$DATE" --build-arg=VERSION="$DATE" --build-arg=VCS_URL="$CI_REPOSITORY_URL" --build-arg=VCS_REF="$COMMIT_HASH"
build_cms_cvmfs_pipeline:
<<: *build_cms_cvmfs
stage: build
only:
variables:
- $IMAGE_NAME
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