Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Emanuele Usai
cmssw-docker
Commits
72f0feb9
Commit
72f0feb9
authored
Jun 19, 2020
by
Adelina Eleonora Lintuluoto
Committed by
Clemens Lange
Jun 19, 2020
Browse files
add pipeline for building docker images
parent
c77d4567
Changes
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
0 → 100644
View file @
72f0feb9
stages
:
-
check
-
build
before_script
:
-
export DATE=$(date +"%Y-%m-%d")
variables
:
COMMIT_HASH
:
$CI_COMMIT_SHORT_SHA
check changed files
:
stage
:
check
only
:
changes
:
[
cc7-cms/*
,
cc7-cvmfs/*
,
slc6-cms/*
,
slc6-cvmfs/*
,
slc5-cms/*
]
except
:
-
pipelines
tags
:
-
docker
script
:
-
./check.sh
build standalone
:
stage
:
build
only
:
variables
:
-
$CMSSW_VERSION && $SCRAM_ARCH && $BASE_IMAGE
variables
:
REPO_NAME
:
standalone
IMAGE_NAME
:
cmssw
tags
:
-
docker-privileged-xl
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
script
:
-
echo "Building standalone image $BASE_IMAGE with $CMSSW_VERSION and $SCRAM_ARCH"
-
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"
build cms cvmfs
:
stage
:
build
only
:
variables
:
-
$CI_PIPELINE_SOURCE == "pipeline" && $IMAGE_NAME
image
:
name
:
gcr.io/kaniko-project/executor:debug
entrypoint
:
[
"
"
]
script
:
-
echo "Building image for $IMAGE_NAME"
-
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"
check.sh
0 → 100755
View file @
72f0feb9
#!/bin/bash
files
=
$(
git diff-tree
--no-commit-id
--name-only
-r
$CI_COMMIT_SHA
)
for
file
in
$files
;
do
dir
=
${
file
%/*
}
curl
--request
POST
\
--form
token
=
$CI_JOB_TOKEN
\
--form
ref
=
$CI_DEFAULT_BRANCH
\
--form
"variables[IMAGE_NAME]=
$dir
"
\
https://gitlab.cern.ch/api/v4/projects/
$CI_PROJECT_ID
/trigger/pipeline
done
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment