Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5271b5bfa5 | ||
|
|
d3e1891725 | ||
|
|
0eab936d85 | ||
|
|
04888150fd | ||
|
|
43fcfe1213 | ||
|
|
fec302d58d | ||
|
|
dabfcce4ad | ||
|
|
3ffe371af2 | ||
|
|
34688a1a53 | ||
|
|
6d181f361b |
No files matched your search
@@ -0,0 +1,9 @@
|
||||
description: >
|
||||
Collects SpotBugs and PMD reports from all modules into a central
|
||||
location for artifact storage. Generates a summary report.
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Collect Static Analysis Reports
|
||||
command: <<include(scripts/collect_static_analysis_reports.sh)>>
|
||||
when: always
|
||||
@@ -2,7 +2,14 @@ description: >
|
||||
Git operations for version management
|
||||
- Adds SSH keys for Git operations
|
||||
- Sets up Git identity for version commits
|
||||
- Commits version changes if modified
|
||||
- Commits version changes if modified (skipped for feature branches)
|
||||
|
||||
parameters:
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, hotfix, or feature"
|
||||
|
||||
steps:
|
||||
- add_ssh_keys # injects the CircleCI User Key (write-capable)
|
||||
- run:
|
||||
@@ -10,4 +17,6 @@ steps:
|
||||
command: <<include(scripts/manage_version_git_config.sh)>>
|
||||
- run:
|
||||
name: Commit version change if modified
|
||||
environment:
|
||||
BRANCH_TYPE: << parameters.branch_type >>
|
||||
command: <<include(scripts/manage_version_commit.sh)>>
|
||||
@@ -0,0 +1,17 @@
|
||||
description: >
|
||||
Runs PMD static analysis on Maven project.
|
||||
Detects code quality issues, potential bugs, and style violations.
|
||||
Requires maven-pmd-plugin configured in project pom.xml.
|
||||
|
||||
parameters:
|
||||
fail_on_violation:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if PMD finds violations"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Run PMD Analysis
|
||||
environment:
|
||||
PMD_FAIL_ON_VIOLATION: << parameters.fail_on_violation >>
|
||||
command: <<include(scripts/mvn_pmd.sh)>>
|
||||
@@ -0,0 +1,18 @@
|
||||
description: >
|
||||
Runs SpotBugs static analysis on Maven project.
|
||||
Reports potential bugs including null pointer issues, resource leaks,
|
||||
and security vulnerabilities (via FindSecBugs plugin).
|
||||
Requires spotbugs-maven-plugin configured in project pom.xml.
|
||||
|
||||
parameters:
|
||||
fail_on_error:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if SpotBugs finds bugs"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Run SpotBugs Analysis
|
||||
environment:
|
||||
SPOTBUGS_FAIL_ON_ERROR: << parameters.fail_on_error >>
|
||||
command: <<include(scripts/mvn_spotbugs.sh)>>
|
||||
@@ -9,4 +9,4 @@ steps:
|
||||
command: <<include(scripts/node_npm_auth.sh)>>
|
||||
- run:
|
||||
name: "Publish to NPM"
|
||||
command: npm publish --access public
|
||||
command: <<include(scripts/node_npm_publish.sh)>>
|
||||
@@ -1,7 +1,7 @@
|
||||
description: >
|
||||
Unified publishing job for all branch types with frontend
|
||||
Handles version management, building, testing, and publishing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
Supports: snapshot, release_candidate, release, hotfix, and feature workflows
|
||||
|
||||
executor: java
|
||||
|
||||
@@ -17,7 +17,7 @@ parameters:
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
description: "Branch type: snapshot, release_candidate, release, hotfix, or feature"
|
||||
|
||||
steps:
|
||||
- install_java:
|
||||
@@ -30,4 +30,5 @@ steps:
|
||||
- frontend_test
|
||||
- frontend_package
|
||||
- mvn_jar_deploy
|
||||
- git_operations
|
||||
- git_operations:
|
||||
branch_type: << parameters.branch_type >>
|
||||
@@ -50,18 +50,20 @@ steps:
|
||||
not:
|
||||
equal: [ "<< parameters.branch_type >>", "feature" ]
|
||||
steps:
|
||||
- git_operations
|
||||
- git_operations:
|
||||
branch_type: << parameters.branch_type >>
|
||||
|
||||
- when:
|
||||
condition: << parameters.publish_asciidoc >>
|
||||
steps:
|
||||
- publish_asciidoc
|
||||
|
||||
# GitHub releases only for final releases and hotfixes (not RCs)
|
||||
# RCs just publish artifacts - GitHub release happens when merged to main
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ "<< parameters.branch_type >>", "release" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "release_candidate" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "hotfix" ]
|
||||
steps:
|
||||
- publish_github_release:
|
||||
|
||||
@@ -27,11 +27,12 @@ steps:
|
||||
- node_build_package
|
||||
- node_publish
|
||||
|
||||
# GitHub releases only for final releases and hotfixes (not RCs)
|
||||
# RCs just publish artifacts - GitHub release happens when merged to main
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: [ "<< parameters.branch_type >>", "release" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "release_candidate" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "hotfix" ]
|
||||
steps:
|
||||
- publish_github_release:
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
description: >
|
||||
Runs SpotBugs and PMD static analysis on a Maven project.
|
||||
This job is designed to be used in an optional workflow triggered
|
||||
by tag (static-analysis/*) or pipeline parameter.
|
||||
|
||||
Usage in consuming repo:
|
||||
workflows:
|
||||
static_analysis:
|
||||
when:
|
||||
or:
|
||||
- matches:
|
||||
pattern: "^static-analysis/.*"
|
||||
value: << pipeline.git.tag >>
|
||||
- equal: [true, << pipeline.parameters.run_static_analysis >>]
|
||||
jobs:
|
||||
- qqq-orb/static_analysis
|
||||
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install"
|
||||
fail_on_spotbugs:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if SpotBugs finds bugs"
|
||||
fail_on_pmd:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if PMD finds violations"
|
||||
run_spotbugs:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run SpotBugs analysis"
|
||||
run_pmd:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run PMD analysis"
|
||||
|
||||
steps:
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
- git_full_checkout
|
||||
- run:
|
||||
name: Setup Maven Settings
|
||||
command: <<include(scripts/setup_maven_settings.sh)>>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- run:
|
||||
name: Build and Install for Analysis
|
||||
command: <<include(scripts/mvn_install_for_analysis.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- when:
|
||||
condition: << parameters.run_spotbugs >>
|
||||
steps:
|
||||
- mvn_spotbugs:
|
||||
fail_on_error: << parameters.fail_on_spotbugs >>
|
||||
- when:
|
||||
condition: << parameters.run_pmd >>
|
||||
steps:
|
||||
- mvn_pmd:
|
||||
fail_on_violation: << parameters.fail_on_pmd >>
|
||||
- collect_static_analysis_reports
|
||||
- store_artifacts:
|
||||
path: /home/circleci/static-analysis-reports
|
||||
destination: static-analysis
|
||||
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Collect SpotBugs and PMD reports to a central location for artifacts
|
||||
REPORT_DIR="/home/circleci/static-analysis-reports"
|
||||
mkdir -p "$REPORT_DIR/spotbugs" "$REPORT_DIR/pmd"
|
||||
|
||||
echo "Collecting static analysis reports..."
|
||||
|
||||
# Collect SpotBugs reports
|
||||
find . -name "spotbugsXml.xml" -exec sh -c '
|
||||
MODULE=$(dirname "$1" | sed "s|^\./||;s|/target.*||" | tr "/" "_")
|
||||
cp "$1" "'"$REPORT_DIR/spotbugs"'/${MODULE}_spotbugs.xml" 2>/dev/null || true
|
||||
' _ {} \;
|
||||
|
||||
# Collect PMD reports
|
||||
find . -name "pmd.xml" -exec sh -c '
|
||||
MODULE=$(dirname "$1" | sed "s|^\./||;s|/target.*||" | tr "/" "_")
|
||||
cp "$1" "'"$REPORT_DIR/pmd"'/${MODULE}_pmd.xml" 2>/dev/null || true
|
||||
' _ {} \;
|
||||
|
||||
# Generate combined summary
|
||||
{
|
||||
echo "=== Static Analysis Report Summary ==="
|
||||
echo "Generated: $(date)"
|
||||
echo ""
|
||||
echo "SpotBugs:"
|
||||
} > "$REPORT_DIR/summary.txt"
|
||||
|
||||
find "$REPORT_DIR/spotbugs" -name "*.xml" 2>/dev/null | while read -r f; do
|
||||
MODULE=$(basename "$f" _spotbugs.xml)
|
||||
COUNT=$(grep -c "<BugInstance" "$f" 2>/dev/null || echo "0")
|
||||
echo " $MODULE: $COUNT bugs" >> "$REPORT_DIR/summary.txt"
|
||||
done
|
||||
|
||||
echo "" >> "$REPORT_DIR/summary.txt"
|
||||
echo "PMD:" >> "$REPORT_DIR/summary.txt"
|
||||
|
||||
find "$REPORT_DIR/pmd" -name "*.xml" 2>/dev/null | while read -r f; do
|
||||
MODULE=$(basename "$f" _pmd.xml)
|
||||
COUNT=$(grep -c "<violation" "$f" 2>/dev/null || echo "0")
|
||||
echo " $MODULE: $COUNT violations" >> "$REPORT_DIR/summary.txt"
|
||||
done
|
||||
|
||||
cat "$REPORT_DIR/summary.txt"
|
||||
echo ""
|
||||
echo "Reports collected to: $REPORT_DIR"
|
||||
@@ -20,6 +20,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
################################################################
|
||||
## Skip version commit for feature branches ##
|
||||
## Feature versions are ephemeral (include commit hash) and ##
|
||||
## don't need to be persisted back to the repository ##
|
||||
################################################################
|
||||
if [[ "$BRANCH_TYPE" == "feature" ]]; then
|
||||
echo "Skipping version commit for feature branch (ephemeral versions)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
################################################################
|
||||
## Check if pom.xml was modified and commit changes if needed ##
|
||||
################################################################
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Building and installing project for static analysis..."
|
||||
mvn install -DskipTests -Dmaven.javadoc.skip=true -Dcheckstyle.skip=true
|
||||
echo "Build complete - artifacts installed to local repository"
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Running PMD static analysis..."
|
||||
|
||||
# Default to report-only mode unless PMD_FAIL_ON_VIOLATION is set
|
||||
FAIL_FLAG=""
|
||||
if [ "${PMD_FAIL_ON_VIOLATION}" = "true" ]; then
|
||||
FAIL_FLAG="-Dpmd.failOnViolation=true"
|
||||
fi
|
||||
|
||||
# Run PMD
|
||||
mvn pmd:check -DskipTests ${FAIL_FLAG} 2>&1 | tee /tmp/pmd-output.txt
|
||||
|
||||
# Summarize results
|
||||
echo ""
|
||||
echo "=== PMD Summary ==="
|
||||
find . -name "pmd.xml" -exec sh -c '
|
||||
MODULE=$(dirname "$1" | sed "s|^\./||;s|/target.*||")
|
||||
COUNT=$(grep -c "<violation" "$1" 2>/dev/null || echo "0")
|
||||
echo " $MODULE: $COUNT violations"
|
||||
' _ {} \; 2>/dev/null | sort || true
|
||||
echo "==================="
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "Running SpotBugs static analysis..."
|
||||
|
||||
# Default to report-only mode unless SPOTBUGS_FAIL_ON_ERROR is set
|
||||
FAIL_FLAG=""
|
||||
if [ "${SPOTBUGS_FAIL_ON_ERROR}" = "true" ]; then
|
||||
FAIL_FLAG="-Dspotbugs.failOnError=true"
|
||||
fi
|
||||
|
||||
# Run SpotBugs
|
||||
mvn spotbugs:check -DskipTests ${FAIL_FLAG} 2>&1 | tee /tmp/spotbugs-output.txt
|
||||
|
||||
# Summarize results
|
||||
echo ""
|
||||
echo "=== SpotBugs Summary ==="
|
||||
find . -name "spotbugsXml.xml" -exec sh -c '
|
||||
MODULE=$(dirname "$1" | sed "s|^\./||;s|/target.*||")
|
||||
COUNT=$(grep -c "<BugInstance" "$1" 2>/dev/null || echo "0")
|
||||
echo " $MODULE: $COUNT bugs"
|
||||
' _ {} \; 2>/dev/null | sort || true
|
||||
echo "========================"
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## node_npm_publish.sh
|
||||
## NPM Publishing Script with Prerelease Tag Support
|
||||
##
|
||||
## This script publishes npm packages with proper handling of prerelease
|
||||
## versions. NPM requires a --tag flag for prerelease versions.
|
||||
##
|
||||
## Prerelease detection:
|
||||
## - RC versions (e.g., 1.0.0-RC.1) -> --tag rc
|
||||
## - SNAPSHOT versions (e.g., 1.0.0-SNAPSHOT) -> --tag snapshot
|
||||
## - Alpha/Beta versions -> --tag next
|
||||
## - Stable versions (e.g., 1.0.0) -> --tag latest (default)
|
||||
##
|
||||
## Usage: Called by CircleCI orb command node_publish
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Extract version from package.json
|
||||
VERSION=$(grep '"version"' package.json | sed 's/.*"version": "//;s/".*//')
|
||||
echo "Publishing version: $VERSION"
|
||||
|
||||
# Determine the appropriate npm tag based on version
|
||||
if [[ "$VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||
NPM_TAG="rc"
|
||||
echo "Detected RC version - using tag: $NPM_TAG"
|
||||
elif [[ "$VERSION" =~ -SNAPSHOT$ ]]; then
|
||||
NPM_TAG="snapshot"
|
||||
echo "Detected SNAPSHOT version - using tag: $NPM_TAG"
|
||||
elif [[ "$VERSION" =~ -(alpha|beta) ]]; then
|
||||
NPM_TAG="next"
|
||||
echo "Detected alpha/beta version - using tag: $NPM_TAG"
|
||||
else
|
||||
NPM_TAG="latest"
|
||||
echo "Detected stable version - using tag: $NPM_TAG"
|
||||
fi
|
||||
|
||||
# Publish with the appropriate tag
|
||||
echo "Running: npm publish --access public --tag $NPM_TAG"
|
||||
npm publish --access public --tag "$NPM_TAG"
|
||||
|
||||
echo "Successfully published $VERSION with tag $NPM_TAG"
|
||||
Reference in new issue
Block a user