Skip to content

Commit

Permalink
Add pipeline getting all container image infos
Browse files Browse the repository at this point in the history
  • Loading branch information
cbosdo committed Jul 29, 2024
1 parent ab9d365 commit b02e9b9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
16 changes: 16 additions & 0 deletions jenkins_pipelines/environments/images-info-extractor
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

node('sumadocker-nue') {
properties([
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '1')),
disableConcurrentBuilds()
])
stage('Checkout pipeline') {
checkout scm
}
stage('pull all images') {
sh "jenkins_pipelines/scripts/extract_images_info.sh"
}
stage('Publish result') {
archiveArtifacts artifacts: "images-info.json"
}
}
37 changes: 37 additions & 0 deletions jenkins_pipelines/scripts/extract_images_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

. ~/.scc-credentials

echo $SCC_PASSWORD | podman login -u $SCC_USER --password-stdin registry.suse.com
if test $? -ne 0; then
exit 1
fi
echo $SCC_PASSWORD | skopeo login -u $SCC_USER --password-stdin registry.suse.com

images_path=registry.suse.com/suse/manager/5.0/

echo '[' >images-info.json
separator=

for image in `podman search --limit 100 --format '{{.Name}}' $images_path`; do
case $image in
*-helm) continue;;
esac

for tag in `skopeo inspect --format "{{.RepoTags}}" docker://$image | tr -d "[]"` ; do
case $tag in
*.sig|*.att) continue;;
esac
tagged_image="$image:$tag"
if test "z$separator" != "z"; then
echo "$separator" >>images-info.json
fi
echo " {" >>images-info.json
echo " \"name\": \"$tagged_image\"," >>images-info.json
echo " \"digest\": \"`skopeo inspect docker://$tagged_image --format '{{.Digest}}'`\"," >>images-info.json
echo " \"created\": \"`skopeo inspect docker://$tagged_image --format '{{.Created}}'`\"" >>images-info.json
echo -n " }" >>images-info.json
separator=,
done
done
echo ']' >>images-info.json

0 comments on commit b02e9b9

Please sign in to comment.