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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
31f5b45c
Commit
31f5b45c
authored
3 years ago
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-205
: Build more images once unconditionally
parent
9736a5ea
No related branches found
No related tags found
1 merge request
!183
Docker image building & pushing with CI pipeline caching
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+22
-8
22 additions, 8 deletions
.gitlab-ci.yml
sbin/tag_and_push_docker_image.sh
+15
-12
15 additions, 12 deletions
sbin/tag_and_push_docker_image.sh
with
37 additions
and
20 deletions
.gitlab-ci.yml
+
22
−
8
View file @
31f5b45c
...
@@ -61,6 +61,20 @@ docker_store_images_changes:
...
@@ -61,6 +61,20 @@ docker_store_images_changes:
refs
:
refs
:
-
tags
-
tags
-
master
-
master
# TODO(Corne): Remove this job after it has run once
docker_build_image_all
:
extends
:
.base_docker_images
script
:
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh lofar-device-base $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh elk $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh elk-configure-host $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh grafana $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh prometheus $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh lofar-device-base $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh jupyter $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh itango $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh integration-test $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh tango-prometheus-exporter $tag
docker_build_image_elk
:
docker_build_image_elk
:
extends
:
.base_docker_images
extends
:
.base_docker_images
only
:
only
:
...
@@ -90,14 +104,14 @@ docker_build_image_prometheus:
...
@@ -90,14 +104,14 @@ docker_build_image_prometheus:
script
:
script
:
# Do not remove 'bash' or statement will be ignored by primitive docker shell
# Do not remove 'bash' or statement will be ignored by primitive docker shell
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh prometheus $tag
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh prometheus $tag
#
docker_build_image_
docker-compose_
itango:
docker_build_image_itango
:
#
extends: .base_docker_images
extends
:
.base_docker_images
#
only:
only
:
#
changes:
changes
:
#
- docker-compose/itango.yml
-
docker-compose/itango.yml
#
script:
script
:
#
# Do not remove 'bash' or statement will be ignored by primitive docker shell
# Do not remove 'bash' or statement will be ignored by primitive docker shell
#
- bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh itango
-
bash $CI_PROJECT_DIR/sbin/tag_and_push_docker_image.sh itango
$tag
docker_build_image_grafana
:
docker_build_image_grafana
:
extends
:
.base_docker_images
extends
:
.base_docker_images
only
:
only
:
...
...
This diff is collapsed.
Click to expand it.
sbin/tag_and_push_docker_image.sh
+
15
−
12
View file @
31f5b45c
...
@@ -39,14 +39,13 @@ fi
...
@@ -39,14 +39,13 @@ fi
# Tuple of images and queries to detect changes
# Tuple of images and queries to detect changes
# TODO(Corne): Have this list generated from the .yml files
# TODO(Corne): Have this list generated from the .yml files
LOCAL_IMAGES
=(
LOCAL_IMAGES
=(
"elk"
"elk-configure-host"
"grafana"
"prometheus"
"lofar-device-base"
"elk elk"
"elk-configure-host elk-configure-host"
"grafana grafana"
"prometheus prometheus"
"lofar-device-base lofar-device-base"
"jupyter docker-compose_jupyter"
"itango docker-compose_itango"
"integration-test docker-compose_integration-test"
"tango-prometheus-exporter docker-compose_tango-prometheus-exporter"
)
)
# TBD TODO(Corne): Verify using these images as cache works
# "docker-compose_jupyter" "docker-compose_integration-test"
# "docker-compose_itango" "docker-compose_tango-prometheus-exporter"
#)
# If first argument set run second stage, determine LOCAL_IMAGE to build and
# If first argument set run second stage, determine LOCAL_IMAGE to build and
# push from the argument
# push from the argument
if
[
!
-z
"
${
1
+x
}
"
]
&&
[
"
${
1
}
"
!=
"pull"
]
;
then
if
[
!
-z
"
${
1
+x
}
"
]
&&
[
"
${
1
}
"
!=
"pull"
]
;
then
...
@@ -57,16 +56,20 @@ if [ ! -z "${1+x}" ] && [ "${1}" != "pull" ]; then
...
@@ -57,16 +56,20 @@ if [ ! -z "${1+x}" ] && [ "${1}" != "pull" ]; then
exit
1
exit
1
fi
fi
# Set the tag variable
# Set the tag and image variable, variables $1 and $2 are shadowed later
local_image
=
"
${
1
}
"
tag
=
"
${
2
}
"
tag
=
"
${
2
}
"
cd
"
${
LOFAR20_DIR
}
/docker-compose"
||
exit
1
cd
"
${
LOFAR20_DIR
}
/docker-compose"
||
exit
1
# Loop through images and find the specified one
# Loop through images and find the specified one
for
image
in
"
${
LOCAL_IMAGES
[@]
}
"
;
do
for
image
in
"
${
LOCAL_IMAGES
[@]
}
"
;
do
if
[
"
${
1
}
"
==
"
${
image
}
"
]
;
then
# Set, splits tuple into $1 and $2. this shadows previous variables
echo
"Building image for
${
image
}
container"
# shellcheck disable=SC2086
local_url
=
"
${
LOCAL_DOCKER_REGISTRY_HOST
}
/
${
LOCAL_DOCKER_REGISTRY_USER
}
/
${
image
}
"
set
--
$image
if
[
"
${
local_image
}
"
==
"
${
1
}
"
]
;
then
echo
"Building image for
${
1
}
container"
local_url
=
"
${
LOCAL_DOCKER_REGISTRY_HOST
}
/
${
LOCAL_DOCKER_REGISTRY_USER
}
/
${
2
}
"
# If tag is not latest, than it is not a tagged master build and we can
# If tag is not latest, than it is not a tagged master build and we can
# pull the latest image as cache.
# pull the latest image as cache.
...
@@ -74,8 +77,8 @@ if [ ! -z "${1+x}" ] && [ "${1}" != "pull" ]; then
...
@@ -74,8 +77,8 @@ if [ ! -z "${1+x}" ] && [ "${1}" != "pull" ]; then
docker pull
"
${
local_url
}
:latest"
docker pull
"
${
local_url
}
:latest"
fi
fi
make build
"
${
image
}
"
make build
"
${
1
}
"
docker tag
"
${
image
}
"
"
${
local_url
}
:
${
tag
}
"
docker tag
"
${
2
}
"
"
${
local_url
}
:
${
tag
}
"
docker push
"
${
local_url
}
:
${
tag
}
"
docker push
"
${
local_url
}
:
${
tag
}
"
fi
fi
done
done
...
...
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