Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker-images
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Cedric Verstege
docker-images
Commits
5226b86e
Commit
5226b86e
authored
9 months ago
by
Cedric Verstege
Browse files
Options
Downloads
Patches
Plain Diff
Only commit if version actually changed
parent
874fa869
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#3605
passed
9 months ago
Stage: ⏫ Update
Stage: 🏗️ Build
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+12
-9
12 additions, 9 deletions
.gitlab-ci.yml
alma9-base/update.sh
+2
-1
2 additions, 1 deletion
alma9-base/update.sh
with
14 additions
and
10 deletions
.gitlab-ci.yml
+
12
−
9
View file @
5226b86e
...
...
@@ -5,20 +5,23 @@ stages:
variables
:
DOCKER_IMAGE
:
cverstege/alma9-base
before_script
:
-
apt-get update && apt-get install -y curl git
Update Upstream 🛠️
:
stage
:
⏫ Update
before_script
:
-
apt-get update && apt-get install -y curl git
script
:
-
./alma9-base/update.sh
-
CURRENT_TAG=$(grep 'FROM cern/alma9-base:' alma9-base/Dockerfile | sed 's/FROM cern\/alma9-base:\([[:alnum:].-]*\).*/\1/')
-
git config user.name "CI Pipeline"
-
git config user.email "cedric.verstege@kit.edu"
-
git add alma9-base/Dockerfile
-
git commit -m "⏫ Update upstream to version $CURRENT_TAG"
-
git remote set-url --push origin "https://$CI_COMMITTER_USER_AND_TOKEN@gitlab.etp.kit.edu/cverstege/docker-images.git"
-
git push origin HEAD:$CI_COMMIT_REF_NAME
-
./alma9-base/update.sh
-
|-
if [[ "${LATEST_TAG}" != "${CURRENT_TAG}" ]]; then
git add alma9-base/Dockerfile
git commit -m "[🛠️ CI] ⏫ Update to upstream version $CURRENT_TAG"
git remote set-url --push origin "https://$CI_COMMITTER_USER_AND_TOKEN@gitlab.etp.kit.edu/cverstege/docker-images.git"
git push origin HEAD:$CI_COMMIT_REF_NAME
else
echo "Version didn't change, nothing to do!"
fi
rules
:
-
if
:
$CI_PIPELINE_SOURCE == "schedule"
when
:
always
...
...
This diff is collapsed.
Click to expand it.
alma9-base/update.sh
+
2
−
1
View file @
5226b86e
...
...
@@ -8,9 +8,10 @@ function update() {
echo
"Fetching the latest tag for cern/alma9-base"
LATEST_TAG
=
$(
curl
-s
https://registry.hub.docker.com/v2/repositories/cern/alma9-base/tags/ |
grep
-oP
'"name":\s*"\K(\d{8}-\d+)'
|
sort
-V
|
tail
-n
1
)
echo
"Latest tag is
${
LATEST_TAG
}
"
CURRENT_TAG
=
$(
grep
-oP
"FROM cern/alma9-base:
\K
[
\w
.-]+"
"
${
THIS_DIR
}
/Dockerfile"
)
echo
"Current tag is
${
CURRENT_TAG
}
"
export
LATEST_TAG
export
CURRENT_TAG
if
[[
"
${
LATEST_TAG
}
"
==
"
${
CURRENT_TAG
}
"
]]
;
then
echo
"Already on latest image; nothing to do."
else
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment