Skip to content

MLE-22024: Add BlackDuck scan for latest images #359

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

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from

Conversation

rwinieski
Copy link
Collaborator

Description

Checklist:

  • Owner:
  • JIRA_ID as part of branch/PR name

  • Rebase the branch with upstream

  • Squashed all commits into a single commit

  • Added Tests

  • Reviewer:
  • Reviewed Tests

  • Added to Release Wiki/Jira

@rwinieski rwinieski requested review from Copilot and vitalykorolev and removed request for Copilot June 18, 2025 08:00
Copilot

This comment was marked as outdated.

@rwinieski rwinieski requested a review from Copilot June 25, 2025 09:14
Copy link

@Copilot 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

Adds a new option to trigger BlackDuck scans against all “latest” MarkLogic Docker images from DockerHub, with scheduling support.

  • Extended scanWithBlackDuck to accept a scanType parameter (current or latest) and fetch tags via curl/jq.
  • Introduced SCAN_LATEST_IMAGES boolean parameter and a dedicated pipeline stage for manual or scheduled “latest” scans.
  • Updated parameterizedCron to run weekly scans of all latest images on Mondays at 1 AM.
Comments suppressed due to low confidence (2)

Jenkinsfile:591

  • There are no tests verifying the new 'latest' scan path; consider adding unit or integration tests for scanWithBlackDuck('latest') to ensure tag parsing and job triggering behave as expected.
            when {

Jenkinsfile:484

  • [nitpick] While the parameter description is clear, consider updating the top-level pipeline comments or README to explain the new SCAN_LATEST_IMAGES flag and its scheduled usage for maintainers.
        booleanParam(name: 'SCAN_LATEST_IMAGES', defaultValue: false, description: 'Scan all latest standard MarkLogic Docker images from DockerHub with BlackDuck')

Comment on lines +384 to +388
// Use only the standard MarkLogic Docker images
def allImages = dockerHubImages

// Filter out empty lines and create comma-separated list
def imageList = allImages.split('\n').findAll { it.trim() != '' }.join(',')
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

The variable 'allImages' simply aliases 'dockerHubImages'; consider removing this redundant assignment and using 'dockerHubImages' directly to reduce indirection.

Suggested change
// Use only the standard MarkLogic Docker images
def allImages = dockerHubImages
// Filter out empty lines and create comma-separated list
def imageList = allImages.split('\n').findAll { it.trim() != '' }.join(',')
// Filter out empty lines and create comma-separated list
def imageList = dockerHubImages.split('\n').findAll { it.trim() != '' }.join(',')

Copilot uses AI. Check for mistakes.

Comment on lines +380 to +381
curl -s "https://hub.docker.com/v2/repositories/marklogic/marklogic-server/tags?page_size=100" | \
jq -r '.results[] | select(.name | startswith("latest-")) | "marklogic/marklogic-server:" + .name'
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

Limiting 'page_size=100' may miss tags if the repository grows beyond 100; consider implementing pagination to ensure all 'latest-*' tags are retrieved.

Suggested change
curl -s "https://hub.docker.com/v2/repositories/marklogic/marklogic-server/tags?page_size=100" | \
jq -r '.results[] | select(.name | startswith("latest-")) | "marklogic/marklogic-server:" + .name'
page=1
all_tags=""
while true; do
response=$(curl -s "https://hub.docker.com/v2/repositories/marklogic/marklogic-server/tags?page_size=100&page=$page")
tags=$(echo "$response" | jq -r '.results[] | select(.name | startswith("latest-")) | "marklogic/marklogic-server:" + .name')
if [ -z "$tags" ]; then
break
fi
all_tags="$all_tags\n$tags"
page=$((page + 1))
done
echo -e "$all_tags" | sed '/^$/d'

Copilot uses AI. Check for mistakes.

}
}
steps {
scanWithBlackDuck()
}
}

// Stage: Scan all latest standard MarkLogic images from DockerHub
stage('Scan-Latest-Docker-Images') {
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

[nitpick] This stage can be triggered on any branch when SCAN_LATEST_IMAGES=true; consider adding a branch filter (e.g., only on 'develop') to avoid unintended scans on feature or release branches.

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.

1 participant