Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
open-source
MetaGer
Commits
2e90b1de
Commit
2e90b1de
authored
2 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
cleanup for node images
parent
887664cc
No related branches found
Branches containing commit
No related tags found
2 merge requests
!1973
Development
,
!1968
Resolve "Update Laravel to 9.x"
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab/ci/build_docker_images.yml
+1
-0
1 addition, 0 deletions
.gitlab/ci/build_docker_images.yml
.gitlab/deployment_scripts/cleanup_tags_non_revision.sh
+43
-1
43 additions, 1 deletion
.gitlab/deployment_scripts/cleanup_tags_non_revision.sh
with
44 additions
and
1 deletion
.gitlab/ci/build_docker_images.yml
+
1
−
0
View file @
2e90b1de
...
@@ -41,6 +41,7 @@ nginx:
...
@@ -41,6 +41,7 @@ nginx:
variables
:
variables
:
FPM_REPOSITORY_ID
:
418
FPM_REPOSITORY_ID
:
418
NGINX_REPOSITORY_ID
:
416
NGINX_REPOSITORY_ID
:
416
NODE_REPOSITORY_ID
:
416
KEEP_N
:
9
# Trim to the latest 9 revisions as the 10th will be deleted in the next stage
KEEP_N
:
9
# Trim to the latest 9 revisions as the 10th will be deleted in the next stage
before_script
:
before_script
:
-
chmod go-r $KUBECONFIG
-
chmod go-r $KUBECONFIG
...
...
This diff is collapsed.
Click to expand it.
.gitlab/deployment_scripts/cleanup_tags_non_revision.sh
+
43
−
1
View file @
2e90b1de
...
@@ -68,6 +68,39 @@ done
...
@@ -68,6 +68,39 @@ done
echo
"Got
${#
existing_tags_nginx
[@]
}
tags."
echo
"Got
${#
existing_tags_nginx
[@]
}
tags."
echo
""
echo
""
# Get All existing tags for the node repo
echo
"Fetching existing node tags..."
declare
-A
existing_tags_node
get_tags_url
=
$CI_API_V4_URL
/projects/
$CI_PROJECT_ID
/registry/repositories/
$NODE_REPOSITORY_ID
/tags
page
=
1
counter
=
1
while
[[
"
$page
"
!=
""
&&
$counter
-le
50
]]
do
tags
=
$(
curl
--fail
--silent
-D
headers.txt
"
${
get_tags_url
}
?page=
$page
"
| jq
-r
".[][
\"
name
\"
]"
)
for
tag
in
$tags
do
if
[[
$tag
=
${
DOCKER_IMAGE_TAG_PREFIX
}
-
*
&&
"
$tag
"
!=
$DOCKER_IMAGE_TAG_PREFIX
&&
$tag
!=
$DOCKER_NGINX_IMAGE_TAG
]]
then
existing_tags_node[
$tag
]=
1
fi
done
while
read
header
do
header
=
$(
echo
$header
|
sed
-r
's/\s+//g'
)
key
=
$(
echo
$header
|
cut
-d
':'
-f1
)
value
=
$(
echo
$header
|
cut
-d
':'
-f2
)
case
"
$key
"
in
x-next-page
)
page
=
"
$value
"
sleep
1
;;
esac
done
< headers.txt
counter
=
$((
counter
+
1
))
done
echo
"Got
${#
existing_tags_node
[@]
}
tags."
echo
""
# Get List of existing revisions
# Get List of existing revisions
echo
"Fetching Tags from helm revision history to not be deleted..."
echo
"Fetching Tags from helm revision history to not be deleted..."
declare
-A
revision_tags_fpm
declare
-A
revision_tags_fpm
...
@@ -109,4 +142,13 @@ do
...
@@ -109,4 +142,13 @@ do
curl
--fail
--silent
-X
DELETE
-H
"JOB-TOKEN:
$CI_JOB_TOKEN
"
"
$CI_API_V4_URL
/projects/
$CI_PROJECT_ID
/registry/repositories/
$NGINX_REPOSITORY_ID
/tags/
$nginx_tag
"
curl
--fail
--silent
-X
DELETE
-H
"JOB-TOKEN:
$CI_JOB_TOKEN
"
"
$CI_API_V4_URL
/projects/
$CI_PROJECT_ID
/registry/repositories/
$NGINX_REPOSITORY_ID
/tags/
$nginx_tag
"
echo
""
echo
""
fi
fi
done
done
\ No newline at end of file
# Delete Node Tags
echo
"Deleting unused NGINX Tags..."
for
node_tag
in
${
!existing_tags_node[@]
}
do
echo
$node_tag
curl
--fail
--silent
-X
DELETE
-H
"JOB-TOKEN:
$CI_JOB_TOKEN
"
"
$CI_API_V4_URL
/projects/
$CI_PROJECT_ID
/registry/repositories/
$NODE_REPOSITORY_ID
/tags/
$node_tag
"
echo
""
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