Skip to content
Snippets Groups Projects

fix(ci): avoid clean_pipeline errors when no clean needed

Merged Wouter Deconinck requested to merge clean-pipeline-grep-exit-status-1 into master
+ 5
3
@@ -694,7 +694,9 @@ clean_pipeline:
@@ -694,7 +694,9 @@ clean_pipeline:
--filter=reference=${registry}/*:pipeline-*
--filter=reference=${registry}/*:pipeline-*
--format "{{.ID}} {{.Repository}} {{.Tag}} {{.CreatedSince}}" ;
--format "{{.ID}} {{.Repository}} {{.Tag}} {{.CreatedSince}}" ;
done
done
- for registry in
- # prevent grep exit code 1 when no match
 
mygrep() { grep "$@" || test $? = 1; } ;
 
for registry in
eicweb
eicweb
eicweb.phy.anl.gov:4567/containers/eic_container
eicweb.phy.anl.gov:4567/containers/eic_container
; do
; do
@@ -702,8 +704,8 @@ clean_pipeline:
@@ -702,8 +704,8 @@ clean_pipeline:
--filter=reference=${registry}/*:pipeline-*
--filter=reference=${registry}/*:pipeline-*
--format "{{.ID}} {{.Repository}} {{.Tag}} {{.CreatedSince}}" ;
--format "{{.ID}} {{.Repository}} {{.Tag}} {{.CreatedSince}}" ;
done
done
| grep -v ${CI_PIPELINE_ID}
| mygrep -v ${CI_PIPELINE_ID}
| grep -v "hours ago"
| mygrep -v "hours ago"
| sed -n -E 's/pipeline-([0-9]+)(-.*){0,1}\s+.*$/\1 &/p'
| sed -n -E 's/pipeline-([0-9]+)(-.*){0,1}\s+.*$/\1 &/p'
| while read id repository pipeline_id tag N durations ago ; do
| while read id repository pipeline_id tag N durations ago ; do
echo "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${pipeline_id}" ;
echo "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/pipelines/${pipeline_id}" ;
Loading