-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pipeline getting all container image infos
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |