Skip to content

Conversation

@Sunnatillo
Copy link
Member

@Sunnatillo Sunnatillo commented Nov 6, 2025

This PR fixes jenkins pipeline code formats files with Groovy linters

@metal3-io-bot metal3-io-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 6, 2025
@Sunnatillo
Copy link
Member Author

/cc @lentzi90 @tuminoid

Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

Nice cleanup!
I added suggestions for cleaning up nested withCredentials also.
The quoting was a bit confusing for me first but it seems consistent. If the string contains variables, then " is used, otherwise '. Maybe it helps with accidental evaluation, I don't know but it is ok for me.

@Sunnatillo Sunnatillo force-pushed the Sunnatillo/lint-groovy-code branch from e5c1f96 to ac29806 Compare November 10, 2025 08:39
@Sunnatillo
Copy link
Member Author

Nice cleanup! I added suggestions for cleaning up nested withCredentials also. The quoting was a bit confusing for me first but it seems consistent. If the string contains variables, then " is used, otherwise '. Maybe it helps with accidental evaluation, I don't know but it is ok for me.

Thanks for review @lentzi90. I fixed all nested withCredentials issue as well.

@Sunnatillo Sunnatillo force-pushed the Sunnatillo/lint-groovy-code branch 2 times, most recently from a149794 to c90c65d Compare November 10, 2025 09:19
Copy link
Member

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

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

/approve

@metal3-io-bot metal3-io-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 10, 2025
Copy link
Member

@adilGhaffarDev adilGhaffarDev left a comment

Choose a reason for hiding this comment

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

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 10, 2025
@tuminoid tuminoid requested a review from Copilot November 12, 2025 17:27
Copilot finished reviewing on behalf of tuminoid November 12, 2025 17:28
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 applies Groovy linter formatting fixes to Jenkins pipeline files and adds a linter configuration. The changes include standardizing indentation, converting double quotes to single quotes for static strings, adding type declarations to variables, removing unused imports, and restructuring nested credential blocks.

  • Adds .groovylintrc.json configuration file for Groovy linting
  • Standardizes code formatting across all Jenkins pipeline files (indentation, quotes, spacing)
  • Adds explicit type declarations to variables (string, int)
  • Flattens nested withCredentials blocks for better readability

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
.groovylintrc.json Adds linter configuration with recommended rules and specific exclusions
jenkins/jobs/pre_release_tests.groovy Formats code, adds type declarations, changes quotes to single quotes
jenkins/jobs/image_building.groovy Formats code, adds type declarations, changes quotes to single quotes
jenkins/jobs/e2e_features_test.groovy Formats code, renames TIMEOUT to buildTimeout, adds type declarations
jenkins/jobs/dynamic_fullstack_building.groovy Formats code, renames TIMEOUT to buildTimeout, flattens credentials
jenkins/jobs/dev_env_integration_tests.groovy Formats code, renames TIMEOUT to buildTimeout, adds type declarations
jenkins/jobs/clean_resources.groovy Formats code, renames TIMEOUT to buildTimeout, adds type declarations
jenkins/jobs/capm3-e2e-tests.groovy Formats code, renames TIMEOUT to buildTimeout
jenkins/jobs/bmo_e2e_optional_tests.groovy Formats code, renames TIMEOUT to buildTimeout, adds type declarations
jenkins/jobs/bml_integration_tests.groovy Formats code, changes BOOTSTRAP_CLUSTER to EPHEMERAL_CLUSTER, has syntax error
Comments suppressed due to low confidence (1)

jenkins/jobs/bmo_e2e_optional_tests.groovy:1

  • Variables declared with string type at script scope cannot be referenced later in the pipeline. In Groovy/Jenkins pipelines, script-level variables should be declared without explicit type annotations (use def or no qualifier). The string type is not valid for variable declarations in this context.
// 3 hour

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

ci_git_url = "https://github.com/metal3-io/project-infra.git"
string UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
echo "Test triggered from ${UPDATED_REPO}"
string ci_git_url = 'https://github.com/metal3-io/project-infra.git'
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Variables declared with string type at script scope cannot be referenced in the pipeline environment block (line 39). In Groovy/Jenkins pipelines, script-level variables should be declared without explicit type annotations (use def or no qualifier). The string type is not valid for variable declarations in this context.

Suggested change
string ci_git_url = 'https://github.com/metal3-io/project-infra.git'
def ci_git_url = 'https://github.com/metal3-io/project-infra.git'

Copilot uses AI. Check for mistakes.
Comment on lines 5 to 7
string UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
echo "Test triggered from ${UPDATED_REPO}"
string ci_git_url = 'https://github.com/metal3-io/project-infra.git'
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Variables declared with string type at script scope cannot be referenced in the pipeline environment block (line 31). In Groovy/Jenkins pipelines, script-level variables should be declared without explicit type annotations (use def or no qualifier). The string type is not valid for variable declarations in this context.

Suggested change
string UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
echo "Test triggered from ${UPDATED_REPO}"
string ci_git_url = 'https://github.com/metal3-io/project-infra.git'
def UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
echo "Test triggered from ${UPDATED_REPO}"
def ci_git_url = 'https://github.com/metal3-io/project-infra.git'

Copilot uses AI. Check for mistakes.
script {
string UPDATED_REPO = "https://github.com/${env.REPO_OWNER}/${env.REPO_NAME}.git"
echo "Test triggered from ${UPDATED_REPO}"
string ci_git_url = 'https://github.com/metal3-io/project-infra.git'
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Variables declared with string type at script scope cannot be referenced later in the script. In Groovy/Jenkins pipelines, script-level variables should be declared without explicit type annotations (use def or no qualifier). The string type is not valid for variable declarations in this context.

Suggested change
string ci_git_url = 'https://github.com/metal3-io/project-infra.git'
def ci_git_url = 'https://github.com/metal3-io/project-infra.git'

Copilot uses AI. Check for mistakes.
archiveArtifacts "logs-${env.BUILD_TAG}.tgz"
}
}
archiveArtifacts "logs-${env.BUILD_TAG}.tgz"
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The archiveArtifacts call on line 105 is duplicated (also appears on line 102). This will cause the same artifacts to be archived twice. Remove the duplicate on line 105.

Suggested change
archiveArtifacts "logs-${env.BUILD_TAG}.tgz"

Copilot uses AI. Check for mistakes.
@tuminoid
Copy link
Member

PTAL Copilot review @Sunnatillo

@Sunnatillo Sunnatillo force-pushed the Sunnatillo/lint-groovy-code branch from c90c65d to 8b7c3ac Compare November 12, 2025 21:24
@metal3-io-bot metal3-io-bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 12, 2025
@Sunnatillo Sunnatillo force-pushed the Sunnatillo/lint-groovy-code branch 2 times, most recently from ec52fe6 to b64271f Compare November 12, 2025 21:34
@Sunnatillo Sunnatillo requested a review from Copilot November 13, 2025 06:56
Copilot finished reviewing on behalf of Sunnatillo November 13, 2025 06:58
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

Copilot reviewed 10 out of 10 changed files in this pull request and generated 9 comments.


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

@Sunnatillo Sunnatillo force-pushed the Sunnatillo/lint-groovy-code branch from b64271f to 2f314cf Compare November 13, 2025 07:40
@tuminoid
Copy link
Member

Added #1153 to add prow linter job for groovy after we merge this.

Copy link
Member

@adilGhaffarDev adilGhaffarDev left a comment

Choose a reason for hiding this comment

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

/lgtm

@metal3-io-bot metal3-io-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 20, 2025
@metal3-io-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adilGhaffarDev, lentzi90

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Sunnatillo
Copy link
Member Author

/override metal3-ubuntu-e2e-integration-test-main

@metal3-io-bot
Copy link
Collaborator

@Sunnatillo: Overrode contexts on behalf of Sunnatillo: metal3-ubuntu-e2e-integration-test-main

In response to this:

/override metal3-ubuntu-e2e-integration-test-main

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@metal3-io-bot metal3-io-bot merged commit 872d9df into metal3-io:main Nov 20, 2025
6 checks passed
@metal3-io-bot metal3-io-bot deleted the Sunnatillo/lint-groovy-code branch November 20, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants