post(gl-artifact): fix template error

- https://hexo.io/docs/troubleshooting#Escape-Contents
This commit is contained in:
Ming Di Leom 2022-08-10 05:33:58 +00:00
parent 43b0382b77
commit be4b27ead7
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 12 additions and 12 deletions

View File

@ -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. 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 #!/bin/bash
# https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12 # https://forum.gitlab.com/t/remove-all-artifact-no-expire-options/9274/12
# Copyright 2021 "Holloway" Chew, Kean Ho <kean.ho.chew@zoralab.com> # Copyright 2021 "Holloway" Chew, Kean Ho <kean.ho.chew@zoralab.com>
@ -92,39 +92,39 @@ delete() {
1>&2 printf "Calling API to get lob list: ${url}\n" 1>&2 printf "Calling API to get lob list: ${url}\n"
list=$(curl --globoff --header "PRIVATE-TOKEN:${token}" "$url" \ list=$(curl --globoff --header "PRIVATE-TOKEN:${token}" "$url" \
| jq -r ".[].id") | jq -r ".[].id")
if [ ${#list[@]} -eq 0 ]; then if [ ${#list[@]} -eq 0 ]; then
1>&2 printf "list is empty\n" 1>&2 printf "list is empty\n"
return 0 return 0
fi fi
# remove all jobs from page # remove all jobs from page
for jobID in ${list[@]}; do for jobID in ${list[@]}; do
url="${baseURL}/${projectID}/jobs/${jobID}/erase" url="${baseURL}/${projectID}/jobs/${jobID}/erase"
1>&2 printf "Calling API to erase job: ${url}\n" 1>&2 printf "Calling API to erase job: ${url}\n"
curl --request POST --header "PRIVATE-TOKEN:${token}" "$url" curl --request POST --header "PRIVATE-TOKEN:${token}" "$url"
1>&2 printf "\n\n" 1>&2 printf "\n\n"
done done
} }
main() { main() {
# check dependencies # check dependencies
if [ -z $(type -p jq) ]; then if [ -z $(type -p jq) ]; then
1>&2 printf "[ ERROR ] need 'jq' dependency to parse json." 1>&2 printf "[ ERROR ] need 'jq' dependency to parse json."
exit 1 exit 1
fi fi
# loop through each pages from given start_page to end_page inclusive # loop through each pages from given start_page to end_page inclusive
for ((i=start_page; i<=end_page; i++)); do for ((i=start_page; i<=end_page; i++)); do
delete $i delete $i
done done
# return # return
exit 0 exit 0
} }
main $@ main $@
{% endcodeblock %} ```
## Before & after ## Before & after