Skip to content

Implement base changes - #1

Open
gvatsal60 wants to merge 6 commits into
masterfrom
feature/baseline
Open

gvatsal60 wants to merge 6 commits into
masterfrom
feature/baseline

Conversation

@gvatsal60

@gvatsal60 gvatsal60 commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

This pull request introduces significant improvements to CI/CD automation, developer tooling, and repository maintenance. The changes add robust GitHub Actions workflows for CI, release, and bot automation, a sample Jenkinsfile for Jenkins integration, and a comprehensive Makefile for local development. Several unused or placeholder files have been removed to streamline the repository. The .devcontainer setup is updated for Java development, and Dependabot support for Gradle is added.

CI/CD and Automation Enhancements:

  • Added a comprehensive GitHub Actions workflow for CI, supporting multi-JDK testing, linting with pre-commit, and coverage reporting (.github/workflows/ci.yaml).
  • Introduced a release workflow to automate releases on new tags, validate versioning, and generate changelogs (.github/workflows/release.yaml).
  • Added a workflow to auto-approve and merge PRs from bots (.github/workflows/bot-pr.yaml).
  • Enabled Dependabot support for Gradle dependencies in dependabot.yaml.

Developer Tooling and Examples:

  • Added a sample Jenkinsfile.example demonstrating usage of the shared library in Jenkins pipelines.
  • Introduced a Makefile with common targets for building, testing, linting, coverage, and CI tasks.
  • Updated .devcontainer/devcontainer.json to use a Java 21 base image (was Debian) for improved Java development support.
  • Refactored .devcontainer/postCreateScript.sh to simplify and secure alias installation and remove now-unnecessary snippet symlinking logic. [1] [2]

Repository Cleanup and Maintenance:

  • Removed unused or placeholder files: CHANGELOG.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md, CODEOWNERS, .github/FUNDING.yaml, and all issue templates (bug_report.md, feature_request.md, custom.md). [1] [2] [3] [4] [5] [6] [7] [8]
  • Removed legacy auto-approve and merge workflows for Dependabot and pre-commit bots, consolidating automation. [1] [2]

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@gvatsal60 gvatsal60 self-assigned this Aug 1, 2026
echo "EOF" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
@codacy-production

codacy-production Bot commented Aug 1, 2026 •

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 24 medium · 76 minor

Alerts:
⚠ 100 issues (≤ 0 issues of at least minor severity)

Results:
100 new issues

Category Results
BestPractice 24 medium
3 minor
Documentation 2 minor
CodeStyle 71 minor

View in Codacy

🟢 Metrics 22 duplication

Metric Results
Duplication 22

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

The pull request successfully transforms the template into a functional Jenkins Shared Library; however, the submission is currently not up to quality standards according to Codacy. There are critical security and logic issues that must be addressed before merging.

Key concerns include a security vulnerability where passwords are leaked into build logs during Docker operations, and a logic error where the library uses glob patterns with the fileExists step, which Jenkins does not support. Additionally, the library removes essential governance files (CODEOWNERS, CONTRIBUTING.md) which should be restored to maintain project health. Several method names and type declarations should also be refined to prevent collisions with the native Jenkins DSL and improve runtime stability.

About this PR

  • The bot-pr workflow creates a cross-repository dependency on 'gvatsal60/.github'. This creates a risk of workflow failure if the external repository is modified or removed.
  • The PR removes standard repository health files (CODE_OF_CONDUCT.md, CONTRIBUTING.md, CODEOWNERS, and issue templates). These should be restored to maintain project governance.

Test suggestions

  • BuildHelper correctly generates CLI commands for both Maven and Gradle tools
  • Notification helper correctly filters Slack/Email alerts based on status and notifyOnSuccess/Failure flags
  • Docker helper successfully builds and pushes images with appropriate registry and credential handling
  • GitHelper correctly performs checkouts and generates changelogs since the last successful build
  • CI workflow executes unit tests across all specified JDK versions (11, 17, 21)
  • Release workflow validates that the version in library.json matches the Git tag name
  • Pipeline pause logic (waitForInput) respects configured timeouts and manual approval requirements

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

* @param goals Goals/phases to run (default 'clean package' or 'clean build')
* @param extraArgs Extra CLI arguments
*/
void build(Config config, String goals = null, List<String> extraArgs = []) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

The method 'build' is named like a constructor but returns void. In a Jenkins DSL context, this is easily confused with the native 'build' step. Rename this to 'executeBuild' and update internal calls in vars/buildApp.groovy.

See Issue in Codacy

context.sh("docker login ${registry} -u \${DOCKER_USER} -p \${DOCKER_PASS}")
}
} else if (username && password) {
context.sh("docker login ${registry} -u ${username} -p ${password}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 HIGH RISK

Passing the password directly in the shell string is insecure as it will be logged in plain text in the Jenkins console. Use the withCredentials step to wrap this execution or pass the password via an environment variable referenced with single quotes to ensure masking.

} else {
patterns = ['target/surefire-reports/*.xml', 'target/failsafe-reports/*.xml']
}
def allowed = patterns.find { p -> context.fileExists(p) }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

The fileExists step does not support glob patterns (e.g., *.xml). This check will fail for the patterns provided, resulting in test results being skipped. Remove the check and let the junit step handle the glob patterns directly.

* Create a git tag with annotation.
*/
void tag(String tagName, String message = '', String credentialsId = '') {
context.sh("git tag -a ${tagName} -m '${message}'")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

If ${message} contains a single quote (e.g., 'user's bug'), this shell command will fail or behave unexpectedly. Escape the variable or change quoting. Additionally, reorder this public method to appear before private methods like generateChangelog to improve API navigability.

See Issue in Codacy

}

private void sendEmail(String message, String status, Config config) {
def recipients = config.get('emailRecipients')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: Avoid using 'def' for variable declarations to improve type safety. Example: String recipients = config.get('emailRecipients').

See Issue in Codacy

done
fi
fi
curl_https "${ALIAS_SRC_URL}" | sh

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: Piping an external script directly from curl to sh is a security risk. Consider downloading the script, verifying its checksum, and then executing it locally.

Comment thread README.md

## Library Layout

```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Suggestion: Fenced code blocks should have a language specified for better syntax highlighting.

See Issue in Codacy

if (attempt < maxAttempts) {
warn("Attempt ${attempt} of ${maxAttempts} failed: ${e.message}. Retrying...")
if (delayMs > 0) {
context.sleep(time: (long) (delayMs / 1000), unit: 'SECONDS')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚪ LOW RISK

Suggestion: Integer division of delayMs by 1000 results in a zero-second sleep for any delay shorter than one second. Use MILLISECONDS as the unit to preserve precision: context.sleep(time: delayMs, unit: 'MILLISECONDS').

@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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