Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
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
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
39abdeb1
Commit
39abdeb1
authored
Nov 11, 2021
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-205
: Commiting the new tag and push script
parent
118fa9be
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!183
Docker image building & pushing with CI pipeline caching
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+2
-2
2 additions, 2 deletions
.gitlab-ci.yml
sbin/tag_and_push_docker_image.sh
+57
-29
57 additions, 29 deletions
sbin/tag_and_push_docker_image.sh
with
59 additions
and
31 deletions
.gitlab-ci.yml
+
2
−
2
View file @
39abdeb1
...
...
@@ -107,8 +107,8 @@ docker_store_images:
variables
:
DOCKER_TLS_CERTDIR
:
"
/certs"
before_script
:
-
apk add --update make bash
#
- apk add --update bind-tools
-
apk add --update make bash
docker-compose
-
apk add --update bind-tools
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script
:
-
touch /root/.Xauthority
...
...
This diff is collapsed.
Click to expand it.
sbin/tag_and_push_docker_image.sh
+
57
−
29
View file @
39abdeb1
...
...
@@ -6,35 +6,63 @@ DOCKER_TAG=latest
# Change to git tag or git hash if no tag
VERSION
=
$(
date
+
"%Y-%M-%d"
)
SKA_REPO
=
"nexus.engageska-portugal.pt/ska-docker"
LOFAR_REPO
=
"git.astron.nl:5000/lofar2.0/tango"
# Compile a list of the SKA images
SKA_IMAGES
=
$(
for
i
in
$(
docker images |
grep
-E
${
DOCKER_TAG
}
|
grep
-E
${
SKA_REPO
}
|
cut
-d
' '
-f1
)
;
do
printf
"%s "
"
${
i
}
"
;
done
)
# Compile a list of LOFAR2.0 images
LOFAR_IMAGES
=
$(
for
i
in
$(
docker images |
grep
-E
${
DOCKER_TAG
}
|
grep
-E
-v
"
${
SKA_REPO
}
|
${
LOFAR_REPO
}
"
|
cut
-d
' '
-f1
)
;
do
printf
"%s "
"
${
i
}
"
;
done
)
function
tag_and_push
()
{
(
docker tag
"
${
1
}
"
"
${
2
}
"
docker push
"
${
2
}
"
)
&
}
# Rename the SKA images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo
for
IMAGE
in
${
SKA_IMAGES
}
;
do
PUSH_IMAGE
=
${
IMAGE
//
${
SKA_REPO
}
/
${
LOFAR_REPO
}}
:
${
VERSION
}
tag_and_push
"
${
IMAGE
}
"
"
${
PUSH_IMAGE
}
"
done
if
[
-z
"
${
LOFAR20_DIR
+x
}
"
]
;
then
echo
"LOFAR20_DIR not set, did you forget to source lofar20rc.sh?"
exit
1
fi
# shellcheck source=docker-compose/.env
.
"
${
LOFAR20_DIR
}
/docker-compose/.env"
||
exit
1
# Array of tuples separated by space inside double quotes
REMOTE_IMAGES
=(
"tango-dsconfig
${
TANGO_DSCONFIG_VERSION
}
"
"tango-java
${
TANGO_JAVA_VERSION
}
"
"tango-itango
${
TANGO_ITANGO_VERSION
}
"
"tango-pogo
${
TANGO_POGO_VERSION
}
"
"tango-cpp
${
TANGO_CPP_VERSION
}
"
"tango-db
${
TANGO_DB_VERSION
}
"
"tango-dsconfig
${
TANGO_DSCONFIG_VERSION
}
"
"tango-rest
${
TANGO_REST_VERSION
}
"
)
# Rename the LOFAR2.0 images for the LOFAR2.0 repo
# and push them to the LOFAR2.0 repo
for
IMAGE
in
${
LOFAR_IMAGES
}
;
do
PUSH_IMAGE
=
${
LOFAR_REPO
}
/
${
IMAGE
}
:
${
VERSION
}
tag_and_push
"
${
IMAGE
}
"
"
${
PUSH_IMAGE
}
"
for
image
in
"
${
REMOTE_IMAGES
[@]
}
"
;
do
# Set, splits tuple into $1 and $2
set
--
"
$image
"
remote_url
=
"
${
DOCKER_REGISTRY_HOST
}
/
${
DOCKER_REGISTRY_USER
}
-
${
1
}
:
${
2
}
"
local_url
=
"
${
LOCAL_DOCKER_REGISTRY_HOST
}
/
${
LOCAL_DOCKER_REGISTRY_USER
}
-
${
1
}
:
${
2
}
"
docker pull
"
${
remote_url
}
"
docker tag
"
${
remote_url
}
"
"
${
local_url
}
"
docker push
"
${
local_url
}
"
done
wait
# docker pull "${SKA_REPO}-${image}:"
## Compile a list of the SKA images
#SKA_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E ${SKA_REPO} | cut -d' ' -f1); do printf "%s " "${i}"; done)
#
## Compile a list of LOFAR2.0 images
#LOFAR_IMAGES=$(for i in $(docker images | grep -E ${DOCKER_TAG} | grep -E -v "${SKA_REPO}|${LOFAR_REPO}" | cut -d' ' -f1); do printf "%s " "${i}"; done)
#
#echo "$SKA_IMAGES"
#echo "$LOFAR_IMAGES"
#function tag_and_push()
#{
# (
# docker tag "${1}" "${2}"
# docker push "${2}"
# ) &
#}
#
## Rename the SKA images for the LOFAR2.0 repo
## and push them to the LOFAR2.0 repo
#for IMAGE in ${SKA_IMAGES}; do
# PUSH_IMAGE=${IMAGE//${SKA_REPO}/${LOFAR_REPO}}:${VERSION}
# tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
#done
#
## Rename the LOFAR2.0 images for the LOFAR2.0 repo
## and push them to the LOFAR2.0 repo
#for IMAGE in ${LOFAR_IMAGES}; do
# PUSH_IMAGE=${LOFAR_REPO}/${IMAGE}:${VERSION}
# tag_and_push "${IMAGE}" "${PUSH_IMAGE}"
#done
# wait
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