Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pipeline getting all container image infos #1274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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