Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cspp-geo-web-viewer
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
Container registry
Model registry
Operate
Environments
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
David Hoese
cspp-geo-web-viewer
Commits
35441668
Verified
Commit
35441668
authored
5 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Add registry cleanup job to CI
parent
4ed7adfd
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitlab-ci.yml
+8
-2
8 additions, 2 deletions
.gitlab-ci.yml
ci/build_docker_image.sh
+1
-1
1 addition, 1 deletion
ci/build_docker_image.sh
ci/cibuild/Dockerfile
+5
-0
5 additions, 0 deletions
ci/cibuild/Dockerfile
ci/registry_cleanup.sh
+16
-0
16 additions, 0 deletions
ci/registry_cleanup.sh
with
30 additions
and
3 deletions
.gitlab-ci.yml
+
8
−
2
View file @
35441668
...
...
@@ -4,7 +4,7 @@ stages:
-
deploy_image
-
deploy_application
-
registry_cleanup
image
:
docker
:19.03.1
image
:
${CI_REGISTRY}/cibuild
:19.03.1
variables
:
DOCKER_TLS_CERTDIR
:
"
/certs"
#IMAGES_TO_BUILD: "cspp_geo_grb cspp_geo_grb_notify tests/cspp_geo_grb_sender"
...
...
@@ -14,7 +14,7 @@ services:
before_script
:
-
docker info
-
docker login -u
gitlab-ci-token
-p ${CI_
BUILD
_TOKEN} ${CI_REGISTRY}
-
docker login -u
${CI_REGISTRY_USER}
-p ${CI_
JOB
_TOKEN} ${CI_REGISTRY}
build_cspp_geo_grb
:
stage
:
build_image
...
...
@@ -22,3 +22,9 @@ build_cspp_geo_grb:
-
docker
script
:
-
ci/build_docker_image.sh
registry_cleanup
:
stage
:
registry_cleanup
tags
:
[]
script
:
-
ci/registry_cleanup.sh
This diff is collapsed.
Click to expand it.
ci/build_docker_image.sh
+
1
−
1
View file @
35441668
#!/usr/bin/env sh
#!/usr/bin/env
ba
sh
docker_id
()
{
# Get docker ID for the specified image
...
...
This diff is collapsed.
Click to expand it.
ci/cibuild/Dockerfile
0 → 100644
+
5
−
0
View file @
35441668
# Custom docker-based build image with a few nice things added
FROM
docker:19.03.1
RUN
apk update
&&
apk upgrade
&&
\
apk add findutils bash curl jq
&&
\
rm
-rf
/var/cache/apk/
*
This diff is collapsed.
Click to expand it.
ci/registry_cleanup.sh
0 → 100755
+
16
−
0
View file @
35441668
#!/usr/bin/env bash
PROJECT_NAME
=
"cspp_geo%2Fcspp-geo-web-viewer"
PROJ_URL
=
"
${
CI_API_V4_URL
}
/projects/
${
PROJECT_NAME
}
"
registries_json
=
$(
curl
-H
"PRIVATE_TOKEN:
${
CI_JOB_TOKEN
}
"
"
${
PROJ_URL
}
/registry/repositories"
)
registry_id
()
{
echo
$registries_json
|
name
=
"
$1
"
jq
'.[] | select(.name == $ENV.name) | .id'
}
for
image_dir
in
$IMAGES_TO_BUILD
;
do
image_name
=
$(
basename
$image_dir
)
docker_reg_id
=
$(
register_id
"
$image_name
"
)
curl
-XDELETE
-H
"PRIVATE-TOKEN:
${
TOKEN
}
"
-d
'name_regex=dev_.*'
-d
"keep_n=5"
"
${
PROJ_URL
}
/registry/repositories/
${
docker_reg_id
}
/tags"
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