From be4b27ead701fb570315799f8aef3fdf7c3328dd Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Wed, 10 Aug 2022 05:33:58 +0000 Subject: [PATCH] post(gl-artifact): fix template error - https://hexo.io/docs/troubleshooting#Escape-Contents --- source/_posts/remove-gitlab-artifacts.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/_posts/remove-gitlab-artifacts.md b/source/_posts/remove-gitlab-artifacts.md index be51387..eb953ec 100644 --- a/source/_posts/remove-gitlab-artifacts.md +++ b/source/_posts/remove-gitlab-artifacts.md @@ -28,7 +28,7 @@ As for cleaning up existing job artifacts, I found the following bash script on This script is especially useful for removing job artifacts were created before 22 Jun 2020, artifacts created before that date do not expire. -{% codeblock cleanup-gitlab.sh lang:bash https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12 source %} +``` bash cleanup-gitlab.sh https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12 source #!/bin/bash # https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12 # Copyright 2021 "Holloway" Chew, Kean Ho @@ -92,39 +92,39 @@ delete() { 1>&2 printf "Calling API to get lob list: ${url}\n" list=$(curl --globoff --header "PRIVATE-TOKEN:${token}" "$url" \ - | jq -r ".[].id") + | jq -r ".[].id") if [ ${#list[@]} -eq 0 ]; then - 1>&2 printf "list is empty\n" - return 0 + 1>&2 printf "list is empty\n" + return 0 fi # remove all jobs from page for jobID in ${list[@]}; do - url="${baseURL}/${projectID}/jobs/${jobID}/erase" - 1>&2 printf "Calling API to erase job: ${url}\n" + url="${baseURL}/${projectID}/jobs/${jobID}/erase" + 1>&2 printf "Calling API to erase job: ${url}\n" - curl --request POST --header "PRIVATE-TOKEN:${token}" "$url" - 1>&2 printf "\n\n" + curl --request POST --header "PRIVATE-TOKEN:${token}" "$url" + 1>&2 printf "\n\n" done } main() { # check dependencies if [ -z $(type -p jq) ]; then - 1>&2 printf "[ ERROR ] need 'jq' dependency to parse json." - exit 1 + 1>&2 printf "[ ERROR ] need 'jq' dependency to parse json." + exit 1 fi # loop through each pages from given start_page to end_page inclusive for ((i=start_page; i<=end_page; i++)); do - delete $i + delete $i done # return exit 0 } main $@ -{% endcodeblock %} +``` ## Before & after