Skip to content

Conversation

@cbosdo
Copy link
Contributor

@cbosdo cbosdo commented Jul 9, 2024

Extract container image informations that would be useful for supporters and bug squad to match the installed images with the published ones.
The generated file is JSON so that could be easy to embed in an HTML page.

@cbosdo cbosdo force-pushed the image-extractor branch 7 times, most recently from 3dbe5d2 to 06deeeb Compare July 29, 2024 12:34
@cbosdo cbosdo force-pushed the image-extractor branch from 06deeeb to b02e9b9 Compare July 29, 2024 13:57
@nodeg nodeg requested a review from Copilot January 13, 2026 08:38
@nodeg
Copy link
Member

nodeg commented Jan 13, 2026

@cbosdo Is this ready? Can we merge this already?

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a Jenkins pipeline that extracts container image information from SUSE Manager 5.0 registry to help supporters and bug squad match installed images with published ones. The pipeline generates a JSON file containing image names, digests, and creation timestamps.

Changes:

  • Added a shell script that authenticates with the SUSE registry, searches for container images, and extracts metadata (digest and creation timestamp) into a JSON file
  • Added a Jenkins pipeline configuration that executes the extraction script and archives the resulting JSON artifact

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
jenkins_pipelines/scripts/extract_images_info.sh Shell script that logs into SUSE registry, iterates through container images, and extracts metadata into images-info.json
jenkins_pipelines/environments/images-info-extractor Jenkins pipeline definition that runs the extraction script and archives the JSON output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error handling for skopeo login. If the skopeo login fails, the script will continue execution, which could lead to subsequent skopeo commands failing with authentication errors. Add an error check similar to the podman login command above.

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

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +32
echo " \"digest\": \"`skopeo inspect docker://$tagged_image --format '{{.Digest}}'`\"," >>images-info.json
echo " \"created\": \"`skopeo inspect docker://$tagged_image --format '{{.Created}}'`\"" >>images-info.json
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The skopeo inspect command is called twice for each tagged image - once for the digest and once for the created timestamp. This is inefficient and could significantly slow down the pipeline, especially with many images. Consider capturing the output once and extracting both values, or using a format string that captures both fields in a single call.

Suggested change
echo " \"digest\": \"`skopeo inspect docker://$tagged_image --format '{{.Digest}}'`\"," >>images-info.json
echo " \"created\": \"`skopeo inspect docker://$tagged_image --format '{{.Created}}'`\"" >>images-info.json
inspect_output=`skopeo inspect docker://$tagged_image --format '{{.Digest}}|{{.Created}}'`
digest=${inspect_output%%|*}
created=${inspect_output#*|}
echo " \"digest\": \"$digest\"," >>images-info.json
echo " \"created\": \"$created\"" >>images-info.json

Copilot uses AI. Check for mistakes.
Comment on lines +5 to +9
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
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credentials are exposed in process listings. Using echo to pipe the password to podman/skopeo login exposes the SCC_PASSWORD in the process table where it could be visible to other users on the system. Consider using a more secure method such as passing credentials via file descriptor or using credential helpers.

Suggested change
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
podman login -u "$SCC_USER" --password-stdin registry.suse.com <<EOF
$SCC_PASSWORD
EOF
if test $? -ne 0; then
exit 1
fi
skopeo login -u "$SCC_USER" --password-stdin registry.suse.com <<EOF
$SCC_PASSWORD
EOF

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +32
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
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing error handling for skopeo inspect commands. If any of the skopeo inspect commands fail (e.g., due to network issues or authentication problems), the script will continue and produce malformed JSON. Consider adding error checks or using 'set -e' to exit on command failures.

Copilot uses AI. Check for mistakes.
stage('Checkout pipeline') {
checkout scm
}
stage('pull all images') {
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stage name 'pull all images' does not accurately describe what the stage does. The script extracts image information but doesn't necessarily pull all images. Consider renaming to 'Extract image information' to better reflect the actual operation.

Suggested change
stage('pull all images') {
stage('Extract image information') {

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,16 @@

Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file starts with an empty line. Consider removing this leading blank line for consistency with typical Jenkins pipeline file formatting.

Suggested change

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants