Compare commits
141
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c0530ee74
|
||
|
|
225186356a
|
||
|
|
edc1365ac9 | ||
|
|
0f33ddadf8 | ||
|
|
5e9bbb54ec | ||
|
|
5bcec90e33 | ||
|
|
a50b07d927 | ||
|
|
6318d90e96 | ||
|
|
a6fea661ff | ||
|
|
2894bae29a | ||
|
|
a14e8f9b24 | ||
|
|
83611872a3 | ||
|
|
30c4e0e85c | ||
|
|
f429d9f3c4 | ||
|
|
8c994aa824 | ||
|
|
344a3f7665
|
||
|
|
cec106ce30 | ||
|
|
ba6a3c6f92
|
||
|
|
43144c974b | ||
|
|
6806de4892
|
||
|
|
a9d51ebd47 | ||
|
|
284c69aa3e
|
||
|
|
fb30d9acc5
|
||
|
|
563f88bdad | ||
|
|
4cb662f076
|
||
|
|
a2cdd818f6 | ||
|
|
42e0be02c9
|
||
|
|
b71c9ca4d7
|
||
|
|
7dd5f38d35 | ||
|
|
02c14d7237
|
||
|
|
8121e69565 | ||
|
|
bcab95daa8
|
||
|
|
33a35a0dfa
|
||
|
|
68ff0e2b37
|
||
|
|
071dc3ae29
|
||
|
|
64e8d68cb3
|
||
|
|
58b064d51d
|
||
|
|
848210d9f6
|
||
|
|
f2749a71f9
|
||
|
|
dd2ee0fbb0
|
||
|
|
aaba1d9c5d
|
||
|
|
26b0a3a18b
|
||
|
|
9ea11d511b | ||
|
|
81c5086ee4
|
||
|
|
30a49c9c97 | ||
|
|
93ee1b4752 | ||
|
|
988401023a | ||
|
|
e23bd4588d | ||
|
|
51e9bba5b0 | ||
|
|
dae3f4b677 | ||
|
|
20d324957d | ||
|
|
bdff16ff95 | ||
|
|
dbd158e5eb | ||
|
|
1297ba10f0 | ||
|
|
62ae2f7d29 | ||
|
|
99fa73a581 | ||
|
|
c561e4d290 | ||
|
|
8d7f645c0e | ||
|
|
9285f2d842 | ||
|
|
f4e1536d77 | ||
|
|
8d1b353fe2 | ||
|
|
d24b7d131f | ||
|
|
184b7c54e9 | ||
|
|
2471f5adff | ||
|
|
546bf38a0b | ||
|
|
ab841b2ddd | ||
|
|
3b3d80188d | ||
|
|
5271b5bfa5 | ||
|
|
d3e1891725 | ||
|
|
0eab936d85 | ||
|
|
04888150fd | ||
|
|
43fcfe1213 | ||
|
|
fec302d58d | ||
|
|
dabfcce4ad | ||
|
|
3ffe371af2 | ||
|
|
34688a1a53 | ||
|
|
6d181f361b | ||
|
|
d4ba7722c7 | ||
|
|
43ccb6ced0 | ||
|
|
b34cde9d19 | ||
|
|
19deffb20e | ||
|
|
a50948c1af | ||
|
|
7c79a57a8a | ||
|
|
aa4442618b | ||
|
|
825937776c | ||
|
|
41702b0a30 | ||
|
|
b3c6f237ee | ||
|
|
6649766a51 | ||
|
|
342646a856 | ||
|
|
c43666fb4c | ||
|
|
eff82e0ffd | ||
|
|
a1c797d897 | ||
|
|
76f37ad23a | ||
|
|
b1523223d0 | ||
|
|
09db303b9b | ||
|
|
eedc21aeff | ||
|
|
f23015ff1e | ||
|
|
b4a6aa0d4c | ||
|
|
a347ddd68b | ||
|
|
f6e04f7a58 | ||
|
|
5580d51cf7 | ||
|
|
eb9de5db69 | ||
|
|
3f5dd9a746 | ||
|
|
65787b7dd2 | ||
|
|
4f07167e26 | ||
|
|
84a0e345b9 | ||
|
|
a1ef2a419f | ||
|
|
99a776ee2a | ||
|
|
5b167ca8f8 | ||
|
|
43247349d7 | ||
|
|
4486188522 | ||
|
|
1232a17f36 | ||
|
|
1f2e730512 | ||
|
|
2b59dac369 | ||
|
|
22fa420c52 | ||
|
|
f337e2ff51 | ||
|
|
9d1a70e433 | ||
|
|
145c99e2f8 | ||
|
|
8792d74fb0 | ||
|
|
5b5df41faa | ||
|
|
59c80f756a | ||
|
|
187d0df5c7 | ||
|
|
aa5cab7390 | ||
|
|
f2d8a9927a | ||
|
|
8820a7af82 | ||
|
|
8adb9e65f7 | ||
|
|
492af48c0d | ||
|
|
ae26b2288a | ||
|
|
f122b4a470 | ||
|
|
ea30ebdb2f | ||
|
|
06a3d113bd | ||
|
|
b0dc7e1eea | ||
|
|
0bbd09cdca | ||
|
|
9af91511aa | ||
|
|
7e3b967bb2 | ||
|
|
629ec15a2e | ||
|
|
f10f63fe27 | ||
|
|
c0365111f5 | ||
|
|
002b82d1f1 | ||
|
|
9751567138 | ||
|
|
0383e9fabf |
No files matched your search
@@ -1,5 +1,9 @@
|
||||
version: 2.1
|
||||
setup: true
|
||||
parameters:
|
||||
run_rc_finalize_sweep:
|
||||
type: boolean
|
||||
default: false
|
||||
orbs:
|
||||
orb-tools: circleci/orb-tools@12.3
|
||||
shellcheck: circleci/shellcheck@3.2
|
||||
@@ -8,8 +12,23 @@ filters: &filters
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
jobs:
|
||||
rc-finalize-sweep:
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
resource_class: small
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Reconcile pending QBit releases
|
||||
command: |
|
||||
RC_REPOSITORIES_JSON="$(cat tools/rc-repositories.json)" \
|
||||
python3 src/scripts/rc_finalize_sweep.py
|
||||
|
||||
workflows:
|
||||
lint-pack:
|
||||
when:
|
||||
not: << pipeline.parameters.run_rc_finalize_sweep >>
|
||||
jobs:
|
||||
- orb-tools/lint:
|
||||
filters: *filters
|
||||
@@ -27,3 +46,13 @@ workflows:
|
||||
orb_name: qqq-orb
|
||||
requires: [orb-tools/lint, orb-tools/pack, orb-tools/review, shellcheck/check]
|
||||
filters: *filters
|
||||
reconcile-releases:
|
||||
when: << pipeline.parameters.run_rc_finalize_sweep >>
|
||||
jobs:
|
||||
- rc-finalize-sweep:
|
||||
context: qqq-maven-registry-credentials
|
||||
filters:
|
||||
branches:
|
||||
only: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
+142
-18
@@ -12,23 +12,146 @@ filters: &filters
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
# Filter for release tags.
|
||||
release-filters: &release-filters
|
||||
# Auto-publish filters.
|
||||
develop-filters: &develop-filters
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
|
||||
only: [develop]
|
||||
|
||||
main-filters: &main-filters
|
||||
branches:
|
||||
only: [main]
|
||||
|
||||
jobs:
|
||||
maven-publication-contract:
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: cimg/openjdk:21.0
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Verify resolved multi-module publication POMs
|
||||
command: python3 tests/test_maven_publication_poms.py
|
||||
pipeline-contract-test:
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: cimg/python:3.12-node
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install the setup manifest parser
|
||||
command: python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
- run:
|
||||
name: Verify pipeline selection and Maven compatibility contracts
|
||||
command: |
|
||||
python3 tests/test_generate_pipeline.py
|
||||
python3 scripts/pack_pipeline.py --check
|
||||
bash tests/test_cli_ci_behavior.sh
|
||||
python3 tests/test_cli_ci_contract.py
|
||||
python3 tests/test_maven_ci_contract.py
|
||||
python3 tests/test_standardize_qbit.py
|
||||
python3 tests/test_rollout_version.py
|
||||
python3 tests/test_validate_standard.py
|
||||
python3 tests/test_voyage_profile.py
|
||||
python3 tests/test_next_native.py
|
||||
python3 tests/test_auxiliary_workflows.py
|
||||
python3 tests/test_intellij_plugin.py
|
||||
python3 tests/test_workflow_lint.py
|
||||
python3 tests/test_business_e2e.py
|
||||
python3 tests/test_qctl_native.py
|
||||
python3 -m unittest discover -s tests -p test_generate_qctl_workflow.py
|
||||
python3 tests/test_rc_finalize_sweep.py
|
||||
python3 tests/test_rc_guard.py
|
||||
python3 -m unittest discover -s tests -p test_rc_timeout_recovery.py
|
||||
python3 -m unittest discover -s tests -p test_rc_ref_lookup.py
|
||||
python3 -m unittest discover -s tests -p test_generate_rc_workflow.py
|
||||
python3 -m unittest discover -s tests -p test_audit_estate.py
|
||||
python3 tests/test_all_profiles.py
|
||||
python3 tests/test_generate_all_release.py
|
||||
python3 -m unittest discover -s tests -p 'test_qqq_all_release*.py'
|
||||
python3 tests/test_verify_all_circle_smoke.py
|
||||
python3 tests/test_mobile_policy_profiles.py
|
||||
bash tests/test_all_artifact.sh
|
||||
python3 tests/test_maven_ci_rc_completion.py
|
||||
bash tests/test_maven_ci_push.sh
|
||||
bash tests/test_create_github_release.sh
|
||||
bash tests/test_maven_ci_cache.sh
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
# Create jobs to test the commands of your orbs.
|
||||
# You may want to add additional validation steps to ensure the commands are working as expected.
|
||||
command-test:
|
||||
docker:
|
||||
- image: cimg/base:current
|
||||
- image: cimg/node:24.21
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Verify Maven settings stay out of build logs
|
||||
command: bash tests/test_maven_settings_output.sh
|
||||
- run:
|
||||
name: Verify npm publisher authentication and dist-tags
|
||||
command: python3 tests/test_node_npm_publish.py
|
||||
# Run your orb's commands to validate them.
|
||||
- qqq-orb/install_asciidoctor
|
||||
|
||||
publish-dev-snapshot:
|
||||
docker:
|
||||
- image: circleci/circleci-cli:latest
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Pack and Publish Dev Snapshot
|
||||
command: |
|
||||
circleci orb pack src > /tmp/orb.yml
|
||||
circleci orb validate /tmp/orb.yml
|
||||
circleci orb publish --token "${CIRCLE_TOKEN}" /tmp/orb.yml kingsrook/qqq-orb@dev:snapshot
|
||||
echo "Published kingsrook/qqq-orb@dev:snapshot"
|
||||
|
||||
publish-production:
|
||||
docker:
|
||||
- image: circleci/circleci-cli:latest
|
||||
steps:
|
||||
- checkout
|
||||
- add_ssh_keys
|
||||
- run:
|
||||
name: Calculate Next Version and Publish
|
||||
command: |
|
||||
git fetch --tags
|
||||
LATEST=$(git tag -l 'v*' | sort -V | tail -1)
|
||||
LATEST=${LATEST:-v0.0.0}
|
||||
LATEST_CLEAN=${LATEST#v}
|
||||
|
||||
# Check recent commit messages for bump keywords
|
||||
BUMP="patch"
|
||||
COMMITS=$(git log "${LATEST}..HEAD" --pretty=%s 2>/dev/null || git log --pretty=%s -10)
|
||||
if echo "${COMMITS}" | grep -qi '\[major\]'; then
|
||||
BUMP="major"
|
||||
elif echo "${COMMITS}" | grep -qi '\[minor\]'; then
|
||||
BUMP="minor"
|
||||
fi
|
||||
|
||||
IFS='.' read -r MAJOR MINOR PATCH \<<< "${LATEST_CLEAN}"
|
||||
case "${BUMP}" in
|
||||
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
|
||||
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
|
||||
patch) PATCH=$((PATCH + 1)) ;;
|
||||
esac
|
||||
VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||
|
||||
echo "Latest: ${LATEST} | Bump: ${BUMP} | Next: ${VERSION}"
|
||||
|
||||
circleci orb pack src > /tmp/orb.yml
|
||||
circleci orb validate /tmp/orb.yml
|
||||
circleci orb publish --token "${CIRCLE_TOKEN}" /tmp/orb.yml "kingsrook/qqq-orb@${VERSION}"
|
||||
|
||||
git config user.email "ci@qrun.io"
|
||||
git config user.name "CircleCI"
|
||||
git tag -a "v${VERSION}" -m "Release v${VERSION}"
|
||||
git push origin "v${VERSION}"
|
||||
|
||||
echo "Published kingsrook/qqq-orb@${VERSION}"
|
||||
|
||||
workflows:
|
||||
test-deploy:
|
||||
jobs:
|
||||
@@ -36,16 +159,17 @@ workflows:
|
||||
# Test your orb's commands in a custom job and test your orb's jobs directly as a part of this workflow.
|
||||
- command-test:
|
||||
filters: *filters
|
||||
# The orb must be re-packed for publishing, and saved to the workspace.
|
||||
- orb-tools/pack:
|
||||
filters: *release-filters
|
||||
- orb-tools/publish:
|
||||
orb_name: kingsrook/qqq-orb
|
||||
vcs_type: << pipeline.project.type >>
|
||||
pub_type: production
|
||||
# Ensure this job requires all test jobs and the pack job.
|
||||
requires:
|
||||
- orb-tools/pack
|
||||
- command-test
|
||||
- pipeline-contract-test:
|
||||
filters: *filters
|
||||
- maven-publication-contract:
|
||||
filters: *filters
|
||||
# Auto-publish dev snapshot on develop
|
||||
- publish-dev-snapshot:
|
||||
context: orb-publishing
|
||||
filters: *release-filters
|
||||
filters: *develop-filters
|
||||
requires: [command-test, pipeline-contract-test, maven-publication-contract]
|
||||
# Auto-publish production release on main
|
||||
- publish-production:
|
||||
context: orb-publishing
|
||||
filters: *main-filters
|
||||
requires: [command-test, pipeline-contract-test, maven-publication-contract]
|
||||
@@ -0,0 +1,6 @@
|
||||
# Packed scripts execute on Linux regardless of the contributor's checkout OS.
|
||||
*.sh text eol=lf
|
||||
*.py text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
*.json text eol=lf
|
||||
@@ -0,0 +1 @@
|
||||
* @KofTwentyTwo
|
||||
@@ -0,0 +1,31 @@
|
||||
# GitHub Release Configuration
|
||||
# Auto-generates release notes from PR labels
|
||||
|
||||
changelog:
|
||||
exclude:
|
||||
labels:
|
||||
- ignore-for-release
|
||||
- duplicate
|
||||
- invalid
|
||||
authors:
|
||||
- dependabot
|
||||
- dependabot[bot]
|
||||
categories:
|
||||
- title: Breaking Changes
|
||||
labels:
|
||||
- breaking-change
|
||||
- breaking
|
||||
- title: New Features
|
||||
labels:
|
||||
- enhancement
|
||||
- feature
|
||||
- title: Bug Fixes
|
||||
labels:
|
||||
- bug
|
||||
- fix
|
||||
- title: Dependencies
|
||||
labels:
|
||||
- dependencies
|
||||
- title: Other Changes
|
||||
labels:
|
||||
- "*"
|
||||
@@ -0,0 +1,18 @@
|
||||
name: Database migrations
|
||||
jobs:
|
||||
empty-database-migration:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- name: Empty PostgreSQL -> migrate -> validate, demo determinism, forward-only
|
||||
policy
|
||||
run: mvn -B -pl db verify
|
||||
'on':
|
||||
workflow_call: {}
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -0,0 +1,83 @@
|
||||
name: Required E2E validation
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
e2e:
|
||||
name: E2E / live services
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
CI: 'true'
|
||||
E2E_BASE_URL: http://localhost:3004
|
||||
E2E_API_URL: http://localhost:18080
|
||||
E2E_KEYCLOAK_URL: http://localhost:18081
|
||||
NEXTAUTH_URL: http://localhost:3004
|
||||
NEXTAUTH_SECRET: ci-only-e2e-secret-not-for-production
|
||||
KEYCLOAK_ISSUER: http://localhost:18081/realms/qqq-platform
|
||||
KEYCLOAK_CLIENT_ID: platform-web
|
||||
KEYCLOAK_CLIENT_SECRET: platform-web-secret
|
||||
API_BASE_URL_INTERNAL: http://localhost:18080
|
||||
E2E_ALERT_WEBHOOK_URL: ${{ secrets.E2E_ALERT_WEBHOOK_URL }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: web/package-lock.json
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- name: Install web dependencies and Chromium
|
||||
working-directory: web
|
||||
run: 'npm ci
|
||||
|
||||
npx playwright install --with-deps chromium
|
||||
|
||||
'
|
||||
- name: Start actual platform dependencies and API
|
||||
run: docker compose -f deploy/compose/docker-compose.yml up -d --build postgres migrate keycloak minio minio-setup mailpit qqq-server
|
||||
- name: Wait for actual services
|
||||
shell: bash
|
||||
run: "set -euo pipefail\nwait_for() {\n local name=\"$1\" url=\"$2\"\n for _attempt in {1..90}; do\n if curl --fail --silent --show-error \"$url\" >/dev/null; then\n echo \"$name is ready\"\n return 0\n fi\n sleep 2\n done\n echo \"::error::$name did not become ready at $url\"\n docker compose -f deploy/compose/docker-compose.yml ps\n return 1\n}\nwait_for Keycloak \"$E2E_KEYCLOAK_URL/realms/qqq-platform/.well-known/openid-configuration\"\nwait_for API \"$E2E_API_URL/api/public/v1/health\"\n"
|
||||
- name: Run blocking E2E suite
|
||||
working-directory: web
|
||||
run: npm run test:e2e:ci
|
||||
- name: Publish test summary
|
||||
if: always()
|
||||
working-directory: web
|
||||
run: node scripts/report-e2e-results.mjs
|
||||
- name: Upload Playwright evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-results-${{ github.run_id }}
|
||||
path: 'web/playwright-report/
|
||||
|
||||
web/test-results/
|
||||
|
||||
'
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
- name: Notify configured alert webhook
|
||||
if: failure() && env.E2E_ALERT_WEBHOOK_URL != ''
|
||||
run: "curl --fail-with-body -X POST -H 'Content-Type: application/json' \\\n --data \"{\\\"text\\\":\\\"E2E validation failed for $GITHUB_REPOSITORY ($GITHUB_REF_NAME): $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\\\"}\" \\\n \"$E2E_ALERT_WEBHOOK_URL\"\n"
|
||||
- name: Show service logs after failure
|
||||
if: failure()
|
||||
run: docker compose -f deploy/compose/docker-compose.yml logs --no-color --tail=300
|
||||
- name: Stop services
|
||||
if: always()
|
||||
run: docker compose -f deploy/compose/docker-compose.yml down -v
|
||||
deployment-gate:
|
||||
name: Deployment gate / E2E passed
|
||||
needs: e2e
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "Deployment is permitted only because the live-service E2E job passed."
|
||||
'on':
|
||||
workflow_call:
|
||||
secrets:
|
||||
E2E_ALERT_WEBHOOK_URL:
|
||||
required: false
|
||||
@@ -0,0 +1,42 @@
|
||||
name: CodeQL Advanced
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze (${{ matrix.language }})
|
||||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
|
||||
permissions:
|
||||
security-events: write
|
||||
packages: read
|
||||
actions: read
|
||||
contents: read
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- language: java-kotlin
|
||||
build-mode: none
|
||||
- language: javascript-typescript
|
||||
build-mode: none
|
||||
- language: actions
|
||||
build-mode: none
|
||||
- language: python
|
||||
build-mode: none
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
build-mode: ${{ matrix.build-mode }}
|
||||
- name: Run manual build steps
|
||||
if: matrix.build-mode == 'manual'
|
||||
shell: bash
|
||||
run: "echo 'If you are using a \"manual\" build mode for one or more of the' \\\n 'languages you are analyzing, replace\
|
||||
\ this with the commands to build' \\\n 'your code, for example:'\necho ' make bootstrap'\necho ' make release'\n\
|
||||
exit 1\n"
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
with:
|
||||
category: /language:${{matrix.language}}
|
||||
'on':
|
||||
workflow_call: {}
|
||||
@@ -0,0 +1,51 @@
|
||||
name: Published BOM consumer
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
verify:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
- name: Check source and release version
|
||||
env:
|
||||
CANDIDATE_VERSION: ${{ inputs.version }}
|
||||
SOURCE_REF: ${{ github.ref }}
|
||||
run: "python3 - <<'PY'\nimport os\nimport re\nimport xml.etree.ElementTree as ET\n\nversion = os.environ[\"CANDIDATE_VERSION\"\
|
||||
]\nsource_ref = os.environ[\"SOURCE_REF\"]\nif not re.fullmatch(r\"4\\.1\\.0(?:-RC\\.[1-9][0-9]*)?\", version):\n\
|
||||
\ raise SystemExit(\"Version must be 4.1.0 or a 4.1.0-RC.N candidate\")\nexpected_ref = \"refs/heads/release/4.1\"\
|
||||
\ if \"-RC.\" in version else \"refs/tags/v4.1.0\"\nif source_ref != expected_ref:\n raise SystemExit(f\"Select\
|
||||
\ {expected_ref} for {version}; received {source_ref}\")\nroot = ET.parse(\"pom.xml\").getroot()\nns = {\"m\": \"\
|
||||
http://maven.apache.org/POM/4.0.0\"}\nrevision = root.findtext(\"m:properties/m:revision\", namespaces=ns)\nif revision\
|
||||
\ != version:\n raise SystemExit(f\"Source revision {revision} differs from {version}\")\nPY\n"
|
||||
- name: Resolve the public BOM from a fresh consumer
|
||||
env:
|
||||
CANDIDATE_VERSION: ${{ inputs.version }}
|
||||
run: python3 qqq-sample-project/verify-published-bom.py "$CANDIDATE_VERSION"
|
||||
- name: Retain resolution evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: published-bom-evidence
|
||||
if-no-files-found: warn
|
||||
path: 'qqq-sample-project/target/published-bom-*/evidence.json
|
||||
|
||||
qqq-sample-project/target/published-bom-*/pom.xml
|
||||
|
||||
qqq-sample-project/target/published-bom-*/maven.log
|
||||
|
||||
qqq-sample-project/target/published-bom-*/dependency-tree.json
|
||||
|
||||
'
|
||||
'on':
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
description: Published QQQ release or candidate version
|
||||
required: true
|
||||
type: string
|
||||
@@ -0,0 +1,109 @@
|
||||
name: Public quickstart lifecycle
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
lifecycle:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJSON(inputs.boundary_capture && '{"os":["macos-15"],"browser":["webkit"]}' || '{"os":["ubuntu-24.04","macos-14"],"browser":["chromium","firefox","webkit"],"exclude":[{"os":"macos-14","browser":"webkit"}],"include":[{"os":"macos-15","browser":"webkit"}]}')
|
||||
}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: QRun-IO/qqq-frontend-next
|
||||
ref: 2853b9b148282ae0e6d454adab6d0f534ba48280
|
||||
path: acceptance-tools
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
- name: Install acceptance tools only
|
||||
working-directory: acceptance-tools
|
||||
run: 'corepack enable
|
||||
|
||||
corepack prepare pnpm@9.15.9 --activate
|
||||
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
pnpm exec playwright install --with-deps "$BROWSER"
|
||||
|
||||
'
|
||||
env:
|
||||
BROWSER: ${{ matrix.browser }}
|
||||
- name: Diagnostic boundary preflight
|
||||
if: ${{ inputs.boundary_capture }}
|
||||
env:
|
||||
EXPECTED_SHA: ${{ inputs.source_sha }}
|
||||
QQQ_QUICKSTART_PREFLIGHT_OUTPUT: ${{ runner.temp }}/qqq-quickstart-diagnostic
|
||||
run: 'umask 077
|
||||
|
||||
mkdir -p "$QQQ_QUICKSTART_PREFLIGHT_OUTPUT"
|
||||
|
||||
node --test qqq-sample-project/acceptance/quickstart/*.test.mjs > "$QQQ_QUICKSTART_PREFLIGHT_OUTPUT/pure-tests.log"
|
||||
2>&1
|
||||
|
||||
node qqq-sample-project/acceptance/quickstart/boundary-preflight.mjs
|
||||
|
||||
'
|
||||
- name: Run the public launcher lifecycle
|
||||
env:
|
||||
QQQ_QUICKSTART_BOUNDARY_CAPTURE: ${{ inputs.boundary_capture && '1' || '0' }}
|
||||
CANDIDATE_VERSION: ${{ inputs.version }}
|
||||
EXPECTED_SHA: ${{ inputs.source_sha }}
|
||||
BROWSER: ${{ matrix.browser }}
|
||||
run: "umask 077\nif [[ \"$GITHUB_EVENT_NAME\" == \"push\" ]]; then\n CANDIDATE_VERSION=\"${GITHUB_REF_NAME#quickstart-}\"\
|
||||
\n EXPECTED_SHA=\"$(git rev-parse HEAD)\"\nfi\nrun_lifecycle() {\n node qqq-sample-project/acceptance/quickstart/run-public.mjs\
|
||||
\ \\\n --playwright-project acceptance-tools \\\n --output \"$RUNNER_TEMP/qqq-public-lifecycle\" \\\n --version\
|
||||
\ \"$CANDIDATE_VERSION\" --expected-sha \"$EXPECTED_SHA\" \\\n --browser \"$BROWSER\"\n}\nif [[ \"$QQQ_QUICKSTART_BOUNDARY_CAPTURE\"\
|
||||
\ == \"1\" ]]; then\n set -o pipefail\n mkdir -p \"$RUNNER_TEMP/qqq-quickstart-private-protocol\"\n DEBUG=pw:browser,pw:protocol\
|
||||
\ DEBUG_FILE=\"$RUNNER_TEMP/qqq-quickstart-private-protocol/protocol.raw\" run_lifecycle 2>&1 | tee \"$RUNNER_TEMP/qqq-quickstart-diagnostic/native.log\"\
|
||||
\nelse\n run_lifecycle\nfi\n"
|
||||
- name: Summarize private first-page protocol
|
||||
if: ${{ always() && inputs.boundary_capture }}
|
||||
run: "umask 077\nnode qqq-sample-project/acceptance/quickstart/protocol-files.mjs \\\n \"$RUNNER_TEMP/qqq-quickstart-private-protocol/protocol.raw\"\
|
||||
\ \\\n \"$RUNNER_TEMP/qqq-public-lifecycle/phase-journal.json\" \\\n \"$RUNNER_TEMP/qqq-quickstart-diagnostic/first-page-protocol.json\"\
|
||||
\n"
|
||||
- name: Retain lifecycle results
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: quickstart-${{ matrix.os }}-${{ matrix.browser }}
|
||||
if-no-files-found: error
|
||||
path: '${{ runner.temp }}/qqq-public-lifecycle/*.json
|
||||
|
||||
${{ runner.temp }}/qqq-public-lifecycle/*.log
|
||||
|
||||
${{ runner.temp }}/qqq-public-lifecycle/*.png
|
||||
|
||||
${{ runner.temp }}/qqq-quickstart-diagnostic/*.json
|
||||
|
||||
${{ runner.temp }}/qqq-quickstart-diagnostic/*.log
|
||||
|
||||
'
|
||||
'on':
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
description: Exact public candidate to verify
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
source_sha:
|
||||
description: Full reviewed commit of the immutable quickstart tag
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
boundary_capture:
|
||||
description: Diagnose one macOS15 WebKit lifecycle with private boundary evidence
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
@@ -0,0 +1,38 @@
|
||||
name: GitOps validation
|
||||
'on':
|
||||
workflow_call:
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install verified Kustomize
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tool_dir="$RUNNER_TEMP/qqq-kustomize"
|
||||
mkdir -p "$tool_dir"
|
||||
curl --fail --silent --show-error --location --retry 2 --max-time 60 \
|
||||
https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.7.1/kustomize_v5.7.1_linux_amd64.tar.gz \
|
||||
--output "$tool_dir/kustomize.tar.gz"
|
||||
echo "ea375e7372f9aa029129d4b2d16c66b7750b7f1213c4f66f910d981c895818d8 $tool_dir/kustomize.tar.gz" | sha256sum --check --status
|
||||
tar -xzf "$tool_dir/kustomize.tar.gz" -C "$tool_dir" kustomize
|
||||
echo "$tool_dir" >> "$GITHUB_PATH"
|
||||
- name: Render every Kustomization
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -d '' manifests < <(find . -path './.git' -prune -o -type f \( -name kustomization.yaml -o -name kustomization.yml -o -name Kustomization \) -print0)
|
||||
if (( ${#manifests[@]} == 0 )); then
|
||||
echo 'No Kustomization found' >&2
|
||||
exit 1
|
||||
fi
|
||||
for manifest in "${manifests[@]}"; do
|
||||
directory=$(dirname "$manifest")
|
||||
# Rendered Secrets must never enter logs or uploaded artifacts.
|
||||
kustomize build "$directory" >/dev/null
|
||||
printf 'Validated %s\n' "$directory"
|
||||
done
|
||||
@@ -0,0 +1,109 @@
|
||||
name: IntelliJ plugin
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
publish:
|
||||
type: boolean
|
||||
default: false
|
||||
version:
|
||||
type: string
|
||||
default: ''
|
||||
secrets:
|
||||
CERTIFICATE_CHAIN:
|
||||
required: false
|
||||
PRIVATE_KEY:
|
||||
required: false
|
||||
PRIVATE_KEY_PASSWORD:
|
||||
required: false
|
||||
PUBLISH_TOKEN:
|
||||
required: false
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: intellij-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'build.gradle.kts', 'settings.gradle.kts', 'gradle.properties') }}
|
||||
- name: Check and package resource plugin
|
||||
run: ./gradlew --no-daemon check buildPlugin
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: intellij-plugin-${{ github.sha }}
|
||||
path: build/distributions/*.zip
|
||||
if-no-files-found: error
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: intellij-gradle-reports
|
||||
path: build/reports/
|
||||
if-no-files-found: warn
|
||||
publish:
|
||||
needs: build
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.publish
|
||||
runs-on: ubuntu-latest
|
||||
environment: intellij-marketplace
|
||||
concurrency:
|
||||
group: intellij-marketplace-${{ github.repository }}
|
||||
cancel-in-progress: false
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '17'
|
||||
- name: Verify exact reviewed version and tag
|
||||
env:
|
||||
RELEASE_VERSION: ${{ inputs.version }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - <<'PY'
|
||||
import os, re
|
||||
from pathlib import Path
|
||||
version = os.environ['RELEASE_VERSION']
|
||||
if not re.fullmatch(r'[0-9]+\.[0-9]+\.[0-9]+', version):
|
||||
raise SystemExit('Explicit immutable plugin version required')
|
||||
versions = re.findall(r'^version\s*=\s*"([^"\n]+)"\s*$', Path('build.gradle.kts').read_text(), re.M)
|
||||
if versions != [version] or os.environ['GITHUB_REF'] != 'refs/tags/v' + version:
|
||||
raise SystemExit('Source version and selected vVERSION tag must match')
|
||||
PY
|
||||
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
|
||||
test "$(git rev-parse "refs/tags/v$RELEASE_VERSION^{commit}")" = "$GITHUB_SHA"
|
||||
remote="$(git ls-remote origin "refs/tags/v$RELEASE_VERSION" "refs/tags/v$RELEASE_VERSION^{}")"
|
||||
resolved="$(printf '%s\n' "$remote" | awk '$2 ~ /\^\{\}$/ {print $1}')"
|
||||
if [[ -z "$resolved" ]]; then resolved="$(printf '%s\n' "$remote" | awk 'NR==1 {print $1}')"; fi
|
||||
test "$resolved" = "$GITHUB_SHA"
|
||||
- name: Sign and publish verified plugin
|
||||
env:
|
||||
CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }}
|
||||
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
|
||||
PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }}
|
||||
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$CERTIFICATE_CHAIN"
|
||||
test -n "$PRIVATE_KEY"
|
||||
test -n "$PRIVATE_KEY_PASSWORD"
|
||||
test -n "$PUBLISH_TOKEN"
|
||||
./gradlew --no-daemon signPlugin publishPlugin
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: signed-intellij-plugin-${{ inputs.version }}
|
||||
path: build/distributions/*.zip
|
||||
if-no-files-found: error
|
||||
@@ -0,0 +1,77 @@
|
||||
name: Build and Publish
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
jobs:
|
||||
build-and-test:
|
||||
name: Build and Test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Java 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: temurin
|
||||
cache: maven
|
||||
- name: Build, test, and verify
|
||||
env:
|
||||
QQQ_MCP_VOYAGE_API_KEY: ${{ secrets.QQQ_MCP_VOYAGE_API_KEY }}
|
||||
run: mvn -B -ntp clean verify
|
||||
- name: Upload JAR
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: jar
|
||||
path: target/qqq-mcp-rag-*.jar
|
||||
retention-days: 1
|
||||
- name: Preserve unit and integration test evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: test-reports
|
||||
path: 'target/surefire-reports/
|
||||
|
||||
target/failsafe-reports/'
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
publish:
|
||||
name: Publish Container
|
||||
needs: build-and-test
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Download JAR
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: jar
|
||||
path: target/
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Set image name
|
||||
run: printf 'IMAGE_NAME=%s\n' "${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
|
||||
|
||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
'
|
||||
'on':
|
||||
workflow_call:
|
||||
secrets:
|
||||
QQQ_MCP_VOYAGE_API_KEY:
|
||||
required: false
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -0,0 +1,278 @@
|
||||
# Orb-owned native worker extracted from frontend-next ada9946eea643eed6e2c6edb42e2446a185761b4.
|
||||
name: Real-backend acceptance
|
||||
|
||||
# One production build feeds independent, serial-worker backends. Require "acceptance gate".
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
qqq_ref:
|
||||
type: string
|
||||
default: ""
|
||||
description: QQQ source ref; empty preserves the repository variable/default.
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: acceptance-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
QQQ_REF: ${{ inputs.qqq_ref || vars.QQQ_ACCEPTANCE_REF || 'develop' }}
|
||||
NEXT_TELEMETRY_DISABLED: '1'
|
||||
MAVEN_ARGS: -Dmaven.wagon.http.retryHandler.count=5 -Daether.transport.http.retryHandler.count=5 -Daether.connector.http.retryHandler.count=5
|
||||
|
||||
jobs:
|
||||
plan:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
mode: ${{ steps.select.outputs.mode }}
|
||||
matrix: ${{ steps.select.outputs.matrix }}
|
||||
specs: ${{ steps.select.outputs.specs }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Select projects, shards and changed areas
|
||||
id: select
|
||||
run: node scripts/acceptance-select.mjs
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
repository: QRun-IO/qqq
|
||||
ref: ${{ env.QQQ_REF }}
|
||||
path: qqq-backend
|
||||
- name: Resolve QQQ source revision
|
||||
id: qqq
|
||||
run: echo "sha=$(git -C qqq-backend rev-parse HEAD)" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
id: qqq-cache
|
||||
with:
|
||||
path: ~/.m2/repository/com/kingsrook
|
||||
key: qqq-source-${{ runner.os }}-java21-v1-${{ steps.qqq.outputs.sha }}
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: Bundled UI API document matches the server's (src/lib/api/openapi/qqq-v1.json)
|
||||
run: node scripts/check-ui-api-spec.mjs --server-spec qqq-backend/qqq-middleware-javalin/src/main/resources/openapi/v1/openapi.yaml
|
||||
- name: Build QQQ from source
|
||||
if: steps.qqq-cache.outputs.cache-hit != 'true'
|
||||
run: bash scripts/ci/retry.sh 4 mvn -B -q -f qqq-backend/pom.xml install -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
|
||||
- name: Build and install the dashboard jar (static export)
|
||||
run: |
|
||||
# Equivalent to build:jar, with retries around its Maven invocation too.
|
||||
pnpm build:export
|
||||
bash scripts/ci/retry.sh 4 mvn -B -q clean package
|
||||
bash scripts/ci/retry.sh 4 mvn -B -q install
|
||||
# Failed-attempt Maven stdout must not become part of the version value.
|
||||
bash scripts/ci/retry.sh 4 mvn -B -q help:evaluate -Dexpression=project.version -Doutput="$RUNNER_TEMP/acceptance-next-version"
|
||||
next_version=$(cat "$RUNNER_TEMP/acceptance-next-version")
|
||||
echo "NEXT_JAR_VERSION=$next_version" >> "$GITHUB_ENV"
|
||||
- name: Build the sample application jar
|
||||
working-directory: qqq-backend
|
||||
run: |
|
||||
# QQQ checkstyle/pmd paths are relative to this checkout.
|
||||
bash "$GITHUB_WORKSPACE/scripts/ci/retry.sh" 4 mvn -B -q -f qqq-sample-project/pom.xml package -DskipTests -Djacoco.skip=true \
|
||||
-Dqqq.frontend.next.version="$NEXT_JAR_VERSION"
|
||||
- name: Stage runtime artifacts
|
||||
run: |
|
||||
sample_jars=(qqq-backend/qqq-sample-project/target/*-jar-with-dependencies.jar)
|
||||
test "${#sample_jars[@]}" -eq 1
|
||||
sample_version="${sample_jars[0]##*/}"
|
||||
sample_version="${sample_version#qqq-sample-project-}"
|
||||
sample_version="${sample_version%-jar-with-dependencies.jar}"
|
||||
mkdir -p test-results/acceptance-jars
|
||||
cp "${sample_jars[0]}" test-results/acceptance-jars/
|
||||
# javac and the security fixture need the API JAR in addition to the fat sample JAR.
|
||||
cp "$HOME/.m2/repository/com/kingsrook/qqq/qqq-middleware-api/$sample_version/qqq-middleware-api-$sample_version.jar" \
|
||||
test-results/acceptance-jars/qqq-middleware-api.jar
|
||||
tar -cf test-results/acceptance-build.tar out test-results/acceptance-jars
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: acceptance-build
|
||||
path: test-results/acceptance-build.tar
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
shards:
|
||||
name: acceptance ${{ matrix.project }} ${{ matrix.shard }}/${{ matrix.total }}
|
||||
needs: [plan, build]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 40
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- name: Installed Playwright version
|
||||
id: playwright
|
||||
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
id: browser-cache
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-${{ matrix.browser }}
|
||||
- run: pnpm exec playwright install-deps ${{ matrix.browser }}
|
||||
- if: steps.browser-cache.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install ${{ matrix.browser }}
|
||||
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: acceptance-build
|
||||
path: test-results
|
||||
- name: Restore runtime artifacts
|
||||
run: |
|
||||
tar -xf test-results/acceptance-build.tar
|
||||
echo "QQQ_SAMPLE_JAR=$(ls "$PWD"/test-results/acceptance-jars/*-jar-with-dependencies.jar)" >> "$GITHUB_ENV"
|
||||
echo "QQQ_MIDDLEWARE_API_JAR=$PWD/test-results/acceptance-jars/qqq-middleware-api.jar" >> "$GITHUB_ENV"
|
||||
- name: Run shard
|
||||
env:
|
||||
QQQ_ACCEPTANCE_BROWSERS: ${{ matrix.project }}
|
||||
QQQ_ACCEPTANCE_SPEC_PATHS: ${{ needs.plan.outputs.specs }}
|
||||
QQQ_ACCEPTANCE_BLOB: '1'
|
||||
# Environment-selected projects must not produce colliding default blob names.
|
||||
QQQ_ACCEPTANCE_BLOB_NAME: report-${{ matrix.project }}-${{ matrix.shard }}.zip
|
||||
QQQ_ACCEPTANCE_TRANSPORT_TRACE: '1'
|
||||
QQQ_ACCEPTANCE_BROWSER_TRACE: ${{ (matrix.project == 'webkit' || matrix.project == 'mobile' || matrix.project == 'tablet') && 'navigation' || '0' }}
|
||||
DEBUG: pw:browser
|
||||
run: node scripts/acceptance.mjs --skip-build --shard=${{ matrix.shard }}/${{ matrix.total }}
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
if: always()
|
||||
with:
|
||||
name: acceptance-blob-${{ matrix.project }}-${{ matrix.shard }}
|
||||
path: test-results/acceptance/blob-report/
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
gate:
|
||||
name: acceptance gate
|
||||
if: always()
|
||||
needs: [plan, build, shards]
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
pattern: acceptance-blob-*
|
||||
path: test-results/acceptance/blobs
|
||||
merge-multiple: true
|
||||
- name: Merge shard reports
|
||||
env:
|
||||
PLAYWRIGHT_JSON_OUTPUT_NAME: test-results/acceptance/report.json
|
||||
PLAYWRIGHT_HTML_OUTPUT_DIR: test-results/acceptance/html
|
||||
PLAYWRIGHT_HTML_OPEN: never
|
||||
run: npx playwright merge-reports --reporter=json,html test-results/acceptance/blobs
|
||||
- name: Evaluate acceptance matrix
|
||||
if: always()
|
||||
env:
|
||||
ACCEPTANCE_MODE: ${{ needs.plan.outputs.mode }}
|
||||
run: |
|
||||
args=()
|
||||
if [[ "$ACCEPTANCE_MODE" == pr ]]; then args+=(--partial); fi
|
||||
node scripts/acceptance-gate.mjs "${args[@]}"
|
||||
- name: Require every planned shard and successful build
|
||||
if: always()
|
||||
env:
|
||||
PLAN_RESULT: ${{ needs.plan.result }}
|
||||
BUILD_RESULT: ${{ needs.build.result }}
|
||||
SHARDS_RESULT: ${{ needs.shards.result }}
|
||||
PLANNED_MATRIX: ${{ needs.plan.outputs.matrix }}
|
||||
run: |
|
||||
test "$PLAN_RESULT" = success
|
||||
test "$BUILD_RESULT" = success
|
||||
test "$SHARDS_RESULT" = success
|
||||
node --input-type=module -e 'import { existsSync } from "node:fs"; for (const { project, shard } of JSON.parse(process.env.PLANNED_MATRIX).include) { const file = "test-results/acceptance/blobs/report-" + project + "-" + shard + ".zip"; if (!existsSync(file)) throw new Error("Missing shard report: " + file); }'
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
if: always()
|
||||
with:
|
||||
name: acceptance
|
||||
path: test-results/acceptance/
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
quarantine:
|
||||
name: acceptance quarantine (chromium)
|
||||
needs: [plan, build]
|
||||
if: needs.plan.outputs.mode == 'full'
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- name: Installed Playwright version
|
||||
id: playwright
|
||||
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
id: browser-cache
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-chromium
|
||||
- run: pnpm exec playwright install-deps chromium
|
||||
- if: steps.browser-cache.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install chromium
|
||||
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: acceptance-build
|
||||
path: test-results
|
||||
- name: Restore runtime artifacts
|
||||
run: |
|
||||
tar -xf test-results/acceptance-build.tar
|
||||
echo "QQQ_SAMPLE_JAR=$(ls "$PWD"/test-results/acceptance-jars/*-jar-with-dependencies.jar)" >> "$GITHUB_ENV"
|
||||
echo "QQQ_MIDDLEWARE_API_JAR=$PWD/test-results/acceptance-jars/qqq-middleware-api.jar" >> "$GITHUB_ENV"
|
||||
- name: Run quarantined scenarios
|
||||
env:
|
||||
QQQ_ACCEPTANCE_BROWSERS: chromium
|
||||
QQQ_ACCEPTANCE_QUARANTINE: only
|
||||
QQQ_ACCEPTANCE_TRANSPORT_TRACE: '1'
|
||||
QQQ_ACCEPTANCE_BROWSER_TRACE: '0'
|
||||
DEBUG: pw:browser
|
||||
run: node scripts/acceptance.mjs --skip-build
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
if: always()
|
||||
with:
|
||||
name: acceptance-quarantine
|
||||
path: test-results/acceptance/
|
||||
retention-days: 30
|
||||
@@ -0,0 +1,157 @@
|
||||
# Orb-owned native worker extracted from frontend-next ada9946eea643eed6e2c6edb42e2446a185761b4.
|
||||
name: CI
|
||||
|
||||
# Fast PR checks (QRun-IO/qqq#709, bundle budget #710). The real-backend gate, including the
|
||||
# runtime performance budgets (specs/performance), runs in acceptance.yml.
|
||||
# Each job installs on its own so they run in parallel; none needs a backend.
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: ci-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
NEXT_TELEMETRY_DISABLED: '1'
|
||||
STORYBOOK_DISABLE_TELEMETRY: '1'
|
||||
|
||||
jobs:
|
||||
unit:
|
||||
name: Typecheck, lint, unit tests and coverage
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
- run: pnpm typecheck
|
||||
- run: pnpm lint
|
||||
- name: Unit tests with src/lib coverage thresholds (vitest.config.ts)
|
||||
run: pnpm test:coverage
|
||||
|
||||
e2e:
|
||||
name: Mocked e2e (Playwright, chromium)
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
- name: Installed Playwright version
|
||||
id: playwright
|
||||
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
id: browser-cache
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-chromium
|
||||
- run: pnpm exec playwright install-deps chromium
|
||||
- if: steps.browser-cache.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install chromium
|
||||
- name: Production build
|
||||
run: pnpm build
|
||||
- name: Mocked e2e suite
|
||||
env:
|
||||
QQQ_E2E_SERVER: production
|
||||
run: pnpm test:e2e
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
if: failure()
|
||||
with:
|
||||
name: e2e-report
|
||||
path: |
|
||||
playwright-report/
|
||||
test-results/
|
||||
retention-days: 14
|
||||
|
||||
collaboration-e2e:
|
||||
name: Collaboration e2e (MSW; chromium, firefox, webkit, mobile, tablet)
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
- name: Installed Playwright version
|
||||
id: playwright
|
||||
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
|
||||
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
||||
id: browser-cache
|
||||
with:
|
||||
path: ~/.cache/ms-playwright
|
||||
key: playwright-${{ runner.os }}-${{ steps.playwright.outputs.version }}-all
|
||||
- run: pnpm exec playwright install-deps chromium firefox webkit
|
||||
- if: steps.browser-cache.outputs.cache-hit != 'true'
|
||||
run: pnpm exec playwright install chromium firefox webkit
|
||||
- name: Collaboration suite (mock API, every browser project)
|
||||
run: pnpm exec playwright test --config playwright.collaboration.config.ts
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
if: always()
|
||||
with:
|
||||
name: collaboration-e2e
|
||||
path: |
|
||||
test-results/collaboration/
|
||||
test-results/collab-shots/
|
||||
retention-days: 14
|
||||
|
||||
storybook:
|
||||
name: Storybook build
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
- run: pnpm build-storybook --quiet
|
||||
|
||||
performance:
|
||||
name: Bundle budget (static export)
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- run: corepack enable
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: pnpm
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
- name: Static export
|
||||
run: pnpm build:export
|
||||
- name: First-load JS per route, total JS and largest chunk against perf-budget.json
|
||||
run: pnpm perf:budget
|
||||
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
if: always()
|
||||
with:
|
||||
name: bundle-budget
|
||||
path: test-results/performance/bundle.json
|
||||
retention-days: 30
|
||||
@@ -0,0 +1,74 @@
|
||||
# Orb-owned native worker extracted from frontend-next ada9946eea643eed6e2c6edb42e2446a185761b4.
|
||||
name: Dashboard image
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
IMAGE: ghcr.io/qrun-io/qqq-frontend-next
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- arch: amd64
|
||||
runner: ubuntu-24.04
|
||||
- arch: arm64
|
||||
runner: ubuntu-24.04-arm
|
||||
runs-on: ${{ matrix.runner }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
|
||||
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
|
||||
if: github.event_name == 'push'
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7
|
||||
with:
|
||||
context: .
|
||||
file: docker/quickstart/Dockerfile
|
||||
platforms: linux/${{ matrix.arch }}
|
||||
push: ${{ github.event_name == 'push' }}
|
||||
load: ${{ github.event_name == 'pull_request' }}
|
||||
tags: ${{ env.IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
|
||||
cache-from: type=gha,scope=dashboard-${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=dashboard-${{ matrix.arch }}
|
||||
- name: Verify runnable dashboard
|
||||
if: github.event_name == 'pull_request'
|
||||
env:
|
||||
TAG: ${{ env.IMAGE }}:${{ github.sha }}-${{ matrix.arch }}
|
||||
run: |
|
||||
container=$(docker run -d --rm -p 127.0.0.1:3000:3000 "$TAG")
|
||||
trap 'docker rm -f "$container"' EXIT
|
||||
curl -fsS --max-time 3 --retry 30 --retry-delay 1 --retry-all-errors \
|
||||
--retry-max-time 90 http://127.0.0.1:3000/app/person >/dev/null \
|
||||
|| { docker logs "$container"; exit 1; }
|
||||
|
||||
publish:
|
||||
if: github.event_name == 'push'
|
||||
needs: build
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
packages: write
|
||||
steps:
|
||||
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4
|
||||
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Publish versioned multi-architecture image
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag "$IMAGE:${GITHUB_REF_NAME#v}" \
|
||||
"$IMAGE:$GITHUB_SHA-amd64" "$IMAGE:$GITHUB_SHA-arm64"
|
||||
@@ -0,0 +1,590 @@
|
||||
# Cut briefly, then finalize from the Circle publisher completion callback.
|
||||
# The pending ref bridges runs without an allocated waiting runner. See docs/rc-release.md.
|
||||
#
|
||||
# Signing: the tag is signed with the SSH key in the QRUN_TAG_SIGNING_KEY secret (callers pass
|
||||
# `secrets: inherit`). Without it the job fails before tagging; it never creates an unsigned tag.
|
||||
#
|
||||
# Release line: develop's <revision>X.Y.Z-SNAPSHOT</revision> picks release/X.Y.Z if that branch
|
||||
# exists, else release/X.Y (created from develop when missing).
|
||||
name: qbit release candidate
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
dry_run:
|
||||
description: Print the plan without merging or creating branches
|
||||
type: boolean
|
||||
default: false
|
||||
finalize:
|
||||
description: Finalize an existing cut from repository_dispatch or an explicit retry
|
||||
type: boolean
|
||||
default: false
|
||||
recover:
|
||||
description: Verify an already-published upload after a Circle deployment timeout
|
||||
type: boolean
|
||||
default: false
|
||||
circle_build:
|
||||
description: Original Circle publisher build number (recovery only)
|
||||
type: string
|
||||
default: ''
|
||||
merge_sha:
|
||||
type: string
|
||||
default: ''
|
||||
bump_sha:
|
||||
type: string
|
||||
default: ''
|
||||
branch:
|
||||
type: string
|
||||
default: ''
|
||||
version:
|
||||
type: string
|
||||
default: ''
|
||||
secrets:
|
||||
CENTRAL_USERNAME:
|
||||
required: false
|
||||
CENTRAL_PASSWORD:
|
||||
required: false
|
||||
QRUN_TAG_SIGNING_KEY:
|
||||
description: SSH private key that signs release tags
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
checks: read
|
||||
|
||||
# Hold the release lane across BOTH jobs, not just each independent merge/tag job.
|
||||
concurrency:
|
||||
group: qbit-release-rc-${{ github.repository }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
cut-rc:
|
||||
if: ${{ !inputs.finalize && !inputs.recover }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
outputs:
|
||||
branch: ${{ steps.merge.outputs.branch }}
|
||||
merge_sha: ${{ steps.merge.outputs.merge_sha }}
|
||||
merged_at: ${{ steps.merge.outputs.merged_at }}
|
||||
steps:
|
||||
- name: Merge develop into the release line
|
||||
id: merge
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
DRY_RUN: ${{ inputs.dry_run }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# An unresolved release owns this ref until verified finalization or explicit recovery.
|
||||
lock=automation/qbit-rc-pending
|
||||
if gh api "repos/$REPO/git/ref/heads/$lock" --silent 2>/dev/null; then
|
||||
echo "::error::An RC is unresolved ($lock); finalize or explicitly recover it before cutting another."
|
||||
exit 1
|
||||
fi
|
||||
develop_sha=$(gh api "repos/$REPO/branches/develop" -q .commit.sha)
|
||||
revision=$(gh api "repos/$REPO/contents/pom.xml?ref=$develop_sha" -q .content | base64 -d \
|
||||
| sed -n 's:.*<revision>\(.*\)</revision>.*:\1:p' | head -n 1)
|
||||
if [[ ! "$revision" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-SNAPSHOT$ ]]; then
|
||||
echo "::error::develop pom.xml <revision> must be X.Y.Z-SNAPSHOT, found '$revision'"
|
||||
exit 1
|
||||
fi
|
||||
full="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
|
||||
line="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
|
||||
branch_exists() { gh api "repos/$REPO/branches/$1" --silent 2>/dev/null; }
|
||||
if branch_exists "release/$full"; then branch="release/$full"
|
||||
elif branch_exists "release/$line"; then branch="release/$line"
|
||||
else branch=""; fi
|
||||
|
||||
if [[ "$DRY_RUN" != true ]]; then
|
||||
# POST is atomic: a concurrent creator gets 422 and cannot steal the lock.
|
||||
gh api "repos/$REPO/git/refs" -f ref="refs/heads/$lock" -f sha="$develop_sha" --silent
|
||||
fi
|
||||
if [[ -z "$branch" ]]; then
|
||||
branch="release/$line"
|
||||
echo "Plan: create $branch from develop $develop_sha (first RC of $full)"
|
||||
[[ "$DRY_RUN" == true ]] && exit 0
|
||||
gh api "repos/$REPO/git/refs" -f ref="refs/heads/$branch" -f sha="$develop_sha" --silent
|
||||
merge_sha="$develop_sha"
|
||||
else
|
||||
echo "Plan: merge develop $develop_sha into $branch"
|
||||
[[ "$DRY_RUN" == true ]] && exit 0
|
||||
# 201 merged, 204 already up to date (nothing new to release), 409 conflict.
|
||||
response=$(gh api --include "repos/$REPO/merges" -f base="$branch" -f head="$develop_sha" \
|
||||
-f commit_message="Merge develop into $branch for the next $full RC" 2>&1) || true
|
||||
status=$(printf '%s\n' "$response" | sed -n 's:^HTTP/[0-9.]* \([0-9][0-9]*\).*:\1:p' | head -n 1)
|
||||
case "$status" in
|
||||
201) merge_sha=$(printf '%s\n' "$response" | sed '1,/^\r\{0,1\}$/d' | jq -er .sha) ;;
|
||||
204)
|
||||
[[ "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" == "$develop_sha" ]]
|
||||
gh api -X DELETE "repos/$REPO/git/refs/heads/$lock"
|
||||
echo "::warning::$branch already contains develop; no new RC"; exit 0 ;;
|
||||
409) echo "::error::Merge conflict between develop and $branch; resolve it in a PR into $branch"; exit 1 ;;
|
||||
*) echo "::error::Merge of develop into $branch failed (HTTP ${status:-unknown})"; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
[[ "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" == "$develop_sha" ]]
|
||||
gh api -X PATCH "repos/$REPO/git/refs/heads/$lock" -f sha="$merge_sha" -F force=false --silent
|
||||
merged_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
jq -n --arg repo "$REPO" --arg branch "$branch" --arg merge_sha "$merge_sha" \
|
||||
--arg merged_at "$merged_at" --arg run_id "$GITHUB_RUN_ID" --arg attempt "$GITHUB_RUN_ATTEMPT" \
|
||||
'{repo:$repo,branch:$branch,merge_sha:$merge_sha,merged_at:$merged_at,run_id:$run_id,attempt:$attempt}' \
|
||||
> "$RUNNER_TEMP/rc-intent.json"
|
||||
{
|
||||
echo "branch=$branch"
|
||||
echo "merge_sha=$merge_sha"
|
||||
echo "merged_at=$merged_at"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
echo "Pushed $branch; CircleCI publish_release_candidate cuts the RC." >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "Release line: $branch. Waiting without a runner for qbit-rc-published." >> "$GITHUB_STEP_SUMMARY"
|
||||
- name: Persist trusted release intent
|
||||
if: steps.merge.outputs.merge_sha != ''
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qbit-rc-intent-${{ steps.merge.outputs.merge_sha }}
|
||||
path: ${{ runner.temp }}/rc-intent.json
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
|
||||
tag-and-release:
|
||||
if: inputs.finalize || inputs.recover
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- name: Verify completion against trusted intent, then tag and release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
BRANCH: ${{ inputs.branch }}
|
||||
MERGE_SHA: ${{ inputs.merge_sha }}
|
||||
BUMP_SHA: ${{ inputs.bump_sha }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
DRY_RUN: ${{ inputs.dry_run }}
|
||||
RECOVER: ${{ inputs.recover }}
|
||||
CIRCLE_BUILD: ${{ inputs.circle_build }}
|
||||
RECOVERY_EVENT: ${{ github.event_name }}
|
||||
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
|
||||
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
|
||||
SIGNING_KEY: ${{ secrets.QRUN_TAG_SIGNING_KEY }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ -z "$SIGNING_KEY" ]]; then
|
||||
echo "::error::QRUN_TAG_SIGNING_KEY is not available (the caller needs 'secrets: inherit'); not creating an unsigned tag. The release captain tags this RC."
|
||||
exit 1
|
||||
fi
|
||||
workdir=$(mktemp -d)
|
||||
trap 'rm -rf "$workdir"' EXIT
|
||||
# BEGIN RC REF LOOKUP
|
||||
read_ref() {
|
||||
local body sha
|
||||
if body=$(gh api "repos/$REPO/git/ref/$1" 2>"$workdir/ref-error"); then
|
||||
sha=$(jq -er '.object.sha' <<< "$body") || return 1
|
||||
[[ "$sha" =~ ^[0-9a-f]{40}$ ]] || return 1
|
||||
printf '%s\n' "$sha"
|
||||
elif jq -se 'length == 1 and .[0].status == "404"' >/dev/null 2>&1 <<< "$body"; then
|
||||
# gh prints HTTP error JSON on stdout even when --jq was requested.
|
||||
return 0
|
||||
else
|
||||
cat "$workdir/ref-error" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
# END RC REF LOOKUP
|
||||
# The evaluator is inline so a pinned reusable workflow cannot fetch mutable code.
|
||||
cat > "$workdir/rc_guard.py" <<'PY'
|
||||
# BEGIN RC GUARD
|
||||
import re
|
||||
|
||||
class ReleaseFailure(ValueError):
|
||||
pass
|
||||
|
||||
def evaluate(merge_sha, status, commit, recovered_version=""):
|
||||
if status.get("sha") != merge_sha:
|
||||
raise ReleaseFailure("Status response does not identify the exact release merge")
|
||||
# Circle's workflow Check Run is stable even when job statuses receive -1/-2 suffixes.
|
||||
publishers = [x for x in status.get("check_runs", [])
|
||||
if x.get("name") == "publish_release_candidate" and x.get("app", {}).get("id") == 18001]
|
||||
if not publishers:
|
||||
return ""
|
||||
publisher = max(publishers, key=lambda x: x["id"])
|
||||
if publisher.get("head_sha") != merge_sha:
|
||||
raise ReleaseFailure("Publisher Check Run identifies a different source")
|
||||
if publisher.get("status") != "completed":
|
||||
return ""
|
||||
if publisher.get("conclusion") != "success" and not recovered_version:
|
||||
raise ReleaseFailure("CircleCI failed for release merge: " + str(publisher.get("conclusion")))
|
||||
message = commit.get("commit", {}).get("message", "").split("\n")[0]
|
||||
match = re.fullmatch(r"Bump version to (\d+\.\d+\.\d+-RC\.\d+) \[skip ci\]", message)
|
||||
if not match:
|
||||
return ""
|
||||
if [x.get("sha") for x in commit.get("parents", [])] != [merge_sha]:
|
||||
raise ReleaseFailure("RC bump is not the direct child of the published merge")
|
||||
if recovered_version and recovered_version != match.group(1):
|
||||
raise ReleaseFailure("Recovery receipt and bump version differ")
|
||||
return match.group(1)
|
||||
|
||||
def validate_intent(run, intent, repo, merge, branch, run_id):
|
||||
if run.get("conclusion") != "success" or run.get("status") != "completed":
|
||||
raise ReleaseFailure("Cut run has not succeeded")
|
||||
if run.get("event") not in ("workflow_dispatch", "pull_request") or run.get("path") != ".github/workflows/release-rc.yml":
|
||||
raise ReleaseFailure("Untrusted cut workflow or trigger")
|
||||
if run.get("repository", {}).get("full_name") != repo or run.get("head_repository", {}).get("full_name") != repo:
|
||||
raise ReleaseFailure("Wrong cut repository")
|
||||
actual = tuple(intent.get(x) for x in ("repo", "merge_sha", "branch", "run_id"))
|
||||
if actual != (repo, merge, branch, run_id) or str(run.get("id")) != run_id:
|
||||
raise ReleaseFailure("Intent mismatch")
|
||||
if str(run.get("run_attempt")) != intent.get("attempt"):
|
||||
raise ReleaseFailure("Intent from an older attempt")
|
||||
|
||||
def tag_action(existing_target, bump, release_exists, lock):
|
||||
if existing_target and existing_target != bump:
|
||||
raise ReleaseFailure("Existing tag points at a different source")
|
||||
if existing_target and release_exists:
|
||||
return "complete"
|
||||
if not lock:
|
||||
raise ReleaseFailure("No matching pending intent lock")
|
||||
return "release" if existing_target else "tag"
|
||||
|
||||
def validate_lock(current, expected, completed=False):
|
||||
if current != expected and not (completed and not current):
|
||||
raise ReleaseFailure("Different release owns pending lock, or lock missing")
|
||||
|
||||
def validate_central(version, artifact, xml, modified, merged):
|
||||
import xml.etree.ElementTree as ET
|
||||
from email.utils import parsedate_to_datetime
|
||||
from datetime import datetime
|
||||
root = ET.fromstring(xml)
|
||||
ns = {"m": "http://maven.apache.org/POM/4.0.0"}
|
||||
if root.findtext("m:artifactId", namespaces=ns) != artifact or root.findtext("m:version", namespaces=ns) != version:
|
||||
raise ReleaseFailure("Central POM does not match the expected artifact/version")
|
||||
if parsedate_to_datetime(modified).timestamp() <= datetime.fromisoformat(merged.replace("Z", "+00:00")).timestamp():
|
||||
raise ReleaseFailure("Central artifact predates the exact release merge")
|
||||
def validate_timeout(job, publisher, repo, merge, branch, build, merged_at):
|
||||
from datetime import datetime
|
||||
if (job.get('username') + '/' + job.get('reponame'), job.get('vcs_revision'),
|
||||
job.get('branch'), str(job.get('build_num'))) != (repo, merge, branch, build):
|
||||
raise ReleaseFailure('Timeout job does not identify the exact cut')
|
||||
workflow = job.get('workflows', {})
|
||||
if workflow.get('workflow_name') != 'publish_release_candidate' or workflow.get('job_name') != 'qqq-orb/mvn_publish':
|
||||
raise ReleaseFailure('Unexpected Circle publication workflow/job')
|
||||
if (publisher.get('head_sha') != merge or publisher.get('app', {}).get('id') != 18001
|
||||
or publisher.get('name') != 'publish_release_candidate'
|
||||
or publisher.get('status') != 'completed' or publisher.get('conclusion') != 'failure'):
|
||||
raise ReleaseFailure('Recovery requires the failed exact Circle publisher')
|
||||
from urllib.parse import urlsplit
|
||||
link = urlsplit(publisher.get('details_url', ''))
|
||||
if link.scheme != 'https' or link.netloc != 'app.circleci.com' or link.path != '/workflow/' + workflow.get('workflow_id', ''):
|
||||
raise ReleaseFailure('Circle check does not identify the timeout workflow')
|
||||
if job.get('status') != 'failed' or job.get('outcome') != 'failed':
|
||||
raise ReleaseFailure('Recovery requires a terminal failed job')
|
||||
actions = [action for step in job.get('steps', []) for action in step.get('actions', [])]
|
||||
if not actions or actions[-1].get('name') != 'Publish to Sonatype Central (releases and SNAPSHOTs)':
|
||||
raise ReleaseFailure('Deployment must be the last executed action')
|
||||
deploy = actions[-1]
|
||||
if deploy.get('status') != 'timedout' or deploy.get('timedout') is not True:
|
||||
raise ReleaseFailure('Only a deployment timeout can be recovered')
|
||||
if any(action.get('status') != 'success' for action in actions[:-1]):
|
||||
raise ReleaseFailure('Every pre-publication action must have passed')
|
||||
if not any(action.get('name') == 'Run Maven Verify' for action in actions[:-1]):
|
||||
raise ReleaseFailure('Successful Maven verification is missing')
|
||||
if datetime.fromisoformat(job['start_time'].replace('Z', '+00:00')) < datetime.fromisoformat(merged_at.replace('Z', '+00:00')):
|
||||
raise ReleaseFailure('Publisher predates the trusted cut')
|
||||
if any(type(deploy.get(key)) is not int or deploy[key] < 0 for key in ('step', 'index')):
|
||||
raise ReleaseFailure('Invalid deployment log coordinates')
|
||||
return deploy['step'], deploy['index']
|
||||
|
||||
|
||||
def upload_receipt(log, artifact, version):
|
||||
# Only the successful-upload receipt and actual Central staging paths count.
|
||||
deployments = re.findall(r'Uploaded bundle successfully,[^\n]*deploymentId: ([0-9a-f-]{36})\.', log)
|
||||
if len(deployments) != 1 or not re.fullmatch(r'[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}', deployments[0]):
|
||||
raise ReleaseFailure('Expected exactly one successful Central upload receipt')
|
||||
paths = re.findall(r'/target/central-staging/(com/kingsrook/qbits)/(qbit-[a-z0-9-]+)/(\d+\.\d+\.\d+-RC\.\d+)/', log)
|
||||
coordinates = {(group.replace('/', '.'), name, revision) for group, name, revision in paths}
|
||||
if not coordinates or ('com.kingsrook.qbits', artifact, version) not in coordinates:
|
||||
raise ReleaseFailure('Receipt does not include the expected root artifact')
|
||||
if any(revision != version for _, _, revision in coordinates):
|
||||
raise ReleaseFailure('Mixed candidate versions in the uploaded bundle')
|
||||
return deployments[0], sorted('pkg:maven/' + group + '/' + name + '@' + revision for group, name, revision in coordinates)
|
||||
|
||||
|
||||
def validate_deployment(deployment, deployment_id, purls):
|
||||
if deployment.get('deploymentId') != deployment_id or deployment.get('deploymentState') != 'PUBLISHED':
|
||||
raise ReleaseFailure('The original Central deployment is not PUBLISHED')
|
||||
if sorted(deployment.get('purls', [])) != purls:
|
||||
raise ReleaseFailure('Central deployment coordinates differ from the original upload')
|
||||
|
||||
|
||||
def validate_recovery_bump(commit, source, actual, version, merge):
|
||||
if [p.get('sha') for p in commit.get('parents', [])] != [merge]:
|
||||
raise ReleaseFailure('Recovery bump must be a direct child of the cut')
|
||||
files = commit.get('files', [])
|
||||
if len(files) != 1 or files[0].get('filename') != 'pom.xml' or files[0].get('status') != 'modified':
|
||||
raise ReleaseFailure('Recovery bump may change only the root POM')
|
||||
revisions = re.findall(r'<revision>([^<]+)</revision>', source)
|
||||
if len(revisions) != 1 or not re.fullmatch(re.escape(version.split('-RC.')[0]) + r'-(SNAPSHOT|RC\.\d+)', revisions[0]):
|
||||
raise ReleaseFailure('Unexpected source POM revision')
|
||||
expected = source.replace('<revision>' + revisions[0] + '</revision>', '<revision>' + version + '</revision>')
|
||||
if actual != expected:
|
||||
raise ReleaseFailure('Recovery bump changed content beyond the verified version')
|
||||
|
||||
def verify_recovery(directory, repo, merge, branch, build, version):
|
||||
import base64, json, os, pathlib, urllib.request, xml.etree.ElementTree as ET
|
||||
if not re.fullmatch(r'QRun-IO/qbit-[a-z0-9-]+', repo) or not re.fullmatch(r'[1-9][0-9]*', build):
|
||||
raise ReleaseFailure('Invalid recovery repository or Circle build')
|
||||
directory = pathlib.Path(directory)
|
||||
status = json.loads((directory / 'status.json').read_text())
|
||||
intent = json.loads((directory / 'intent.json').read_text())
|
||||
publishers = [p for p in status['check_runs'] if p.get('name') == 'publish_release_candidate' and p.get('app', {}).get('id') == 18001]
|
||||
if status.get('sha') != merge or not publishers:
|
||||
raise ReleaseFailure('Exact publisher evidence missing')
|
||||
class NoRedirect(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, *args, **kwargs):
|
||||
raise ReleaseFailure('Unexpected evidence redirect')
|
||||
opener = urllib.request.build_opener(NoRedirect())
|
||||
def request(url, token=None, post=False):
|
||||
headers = {'Accept': 'application/json'}
|
||||
if token:
|
||||
headers['Authorization'] = 'Bearer ' + token
|
||||
req = urllib.request.Request(url, headers=headers, data=b'' if post else None)
|
||||
with opener.open(req, timeout=30) as response:
|
||||
data = response.read(8_000_001)
|
||||
if len(data) > 8_000_000:
|
||||
raise ReleaseFailure('Oversized recovery evidence')
|
||||
return data, response.headers
|
||||
circle = 'https://circleci.com/api/v1.1/project/github/' + repo + '/' + build
|
||||
job = json.loads(request(circle)[0])
|
||||
step, index = validate_timeout(job, max(publishers, key=lambda p: p['id']), repo, merge, branch, build, intent['merged_at'])
|
||||
log = request(circle + '/output/' + str(step) + '/' + str(index) + '?file=true')[0].decode()
|
||||
# file=true can return either a raw log or JSON-encoded output.
|
||||
try:
|
||||
value = json.loads(log)
|
||||
except json.JSONDecodeError:
|
||||
value = log
|
||||
log = value if isinstance(value, str) else ''.join(part['message'] for part in value)
|
||||
token = os.environ.get('GH_TOKEN', '')
|
||||
source = json.loads(request('https://api.github.com/repos/' + repo + '/contents/pom.xml?ref=' + merge, token)[0])
|
||||
source_pom = base64.b64decode(source['content']).decode()
|
||||
pom = ET.fromstring(source_pom)
|
||||
ns = {'m': 'http://maven.apache.org/POM/4.0.0'}
|
||||
artifact = pom.findtext('m:artifactId', namespaces=ns)
|
||||
deployment_id, purls = upload_receipt(log, artifact, version)
|
||||
username, password = os.environ.get('CENTRAL_USERNAME'), os.environ.get('CENTRAL_PASSWORD')
|
||||
if not username or not password:
|
||||
raise ReleaseFailure('Existing Central publisher credentials are required for receipt verification')
|
||||
authorization = base64.b64encode((username + ':' + password).encode()).decode()
|
||||
deployment = json.loads(request('https://central.sonatype.com/api/v1/publisher/status?id=' + deployment_id, authorization, post=True)[0])
|
||||
validate_deployment(deployment, deployment_id, purls)
|
||||
for purl in purls:
|
||||
coordinate, revision = purl.removeprefix('pkg:maven/').split('@')
|
||||
group, name = coordinate.split('/')
|
||||
url = 'https://repo1.maven.org/maven2/' + group.replace('.', '/') + '/' + name + '/' + revision + '/' + name + '-' + revision + '.pom'
|
||||
xml, headers = request(url)
|
||||
validate_central(revision, name, xml, headers.get('Last-Modified', ''), intent['merged_at'])
|
||||
(directory / 'source-pom.xml').write_text(source_pom)
|
||||
# This receipt is written only after all remote evidence has been verified.
|
||||
(directory / 'recovery.json').write_text(json.dumps({'merge_sha': merge, 'version': version,
|
||||
'circle_build': build, 'deployment_id': deployment_id, 'purls': purls}))
|
||||
|
||||
# END RC GUARD
|
||||
if __name__ == "__main__":
|
||||
import json, sys
|
||||
try:
|
||||
if sys.argv[1] == "recover":
|
||||
verify_recovery(*sys.argv[2:])
|
||||
elif sys.argv[1] == "lock":
|
||||
validate_lock(sys.argv[2], sys.argv[3])
|
||||
elif sys.argv[1] == "tag":
|
||||
print(tag_action(sys.argv[2], sys.argv[3], sys.argv[4] == "true", sys.argv[5]))
|
||||
elif sys.argv[1] == "central":
|
||||
validate_central(*sys.argv[2:4], open(sys.argv[4]).read(), *sys.argv[5:7])
|
||||
else:
|
||||
recovered = ""
|
||||
if len(sys.argv) == 5:
|
||||
receipt = json.load(open(sys.argv[4]))
|
||||
if receipt["merge_sha"] != sys.argv[1]:
|
||||
raise ReleaseFailure("Recovery receipt source mismatch")
|
||||
recovered = receipt["version"]
|
||||
import pathlib
|
||||
directory = pathlib.Path(sys.argv[4]).parent
|
||||
validate_recovery_bump(json.load(open(sys.argv[3])), (directory / 'source-pom.xml').read_text(),
|
||||
(directory / 'bump-pom.xml').read_text(), recovered, sys.argv[1])
|
||||
print(evaluate(sys.argv[1], json.load(open(sys.argv[2])), json.load(open(sys.argv[3])), recovered))
|
||||
except (ValueError, KeyError) as error:
|
||||
sys.exit(str(error))
|
||||
PY
|
||||
|
||||
# Dispatch payload is only a hint. Bind it to immutable successful cut-run evidence.
|
||||
[[ "$MERGE_SHA" =~ ^[0-9a-f]{40}$ ]]
|
||||
if [[ "$RECOVER" == true ]]; then
|
||||
[[ "$RECOVERY_EVENT" == workflow_dispatch && "$CIRCLE_BUILD" =~ ^[1-9][0-9]*$ ]]
|
||||
else
|
||||
[[ "$BUMP_SHA" =~ ^[0-9a-f]{40}$ ]]
|
||||
fi
|
||||
[[ "$BRANCH" =~ ^release/[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
|
||||
[[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-RC\.[0-9]+$ ]]
|
||||
artifact_name="qbit-rc-intent-$MERGE_SHA"
|
||||
gh api "repos/$REPO/actions/artifacts?name=$artifact_name&per_page=100" > "$workdir/artifacts.json"
|
||||
count=$(jq --arg name "$artifact_name" '[.artifacts[] | select(.name == $name and .expired == false)] | length' "$workdir/artifacts.json")
|
||||
if [[ "$count" == 0 ]]; then
|
||||
[[ "$(gh api "repos/$REPO/git/ref/heads/automation/qbit-rc-pending" -q .object.sha)" == "$MERGE_SHA" ]]
|
||||
echo "::warning::Cut artifact not visible yet; pending lock retained for central sweep."
|
||||
exit 0
|
||||
fi
|
||||
artifact_id=$(jq -er --arg name "$artifact_name" \
|
||||
'[.artifacts[] | select(.name == $name and .expired == false)] | if length == 1 then .[0].id else error("Expected one unexpired cut intent") end' "$workdir/artifacts.json")
|
||||
cut_run=$(jq -er --argjson id "$artifact_id" '.artifacts[] | select(.id == $id) | .workflow_run.id' "$workdir/artifacts.json")
|
||||
gh api "repos/$REPO/actions/runs/$cut_run" > "$workdir/run.json"
|
||||
if [[ "$(jq -r .status "$workdir/run.json")" != completed ]]; then
|
||||
echo "::warning::Cut run still completing; pending lock retained for central sweep."
|
||||
exit 0
|
||||
fi
|
||||
gh api "repos/$REPO/actions/artifacts/$artifact_id/zip" > "$workdir/intent.zip"
|
||||
python3 - "$workdir" "$REPO" "$MERGE_SHA" "$BRANCH" "$cut_run" <<'PY'
|
||||
import json, pathlib, sys, zipfile
|
||||
directory, repo, merge, branch, run_id = sys.argv[1:]
|
||||
directory = pathlib.Path(directory)
|
||||
run = json.loads((directory / "run.json").read_text())
|
||||
with zipfile.ZipFile(directory / "intent.zip") as archive:
|
||||
info = archive.getinfo("rc-intent.json")
|
||||
assert info.file_size < 10000, "Oversized intent"
|
||||
intent = json.loads(archive.read(info))
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("guard", directory / "rc_guard.py")
|
||||
guard = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(guard)
|
||||
guard.validate_intent(run, intent, repo, merge, branch, run_id)
|
||||
(directory / "intent.json").write_text(json.dumps(intent))
|
||||
PY
|
||||
MERGED_AT=$(jq -er .merged_at "$workdir/intent.json")
|
||||
lock=automation/qbit-rc-pending
|
||||
current_lock=$(read_ref "heads/$lock")
|
||||
# A duplicate after completed finalization is safe only after tag/source checks below.
|
||||
[[ -z "$current_lock" || "$current_lock" == "$MERGE_SHA" ]] || { echo "::error::Different release owns pending lock"; exit 1; }
|
||||
gh api "repos/$REPO/commits/$MERGE_SHA/check-runs?filter=latest&per_page=100" \
|
||||
| jq --arg sha "$MERGE_SHA" '{sha:$sha,check_runs:.check_runs}' > "$workdir/status.json"
|
||||
recovered_args=()
|
||||
if [[ "$RECOVER" == true ]]; then
|
||||
python3 "$workdir/rc_guard.py" lock "$current_lock" "$MERGE_SHA"
|
||||
python3 "$workdir/rc_guard.py" recover "$workdir" "$REPO" "$MERGE_SHA" "$BRANCH" "$CIRCLE_BUILD" "$VERSION"
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
echo "Recovery evidence verified; dry run leaves branch, tag, release and lock unchanged." >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
head=$(gh api "repos/$REPO/branches/$BRANCH" -q .commit.sha)
|
||||
if [[ "$head" == "$MERGE_SHA" ]]; then
|
||||
key="$workdir/recovery_key"
|
||||
install -m 600 /dev/null "$key"
|
||||
printf '%s\n' "$SIGNING_KEY" > "$key"
|
||||
git init -q "$workdir/recovery-repo"
|
||||
git -C "$workdir/recovery-repo" fetch -q --depth=1 "https://x-access-token:$GH_TOKEN@github.com/$REPO.git" "$MERGE_SHA"
|
||||
git -C "$workdir/recovery-repo" checkout -q -b "$BRANCH" FETCH_HEAD
|
||||
python3 - "$workdir/recovery-repo/pom.xml" "$VERSION" <<'PY'
|
||||
import pathlib, re, sys
|
||||
path, version = pathlib.Path(sys.argv[1]), sys.argv[2]
|
||||
source = path.read_text()
|
||||
revisions = re.findall(r'<revision>([^<]+)</revision>', source)
|
||||
assert len(revisions) == 1 and re.fullmatch(re.escape(version.split('-RC.')[0]) + r'-(SNAPSHOT|RC\.\d+)', revisions[0]), 'Unexpected source revision'
|
||||
path.write_text(source.replace('<revision>' + revisions[0] + '</revision>', '<revision>' + version + '</revision>'))
|
||||
PY
|
||||
git -C "$workdir/recovery-repo" add pom.xml
|
||||
git -C "$workdir/recovery-repo" -c user.name="James Maes" -c user.email=james@kof22.com -c gpg.format=ssh -c user.signingkey="$key" commit -q -S -m "Bump version to $VERSION [skip ci]"
|
||||
python3 "$workdir/rc_guard.py" lock "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" "$MERGE_SHA"
|
||||
# A normal fast-forward push refuses a competing release-branch change.
|
||||
git -C "$workdir/recovery-repo" push -q "https://x-access-token:$GH_TOKEN@github.com/$REPO.git" "HEAD:$BRANCH"
|
||||
BUMP_SHA=$(git -C "$workdir/recovery-repo" rev-parse HEAD)
|
||||
rm -f "$key"
|
||||
else
|
||||
BUMP_SHA=$head
|
||||
fi
|
||||
recovered_args=("$workdir/recovery.json")
|
||||
echo "Verified original Central upload after Circle timeout; no artifact was uploaded again." >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
gh api "repos/$REPO/commits/$BUMP_SHA" > "$workdir/commit.json"
|
||||
if [[ "$RECOVER" == true ]]; then
|
||||
gh api "repos/$REPO/contents/pom.xml?ref=$BUMP_SHA" -q .content | base64 -d > "$workdir/bump-pom.xml"
|
||||
fi
|
||||
version=$(python3 "$workdir/rc_guard.py" "$MERGE_SHA" "$workdir/status.json" "$workdir/commit.json" "${recovered_args[@]}")
|
||||
[[ -n "$version" && "$version" == "$VERSION" ]] || { echo "::error::Publisher not successful or callback version mismatch"; exit 1; }
|
||||
bump_sha=$BUMP_SHA
|
||||
[[ "$(gh api "repos/$REPO/branches/$BRANCH" -q .commit.sha)" == "$bump_sha" ]] || { echo "::error::Release branch moved away from exact bump"; exit 1; }
|
||||
# The project's own artifactId: skip the <parent> block (qbit-build-parent).
|
||||
artifact=$(gh api "repos/$REPO/contents/pom.xml?ref=$MERGE_SHA" -q .content | base64 -d \
|
||||
| sed '/<parent>/,/<\/parent>/d' \
|
||||
| sed -n 's:.*<artifactId>\(qbit-[^<]*\)</artifactId>.*:\1:p' | head -n 1)
|
||||
group_path=com/kingsrook/qbits
|
||||
|
||||
# Central visibility may lag deployment. A retry reuses this intent; it never cuts again.
|
||||
# 2. Provenance: the Central artifact must exist and be newer than this merge.
|
||||
pom="https://repo1.maven.org/maven2/$group_path/$artifact/$version/$artifact-$version.pom"
|
||||
if [[ "$(curl -s -o /dev/null -w '%{http_code}' "$pom")" != 200 ]]; then
|
||||
echo "::warning::Central not visible yet; pending intent retained. Retry finalization with the same payload."
|
||||
echo "Central pending for $artifact $version; no tag created and lock retained." >> "$GITHUB_STEP_SUMMARY"
|
||||
exit 0
|
||||
fi
|
||||
last_modified=$(curl -sI "$pom" | tr -d '\r' | sed -n 's/^[Ll]ast-[Mm]odified: //p')
|
||||
if [[ "$(curl -s -o /dev/null -w '%{http_code}' "$pom")" != 200 || -z "$last_modified" ]]; then
|
||||
echo "::error::$artifact $version is not on Maven Central"
|
||||
exit 1
|
||||
fi
|
||||
if (( $(date -d "$last_modified" +%s) <= $(date -d "$MERGED_AT" +%s) )); then
|
||||
echo "::error::$artifact $version on Central ($last_modified) predates this merge ($MERGED_AT); not tagging."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
curl -fsS "$pom" -o "$workdir/central.pom"
|
||||
python3 "$workdir/rc_guard.py" central "$version" "$artifact" "$workdir/central.pom" "$last_modified" "$MERGED_AT"
|
||||
|
||||
# 3. Signed annotated tag on the exact bump; duplicate runs must not accept a different tag.
|
||||
existing=$(read_ref "tags/v$version")
|
||||
target=""; release_exists=false
|
||||
if [[ -n "$existing" ]]; then
|
||||
target=$(gh api "repos/$REPO/git/tags/$existing" --jq '.object.sha')
|
||||
if gh release view "v$version" -R "$REPO" >/dev/null 2>&1; then release_exists=true; fi
|
||||
fi
|
||||
# Ownership was checked above, so tag_action never authorizes a different pending owner.
|
||||
action=$(python3 "$workdir/rc_guard.py" tag "$target" "$bump_sha" "$release_exists" "$current_lock")
|
||||
if [[ "$action" == complete ]]; then
|
||||
if [[ "$current_lock" == "$MERGE_SHA" ]]; then
|
||||
python3 "$workdir/rc_guard.py" lock "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" "$MERGE_SHA"
|
||||
gh api -X DELETE "repos/$REPO/git/refs/heads/$lock"
|
||||
fi
|
||||
echo "Tag and release already exist for the verified source."
|
||||
exit 0
|
||||
fi
|
||||
if [[ "$action" == tag ]]; then
|
||||
key="$workdir/signing_key"
|
||||
install -m 600 /dev/null "$key"
|
||||
printf '%s\n' "$SIGNING_KEY" > "$key"
|
||||
git init -q "$workdir/repo"
|
||||
git -C "$workdir/repo" fetch -q --depth=1 "https://x-access-token:$GH_TOKEN@github.com/$REPO.git" "$bump_sha"
|
||||
git -C "$workdir/repo" -c user.name="James Maes" -c user.email=james@kof22.com -c gpg.format=ssh \
|
||||
-c user.signingkey="$key" tag -s "v$version" "$bump_sha" -m "$artifact $version"
|
||||
rm -f "$key"
|
||||
git -C "$workdir/repo" push -q "https://x-access-token:$GH_TOKEN@github.com/$REPO.git" "v$version"
|
||||
fi
|
||||
|
||||
[[ "$current_lock" == "$MERGE_SHA" ]] || { echo "::error::No matching pending intent lock"; exit 1; }
|
||||
# 4. GitHub prerelease whose notes list the merged PRs since the previous tag.
|
||||
previous=$(gh api "repos/$REPO/tags?per_page=100" -q '.[].name' | grep -E '^v[0-9]' | grep -vx "v$version" | sort -V | tail -n 1 || true)
|
||||
prs=$(gh api "repos/$REPO/compare/${previous:-$MERGE_SHA}...$bump_sha" \
|
||||
-q '.commits[].commit.message | select(startswith("Merge pull request #")) | split("\n") | (.[0] | capture("#(?<n>[0-9]+)").n) + "\t" + (.[2] // "")')
|
||||
notes="$workdir/notes.md"
|
||||
{
|
||||
echo "$artifact **$version** release candidate (Maven Central, $last_modified)."
|
||||
echo
|
||||
echo "## Changes"
|
||||
if [[ -n "$prs" ]]; then
|
||||
while IFS=$'\t' read -r n title; do echo "- $title ([#$n](https://github.com/$REPO/pull/$n))"; done <<< "$prs"
|
||||
else
|
||||
echo "- See the commits since ${previous:-the previous release}."
|
||||
fi
|
||||
echo
|
||||
echo "The signed annotated tag \`v$version\` fixes source \`${bump_sha:0:7}\` on \`$BRANCH\`."
|
||||
echo
|
||||
echo "No GA approval is implied."
|
||||
} > "$notes"
|
||||
gh release create "v$version" -R "$REPO" --verify-tag --prerelease --title "$artifact $version" --notes-file "$notes"
|
||||
python3 "$workdir/rc_guard.py" lock "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" "$MERGE_SHA"
|
||||
gh api -X DELETE "repos/$REPO/git/refs/heads/$lock"
|
||||
echo "Tagged and released v$version ($artifact) on ${bump_sha:0:7}." >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -0,0 +1,30 @@
|
||||
name: authentik-schema-drift
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
drift:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- name: Resolve version and fetch its schema
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
INPUT_VERSION: ${{ inputs.version }}
|
||||
run: "version=\"${INPUT_VERSION}\"\nif [ -z \"$version\" ]; then\n version=$(gh release view --repo goauthentik/authentik\
|
||||
\ --json tagName -q .tagName | sed 's#^version/##')\nfi\necho \"Authentik $version\"\ncurl -fsSL \"https://raw.githubusercontent.com/goauthentik/authentik/version/${version}/schema.yml\"\
|
||||
\ -o \"$RUNNER_TEMP/schema.yml\"\necho \"SCHEMA=$RUNNER_TEMP/schema.yml\" >> \"$GITHUB_ENV\"\n"
|
||||
- name: Drift test
|
||||
run: ./mvnw -B -q test -Dtest=SchemaDriftTest -Dsurefire.failIfNoSpecifiedTests=false -Dauthentik.schema.file="$SCHEMA"
|
||||
'on':
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
description: Authentik version (e.g. 2026.10.0); empty = latest release
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
@@ -0,0 +1,325 @@
|
||||
name: Build
|
||||
|
||||
# Native macOS/Windows binaries require GitHub-hosted platforms; the orb generates the tiny caller.
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
full_native:
|
||||
description: Qualify all five native platforms on an explicit manual run
|
||||
type: boolean
|
||||
default: false
|
||||
secrets:
|
||||
HOMEBREW_TAP_TOKEN:
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: qctl-native-${{ github.repository }}-${{ github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) }}
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'graalvm'
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-maven-
|
||||
|
||||
- name: Run tests
|
||||
run: mvn clean verify -q
|
||||
|
||||
build-native:
|
||||
needs: test
|
||||
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.full_native)
|
||||
strategy:
|
||||
matrix:
|
||||
include: ${{ fromJSON((startsWith(github.ref, 'refs/tags/v') || inputs.full_native) && '[{"os":"ubuntu-latest","artifact":"qctl-linux-amd64"},{"os":"ubuntu-24.04-arm","artifact":"qctl-linux-arm64"},{"os":"macos-15-intel","artifact":"qctl-macos-amd64"},{"os":"macos-14","artifact":"qctl-macos-arm64"},{"os":"windows-latest","artifact":"qctl-windows-amd64.exe"}]' || '[{"os":"ubuntu-latest","artifact":"qctl-linux-amd64"}]') }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up GraalVM
|
||||
uses: graalvm/setup-graalvm@v1
|
||||
with:
|
||||
java-version: '21'
|
||||
distribution: 'graalvm'
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-maven-
|
||||
|
||||
- name: Verify artifact architecture
|
||||
shell: bash
|
||||
env:
|
||||
ARTIFACT: ${{ matrix.artifact }}
|
||||
run: |
|
||||
case "$ARTIFACT" in
|
||||
*arm64) [[ "$(uname -m)" == arm64 || "$(uname -m)" == aarch64 ]] ;;
|
||||
*amd64|*amd64.exe) [[ "$(uname -m)" == x86_64 ]] ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
- name: Build native image
|
||||
run: mvn clean package -DskipTests -Pnative -q
|
||||
|
||||
- name: Rename artifact (Unix)
|
||||
if: runner.os != 'Windows'
|
||||
run: mv qctl-cli/target/qctl qctl-cli/target/${{ matrix.artifact }}
|
||||
|
||||
- name: Rename artifact (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: mv qctl-cli/target/qctl.exe qctl-cli/target/${{ matrix.artifact }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: qctl-cli/target/${{ matrix.artifact }}
|
||||
|
||||
release:
|
||||
needs: build-native
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Flatten artifacts
|
||||
run: |
|
||||
mkdir -p release
|
||||
find artifacts -type f -exec mv {} release/ \;
|
||||
ls -la release/
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: release/*
|
||||
generate_release_notes: true
|
||||
|
||||
docker:
|
||||
needs: release
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Download Linux AMD64 artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: qctl-linux-amd64
|
||||
path: .
|
||||
|
||||
- name: Download Linux ARM64 artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: qctl-linux-arm64
|
||||
path: .
|
||||
|
||||
- name: Prepare binaries
|
||||
run: |
|
||||
chmod +x qctl-linux-amd64 qctl-linux-arm64
|
||||
# Dockerfile expects qctl-linux-amd64 and qctl-linux-arm64
|
||||
ls -la qctl-linux-*
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to GHCR
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: packaging/docker/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/qrun-io/qctl:${{ github.ref_name }}
|
||||
ghcr.io/qrun-io/qctl:latest
|
||||
|
||||
update-homebrew:
|
||||
permissions:
|
||||
contents: read
|
||||
needs: release
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
- name: Checkout homebrew-qctl tap
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: QRun-IO/homebrew-qctl
|
||||
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
||||
path: homebrew-tap
|
||||
|
||||
- name: Update Homebrew formula
|
||||
env:
|
||||
VERSION: ${{ github.ref_name }}
|
||||
run: |
|
||||
VERSION="${VERSION#v}"
|
||||
|
||||
SHA_MACOS_ARM64=$(shasum -a 256 artifacts/qctl-macos-arm64/qctl-macos-arm64 | cut -d' ' -f1)
|
||||
SHA_MACOS_AMD64=$(shasum -a 256 artifacts/qctl-macos-amd64/qctl-macos-amd64 | cut -d' ' -f1)
|
||||
SHA_LINUX_ARM64=$(shasum -a 256 artifacts/qctl-linux-arm64/qctl-linux-arm64 | cut -d' ' -f1)
|
||||
SHA_LINUX_AMD64=$(shasum -a 256 artifacts/qctl-linux-amd64/qctl-linux-amd64 | cut -d' ' -f1)
|
||||
|
||||
FORMULA="homebrew-tap/Formula/qctl.rb"
|
||||
|
||||
# Update version
|
||||
sed -i "s/version \"[^\"]*\"/version \"${VERSION}\"/" "$FORMULA"
|
||||
|
||||
# Update SHA256 hashes in order: macos-arm64, macos-amd64, linux-arm64, linux-amd64
|
||||
awk -v v1="$SHA_MACOS_ARM64" -v v2="$SHA_MACOS_AMD64" -v v3="$SHA_LINUX_ARM64" -v v4="$SHA_LINUX_AMD64" '
|
||||
BEGIN { n = 0 }
|
||||
/sha256/ {
|
||||
n++
|
||||
if (n == 1) sub(/sha256 "[^"]*"/, "sha256 \"" v1 "\"")
|
||||
else if (n == 2) sub(/sha256 "[^"]*"/, "sha256 \"" v2 "\"")
|
||||
else if (n == 3) sub(/sha256 "[^"]*"/, "sha256 \"" v3 "\"")
|
||||
else if (n == 4) sub(/sha256 "[^"]*"/, "sha256 \"" v4 "\"")
|
||||
}
|
||||
{ print }
|
||||
' "$FORMULA" > "$FORMULA.tmp" && mv "$FORMULA.tmp" "$FORMULA"
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
cd homebrew-tap
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add Formula/qctl.rb
|
||||
git diff --staged --quiet || git commit -m "Update qctl to ${GITHUB_REF_NAME}"
|
||||
git push
|
||||
|
||||
update-scoop:
|
||||
needs: release
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: develop
|
||||
|
||||
- name: Download Windows artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: qctl-windows-amd64.exe
|
||||
path: artifacts
|
||||
|
||||
- name: Update Scoop manifest
|
||||
env:
|
||||
VERSION: ${{ github.ref_name }}
|
||||
run: |
|
||||
VERSION="${VERSION#v}"
|
||||
SHA_WINDOWS=$(shasum -a 256 artifacts/qctl-windows-amd64.exe | cut -d' ' -f1)
|
||||
|
||||
MANIFEST="packaging/scoop/qctl.json"
|
||||
|
||||
# Update version
|
||||
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"${VERSION}\"/" "$MANIFEST"
|
||||
|
||||
# Update download URL version
|
||||
sed -i "s|/download/v[^/]*/|/download/v${VERSION}/|g" "$MANIFEST"
|
||||
|
||||
# Update hash
|
||||
sed -i "s/\"hash\": \"[^\"]*\"/\"hash\": \"${SHA_WINDOWS}\"/" "$MANIFEST"
|
||||
|
||||
- name: Clean up artifacts
|
||||
run: rm -rf artifacts
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "chore(scoop): update manifest to ${{ github.ref_name }}"
|
||||
title: "chore(scoop): update manifest to ${{ github.ref_name }}"
|
||||
body: "Automated Scoop manifest update for release ${{ github.ref_name }}"
|
||||
branch: chore/scoop-${{ github.ref_name }}
|
||||
base: develop
|
||||
add-paths: packaging/scoop/qctl.json
|
||||
|
||||
update-aur:
|
||||
needs: release
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: develop
|
||||
|
||||
- name: Download Linux AMD64 artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: qctl-linux-amd64
|
||||
path: artifacts
|
||||
|
||||
- name: Update AUR PKGBUILD
|
||||
env:
|
||||
VERSION: ${{ github.ref_name }}
|
||||
run: |
|
||||
VERSION="${VERSION#v}"
|
||||
SHA_LINUX=$(shasum -a 256 artifacts/qctl-linux-amd64 | cut -d' ' -f1)
|
||||
|
||||
PKGBUILD="packaging/aur/PKGBUILD"
|
||||
|
||||
# Update version
|
||||
sed -i "s/pkgver=.*/pkgver=${VERSION}/" "$PKGBUILD"
|
||||
|
||||
# Reset pkgrel for new version
|
||||
sed -i "s/pkgrel=.*/pkgrel=1/" "$PKGBUILD"
|
||||
|
||||
# Update hash
|
||||
sed -i "s/sha256sums_x86_64=('[^']*')/sha256sums_x86_64=('${SHA_LINUX}')/" "$PKGBUILD"
|
||||
|
||||
- name: Clean up artifacts
|
||||
run: rm -rf artifacts
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v7
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "chore(aur): update PKGBUILD to ${{ github.ref_name }}"
|
||||
title: "chore(aur): update PKGBUILD to ${{ github.ref_name }}"
|
||||
body: "Automated AUR PKGBUILD update for release ${{ github.ref_name }}"
|
||||
branch: chore/aur-${{ github.ref_name }}
|
||||
base: develop
|
||||
add-paths: packaging/aur/PKGBUILD
|
||||
@@ -0,0 +1,664 @@
|
||||
name: qqq-all guarded release
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
version:
|
||||
description: Reviewed source version (GA or exact coordinated RC)
|
||||
required: true
|
||||
type: string
|
||||
release_sha:
|
||||
description: Full develop commit SHA already signed and tagged with the selected version
|
||||
required: true
|
||||
type: string
|
||||
smoke_evidence:
|
||||
description: github (legacy default) or circle (public API evidence; optional credential)
|
||||
type: string
|
||||
default: github
|
||||
circle_workflow_id:
|
||||
description: Exact successful Circle workflow UUID; verified independently through both APIs
|
||||
type: string
|
||||
default: ''
|
||||
smoke_run_id:
|
||||
description: Successful Smoke workflow run ID for that exact develop SHA
|
||||
default: ''
|
||||
required: false
|
||||
type: string
|
||||
secrets:
|
||||
CIRCLECI_TOKEN:
|
||||
required: false
|
||||
|
||||
permissions:
|
||||
checks: read
|
||||
actions: read
|
||||
contents: write
|
||||
packages: write
|
||||
|
||||
concurrency:
|
||||
group: qqq-all-release-4.1.0
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
environment: qqq-all-release
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
RELEASE_SHA: ${{ inputs.release_sha }}
|
||||
SMOKE_EVIDENCE: ${{ inputs.smoke_evidence }}
|
||||
CIRCLE_WORKFLOW_ID: ${{ inputs.circle_workflow_id }}
|
||||
SMOKE_RUN_ID: ${{ inputs.smoke_run_id }}
|
||||
RELEASE_ENABLED: ${{ vars.QQQ_ALL_RELEASE_ENABLED }}
|
||||
LICENSE_CLEARED: ${{ vars.QQQ_ALL_RELEASE_LICENSE_APPROVED }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
TAG: ${{ inputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Check manual release controls and exact tag
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$GITHUB_REF" = refs/heads/develop
|
||||
test "$RELEASE_ENABLED" = true
|
||||
test "$LICENSE_CLEARED" = true
|
||||
case "$VERSION" in 4.1.0|4.1.0-RC.1) ;; *) exit 1 ;; esac
|
||||
[[ "$RELEASE_SHA" =~ ^[0-9a-f]{40}$ ]]
|
||||
case "$SMOKE_EVIDENCE" in
|
||||
github) [[ "$SMOKE_RUN_ID" =~ ^[0-9]+$ ]] ;;
|
||||
circle)
|
||||
[[ "$CIRCLE_WORKFLOW_ID" =~ ^[0-9a-f-]{36}$ ]]
|
||||
;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
test "$(git rev-parse HEAD)" = "$GITHUB_SHA"
|
||||
test "$RELEASE_SHA" = "$GITHUB_SHA"
|
||||
test "$(git cat-file -t "refs/tags/$TAG")" = tag
|
||||
test "$(git rev-parse "refs/tags/$TAG^{commit}")" = "$RELEASE_SHA"
|
||||
gh api "repos/$GITHUB_REPOSITORY/git/tags/$(git rev-parse "refs/tags/$TAG")" > "$RUNNER_TEMP/tag-object.json"
|
||||
- name: Materialize reviewed central release gates
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p "$RUNNER_TEMP/central-release"
|
||||
cat > "$RUNNER_TEMP/central-release/qqq_all_release_gate.py" <<'PY'
|
||||
"""Fail-closed checks for the manual 4.1.0 GA / exact RC.1 release workflow."""
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
from pathlib import Path
|
||||
from xml.etree import ElementTree
|
||||
|
||||
|
||||
QBITS = (
|
||||
"quick-search", "user-role-permissions", "customizable-table-views",
|
||||
"standard-process-trace", "webhooks", "workflows", "geo-data",
|
||||
"sftp-data-integration",
|
||||
)
|
||||
RELEASE_VERSIONS = ("4.1.0", "4.1.0-RC.1")
|
||||
|
||||
|
||||
def immutable_version(value):
|
||||
return re.fullmatch(r"[0-9]+(?:\.[0-9]+){2,3}(?:-RC\.[1-9][0-9]*)?", value) is not None
|
||||
|
||||
|
||||
def validate_version(version):
|
||||
if version not in RELEASE_VERSIONS:
|
||||
raise GateError("This release workflow is limited to 4.1.0 and 4.1.0-RC.1")
|
||||
|
||||
|
||||
class GateError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def properties(path):
|
||||
root = ElementTree.parse(path).getroot()
|
||||
namespace = xml_namespace(root)
|
||||
values = root.find(f"{namespace}properties")
|
||||
if values is None:
|
||||
raise GateError(f"Missing Maven properties in {path}")
|
||||
return {child.tag.removeprefix(namespace): (child.text or "").strip() for child in values}
|
||||
|
||||
|
||||
def xml_namespace(root):
|
||||
return root.tag.partition("}")[0] + "}" if root.tag.startswith("{") else ""
|
||||
|
||||
|
||||
def coordinates(path):
|
||||
root = ElementTree.parse(path).getroot()
|
||||
namespace = xml_namespace(root)
|
||||
parent = root.find(f"{namespace}parent")
|
||||
|
||||
def value(name):
|
||||
direct = root.findtext(f"{namespace}{name}")
|
||||
inherited = parent.findtext(f"{namespace}{name}") if parent is not None else None
|
||||
return direct or inherited
|
||||
|
||||
return value("groupId"), value("artifactId"), value("version")
|
||||
|
||||
|
||||
def managed_dependencies(path):
|
||||
root = ElementTree.parse(path).getroot()
|
||||
namespace = xml_namespace(root)
|
||||
values = properties(path)
|
||||
if root.findall(f"{namespace}profiles/{namespace}profile/{namespace}dependencyManagement"):
|
||||
raise GateError(f"Profile-managed dependency override in {path}")
|
||||
dependencies = root.find(f"{namespace}dependencyManagement/{namespace}dependencies")
|
||||
if dependencies is None:
|
||||
raise GateError(f"Missing dependencyManagement in {path}")
|
||||
|
||||
def field(dependency, name, default=""):
|
||||
return (dependency.findtext(f"{namespace}{name}") or default).strip()
|
||||
|
||||
managed = []
|
||||
for dependency in dependencies.findall(f"{namespace}dependency"):
|
||||
version = field(dependency, "version")
|
||||
reference = re.fullmatch(r"\$\{([^}]+)\}", version)
|
||||
if reference:
|
||||
version = values.get(reference.group(1), "")
|
||||
if not immutable_version(version):
|
||||
raise GateError(f"Unreleased managed dependency in {path}: "
|
||||
f"{field(dependency, 'artifactId')}")
|
||||
managed.append((field(dependency, "groupId"), field(dependency, "artifactId"),
|
||||
version, field(dependency, "type", "jar"),
|
||||
field(dependency, "scope", "compile"),
|
||||
field(dependency, "classifier")))
|
||||
if not managed:
|
||||
raise GateError(f"No managed dependencies in {path}")
|
||||
return managed
|
||||
|
||||
|
||||
def validate_managed_bom(path, version):
|
||||
managed = managed_dependencies(path)
|
||||
entries = {(group, artifact): (pin, kind, scope) for group, artifact, pin, kind, scope, _ in managed}
|
||||
if len(entries) != len(managed):
|
||||
raise GateError(f"Duplicate managed dependency in {path}")
|
||||
if entries.get(("com.kingsrook.qqq", "qqq-bom-pom")) != (version, "pom", "import"):
|
||||
raise GateError(f"QQQ BOM import differs from {version} in {path}")
|
||||
values = properties(path)
|
||||
if entries.get(("com.kingsrook.qqq", "qqq-frontend-next")) != (
|
||||
values.get("qqq-frontend-next.version"), "jar", "compile"):
|
||||
raise GateError(f"Managed Next differs from its release pin in {path}")
|
||||
for name in QBITS:
|
||||
artifact = f"qbit-{name}"
|
||||
if entries.get(("com.kingsrook.qbits", artifact)) != (
|
||||
values.get(f"{artifact}.version"), "jar", "compile"):
|
||||
raise GateError(f"Managed {artifact} differs from its release pin in {path}")
|
||||
return managed
|
||||
|
||||
|
||||
def validate_published_poms(parent_path, bom_path, version, local_bom):
|
||||
expected = (
|
||||
(parent_path, "qqq-all-parent"),
|
||||
(bom_path, "qqq-all-bom"),
|
||||
)
|
||||
for path, artifact in expected:
|
||||
if coordinates(path) != ("com.kingsrook.qqq", artifact, version):
|
||||
raise GateError(f"Published {artifact} POM is not the {version} release")
|
||||
published = properties(bom_path)
|
||||
if published.get("qqq.version") != version:
|
||||
raise GateError(f"Published BOM does not import QQQ {version}")
|
||||
for name in QBITS:
|
||||
key = f"qbit-{name}.version"
|
||||
value = published.get(key, "")
|
||||
if not immutable_version(value):
|
||||
raise GateError(f"Published BOM {key} is not a release")
|
||||
local = properties(local_bom)
|
||||
for key in ("qqq.version", "qqq-frontend-next.version", *(f"qbit-{name}.version" for name in QBITS)):
|
||||
if published.get(key) != local.get(key):
|
||||
raise GateError(f"Published BOM {key} differs from release source")
|
||||
if validate_managed_bom(bom_path, version) != validate_managed_bom(local_bom, version):
|
||||
raise GateError("Published BOM dependencyManagement differs from release source")
|
||||
|
||||
|
||||
def validate_poms(root, version):
|
||||
validate_version(version)
|
||||
parent = properties(root / "pom.xml")
|
||||
bom = properties(root / "qqq-all-bom/pom.xml")
|
||||
if parent.get("revision") != version or bom.get("qqq.version") != version:
|
||||
raise GateError(f"Parent revision and QQQ BOM pin must both equal {version}")
|
||||
for name in QBITS:
|
||||
key = f"qbit-{name}.version"
|
||||
value = bom.get(key, "")
|
||||
if not immutable_version(value):
|
||||
raise GateError(f"{key} must be a published non-snapshot version")
|
||||
for key, value in bom.items():
|
||||
if key.endswith(".version") and not immutable_version(value):
|
||||
raise GateError(f"{key} must be an immutable release version")
|
||||
validate_managed_bom(root / "qqq-all-bom/pom.xml", version)
|
||||
|
||||
|
||||
def validate_smoke(run, jobs, sha):
|
||||
if not re.fullmatch(r"[0-9a-f]{40}", sha):
|
||||
raise GateError("Release SHA must be a full lowercase Git commit ID")
|
||||
expected = {
|
||||
"name": "Smoke", "path": ".github/workflows/smoke.yml",
|
||||
"head_sha": sha, "head_branch": "develop", "event": "push",
|
||||
"conclusion": "success",
|
||||
}
|
||||
for key, value in expected.items():
|
||||
if run.get(key) != value:
|
||||
raise GateError(f"Smoke run {key} must equal {value}")
|
||||
observed = {"core": False, "full": False}
|
||||
for job in jobs.get("jobs", []):
|
||||
name = job.get("name")
|
||||
if name in observed:
|
||||
if job.get("conclusion") != "success":
|
||||
raise GateError(f"Smoke job {name} did not pass")
|
||||
observed[name] = True
|
||||
if not all(observed.values()):
|
||||
raise GateError("Smoke run must include successful core and full jobs")
|
||||
|
||||
|
||||
def validate_upstream_release(release, version):
|
||||
if (not immutable_version(version) or release.get("tag_name") != "v" + version
|
||||
or release.get("draft") is not False
|
||||
or release.get("prerelease") is not ("-RC." in version)):
|
||||
raise GateError(f"Upstream release must be public v{version} with matching prerelease state")
|
||||
|
||||
|
||||
def validate_tag(tag, version, sha, tag_sha):
|
||||
validate_version(version)
|
||||
if not all(re.fullmatch(r"[0-9a-f]{40}", value) for value in (sha, tag_sha)):
|
||||
raise GateError("Tag and commit IDs must be full Git SHAs")
|
||||
if (tag.get("sha") != tag_sha or tag.get("tag") != version
|
||||
or tag.get("object", {}).get("type") != "commit"
|
||||
or tag.get("object", {}).get("sha") != sha
|
||||
or tag.get("verification", {}).get("verified") is not True
|
||||
or tag.get("verification", {}).get("reason") != "valid"):
|
||||
raise GateError("Release tag must be signed, verified, annotated and point to the exact release commit")
|
||||
|
||||
|
||||
def download_public_inputs(bom, version, destination, central="https://repo.maven.apache.org/maven2"):
|
||||
"""Fetch the declared first-party inputs and their parents without credentials."""
|
||||
validate_version(version)
|
||||
destination.mkdir(parents=True, exist_ok=True)
|
||||
receipts = []
|
||||
visited = set()
|
||||
|
||||
def fetch(group, artifact, pin, kind):
|
||||
coordinate = (group, artifact, pin, kind)
|
||||
if coordinate in visited:
|
||||
return
|
||||
if (not re.fullmatch(r"[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)*", group)
|
||||
or not re.fullmatch(r"[A-Za-z0-9_-]+", artifact) or not immutable_version(pin)):
|
||||
raise GateError(f"Invalid or mutable public coordinate: {coordinate}")
|
||||
visited.add(coordinate)
|
||||
relative = f"{group.replace('.', '/')}/{artifact}/{pin}/{artifact}-{pin}.{kind}"
|
||||
url = central + "/" + relative
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=30) as response:
|
||||
data = response.read()
|
||||
except (urllib.error.URLError, OSError) as error:
|
||||
if isinstance(error, urllib.error.HTTPError):
|
||||
error.close()
|
||||
raise GateError(f"Public input unavailable: {relative}") from error
|
||||
if not data:
|
||||
raise GateError(f"Empty public input: {relative}")
|
||||
path = destination / relative
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(data)
|
||||
if kind == "pom":
|
||||
if coordinates(path) != (group, artifact, pin):
|
||||
raise GateError(f"Public POM coordinates differ: {relative}")
|
||||
root = ElementTree.fromstring(data)
|
||||
ns = xml_namespace(root)
|
||||
parent = root.find(f"{ns}parent")
|
||||
if parent is not None:
|
||||
parent_group = parent.findtext(f"{ns}groupId", "")
|
||||
parent_pin = parent.findtext(f"{ns}version", "")
|
||||
if not immutable_version(parent_pin):
|
||||
raise GateError(f"Mutable parent in {relative}")
|
||||
if parent_group.startswith("com.kingsrook"):
|
||||
fetch(parent_group, parent.findtext(f"{ns}artifactId", ""), parent_pin, "pom")
|
||||
if artifact == "qbit-build-parent":
|
||||
imports = root.findall(f"{ns}dependencyManagement/{ns}dependencies/{ns}dependency")
|
||||
props = root.find(f"{ns}properties")
|
||||
values = {child.tag.removeprefix(ns): child.text for child in props} if props is not None else {}
|
||||
qqq_imports = [dep for dep in imports if dep.findtext(f"{ns}groupId") == "com.kingsrook.qqq"
|
||||
and dep.findtext(f"{ns}artifactId") == "qqq-bom-pom"]
|
||||
if len(qqq_imports) != 1:
|
||||
raise GateError("Public qbit-build-parent must import the candidate QQQ BOM")
|
||||
dep = qqq_imports[0]
|
||||
actual = dep.findtext(f"{ns}version", "")
|
||||
actual = values.get(actual[2:-1], "") if actual.startswith("${") else actual
|
||||
if (actual != version or dep.findtext(f"{ns}type") != "pom"
|
||||
or dep.findtext(f"{ns}scope") != "import"):
|
||||
raise GateError("Public qbit-build-parent QQQ import differs from the candidate")
|
||||
receipts.append({"url": url, "sha256": hashlib.sha256(data).hexdigest(), "bytes": len(data)})
|
||||
|
||||
for group, artifact, pin, kind, _, classifier in validate_managed_bom(bom, version):
|
||||
if group.startswith("com.kingsrook"):
|
||||
if classifier or kind not in ("jar", "pom"):
|
||||
raise GateError(f"Unsupported first-party release input: {artifact}")
|
||||
fetch(group, artifact, pin, "pom")
|
||||
if kind == "jar":
|
||||
fetch(group, artifact, pin, "jar")
|
||||
(destination / "receipts.json").write_text(json.dumps(receipts, indent=2) + "\n")
|
||||
return receipts
|
||||
|
||||
|
||||
def validate_evidence(sha, smoke_run=None, smoke_jobs=None, circle_smoke=None):
|
||||
if circle_smoke is not None:
|
||||
if smoke_run is not None or smoke_jobs is not None:
|
||||
raise GateError("Select exactly one complete smoke evidence mode")
|
||||
from verify_all_circle_smoke import validate, EvidenceError
|
||||
try:
|
||||
if (circle_smoke.get("schema") != "qqq-all-circle-smoke/v1"
|
||||
or circle_smoke.get("repository") != "QRun-IO/qqq-all"
|
||||
or circle_smoke.get("sha") != sha):
|
||||
raise GateError("Circle evidence schema, repository or SHA differs")
|
||||
validate(sha, circle_smoke["workflow_id"], circle_smoke["workflow"],
|
||||
circle_smoke["pipeline"], circle_smoke["jobs"],
|
||||
circle_smoke["check_runs"], circle_smoke["pipeline_workflows"])
|
||||
except (EvidenceError, KeyError, TypeError) as error:
|
||||
raise GateError("Circle smoke evidence rejected") from error
|
||||
else:
|
||||
if smoke_run is None or smoke_jobs is None:
|
||||
raise GateError("Select exactly one complete smoke evidence mode")
|
||||
validate_smoke(smoke_run, smoke_jobs, sha)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--root", type=Path, required=True)
|
||||
parser.add_argument("--version", required=True)
|
||||
parser.add_argument("--sha", required=True)
|
||||
parser.add_argument("--smoke-run", type=Path)
|
||||
parser.add_argument("--smoke-jobs", type=Path)
|
||||
parser.add_argument("--circle-smoke", type=Path)
|
||||
parser.add_argument("--published-parent", type=Path, required=True)
|
||||
parser.add_argument("--published-bom", type=Path, required=True)
|
||||
parser.add_argument("--upstream-release", type=Path, required=True)
|
||||
parser.add_argument("--next-release", type=Path, required=True)
|
||||
parser.add_argument("--tag-object", type=Path, required=True)
|
||||
parser.add_argument("--tag-sha", required=True)
|
||||
parser.add_argument("--public-inputs", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
validate_poms(args.root, args.version)
|
||||
validate_upstream_release(json.loads(args.upstream_release.read_text()), args.version)
|
||||
validate_upstream_release(json.loads(args.next_release.read_text()),
|
||||
properties(args.root / "qqq-all-bom/pom.xml")["qqq-frontend-next.version"])
|
||||
validate_tag(json.loads(args.tag_object.read_text()), args.version, args.sha, args.tag_sha)
|
||||
validate_evidence(args.sha,
|
||||
json.loads(args.smoke_run.read_text()) if args.smoke_run else None,
|
||||
json.loads(args.smoke_jobs.read_text()) if args.smoke_jobs else None,
|
||||
json.loads(args.circle_smoke.read_text()) if args.circle_smoke else None)
|
||||
validate_published_poms(args.published_parent, args.published_bom, args.version,
|
||||
args.root / "qqq-all-bom/pom.xml")
|
||||
download_public_inputs(args.root / "qqq-all-bom/pom.xml", args.version, args.public_inputs)
|
||||
except (GateError, OSError, ElementTree.ParseError, json.JSONDecodeError) as error:
|
||||
print(f"Release gate failed: {error}", file=sys.stderr)
|
||||
return 1
|
||||
print("Local POM and exact-commit smoke gates passed")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
PY
|
||||
cat > "$RUNNER_TEMP/central-release/verify_all_circle_smoke.py" <<'PY'
|
||||
#!/usr/bin/env python3
|
||||
"""Fetch and verify exact-source qqq-all Circle smoke evidence; never synthesize GH runs."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.request
|
||||
from urllib.parse import urlparse
|
||||
|
||||
REPO = 'QRun-IO/qqq-all'
|
||||
PROJECT = 'gh/' + REPO
|
||||
UUID = r'[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
|
||||
|
||||
|
||||
class EvidenceError(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
def require(value, message):
|
||||
if not value:
|
||||
raise EvidenceError(message)
|
||||
|
||||
|
||||
def workflow_id(url):
|
||||
parsed = urlparse(url or '')
|
||||
require(parsed.scheme == 'https' and parsed.netloc == 'app.circleci.com', 'Untrusted Circle workflow URL')
|
||||
match = re.fullmatch('/workflow/(' + UUID + ')', parsed.path)
|
||||
require(match is not None, 'Unrecognized Circle workflow URL')
|
||||
return match.group(1)
|
||||
|
||||
|
||||
def validate(sha, selected, workflow, pipeline, jobs, checks, siblings):
|
||||
require(re.fullmatch(r'[0-9a-f]{40}', sha or ''), 'Expected full release SHA')
|
||||
require(re.fullmatch(UUID, selected or ''), 'Expected workflow UUID')
|
||||
require(workflow.get('id') == selected and workflow.get('project_slug') == PROJECT,
|
||||
'Wrong workflow identity or project')
|
||||
require(workflow.get('name') == 'verify-and-smoke' and workflow.get('status') == 'success',
|
||||
'Smoke workflow is not successful')
|
||||
# A rerun may execute selected jobs only. Do not infer inherited successes.
|
||||
require(not workflow.get('rerun_of') and workflow.get('auto_rerun_number', 0) == 0,
|
||||
'Rerun ancestry is not supported')
|
||||
require(workflow.get('pipeline_id') == pipeline.get('id') and pipeline.get('project_slug') == PROJECT,
|
||||
'Wrong pipeline identity or project')
|
||||
vcs = pipeline.get('vcs', {})
|
||||
require(vcs.get('revision') == sha and vcs.get('branch') == 'develop' and not vcs.get('tag'),
|
||||
'Pipeline is not the exact develop source')
|
||||
require(vcs.get('origin_repository_url', '').removesuffix('.git') == 'https://github.com/' + REPO,
|
||||
'Wrong source repository')
|
||||
trigger = pipeline.get('trigger', {})
|
||||
require(trigger.get('type') == 'webhook' and bool(trigger.get('received_at'))
|
||||
and bool(trigger.get('actor', {}).get('login')), 'Unproven webhook trigger')
|
||||
candidates = [c for c in checks if c.get('name') == 'verify-and-smoke' and c.get('app', {}).get('id') == 18001]
|
||||
require(candidates, 'No Circle publisher check')
|
||||
latest = max(candidates, key=lambda c: c.get('id', 0))
|
||||
require(latest.get('head_sha') == sha and latest.get('status') == 'completed'
|
||||
and latest.get('conclusion') == 'success', 'Latest Circle check did not pass this source')
|
||||
require(workflow_id(latest.get('details_url')) == selected, 'Selected workflow is not the latest trusted check')
|
||||
same = [w for w in siblings if w.get('name') == 'verify-and-smoke']
|
||||
require(len(same) == 1 and same[0].get('id') == selected,
|
||||
'Multiple workflow attempts require explicit ancestry reconciliation')
|
||||
require(jobs and all(j.get('status') == 'success' and j.get('type') == 'build' for j in jobs),
|
||||
'Workflow has missing, skipped, canceled, approval, or unsuccessful jobs')
|
||||
for name in ('build-and-test', 'core', 'full'):
|
||||
matches = [j for j in jobs if j.get('name') == name]
|
||||
require(len(matches) == 1 and matches[0].get('job_number') and matches[0].get('id'),
|
||||
'Missing or duplicate required smoke job: ' + name)
|
||||
return {'schema': 'qqq-all-circle-smoke/v1', 'repository': REPO, 'sha': sha,
|
||||
'branch': 'develop', 'workflow_id': selected, 'pipeline_id': pipeline['id'],
|
||||
'check_run_id': latest['id'], 'workflow': workflow, 'pipeline': pipeline,
|
||||
'jobs': jobs, 'check_runs': checks, 'pipeline_workflows': siblings}
|
||||
|
||||
|
||||
def gh(path):
|
||||
result = subprocess.run(['gh', 'api', '--method', 'GET', path], capture_output=True, timeout=60)
|
||||
require(result.returncode == 0, 'GitHub evidence read failed')
|
||||
return json.loads(result.stdout)
|
||||
|
||||
|
||||
class NoRedirect(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
raise EvidenceError('Circle API redirect refused')
|
||||
|
||||
|
||||
def circle(path):
|
||||
token = os.environ.get('CIRCLECI_TOKEN')
|
||||
# Public projects expose these records without authentication.
|
||||
headers = {'Accept': 'application/json'}
|
||||
if token:
|
||||
headers['Circle-Token'] = token
|
||||
request = urllib.request.Request('https://circleci.com/api/v2/' + path,
|
||||
headers=headers)
|
||||
with urllib.request.build_opener(NoRedirect).open(request, timeout=30) as response:
|
||||
raw = response.read(2_000_001)
|
||||
require(len(raw) <= 2_000_000, 'Evidence response exceeds bound')
|
||||
return json.loads(raw)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--sha', required=True)
|
||||
parser.add_argument('--workflow-id', required=True)
|
||||
parser.add_argument('--output', type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
require(re.fullmatch(UUID, args.workflow_id), 'Invalid workflow ID')
|
||||
require(re.fullmatch(r'[0-9a-f]{40}', args.sha), 'Invalid source SHA')
|
||||
workflow = circle('workflow/' + args.workflow_id)
|
||||
pipeline_id = workflow.get('pipeline_id', '')
|
||||
require(re.fullmatch(UUID, pipeline_id), 'Invalid pipeline ID')
|
||||
pipeline = circle('pipeline/' + pipeline_id)
|
||||
jobs = circle('workflow/' + args.workflow_id + '/job')
|
||||
siblings = circle('pipeline/' + pipeline_id + '/workflow')
|
||||
require(not jobs.get('next_page_token') and not siblings.get('next_page_token'),
|
||||
'Paginated workflow evidence requires reconciliation')
|
||||
checks = gh('repos/' + REPO + '/commits/' + args.sha + '/check-runs?filter=all&per_page=100')
|
||||
require(checks.get('total_count', 0) <= 100, 'Too many check runs to establish latest attempt')
|
||||
evidence = validate(args.sha, args.workflow_id, workflow, pipeline, jobs['items'], checks['check_runs'], siblings['items'])
|
||||
args.output.write_text(json.dumps(evidence, indent=2) + '\n', encoding='utf-8')
|
||||
print('Exact-source Circle smoke evidence verified')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except (EvidenceError, OSError, ValueError, KeyError, subprocess.TimeoutExpired):
|
||||
sys.exit('Circle smoke evidence rejected or unavailable; no release authorization')
|
||||
PY
|
||||
- name: Verify Circle smoke provenance
|
||||
if: inputs.smoke_evidence == 'circle'
|
||||
env:
|
||||
CIRCLECI_TOKEN: ${{ secrets.CIRCLECI_TOKEN }}
|
||||
shell: bash
|
||||
run: python3 "$RUNNER_TEMP/central-release/verify_all_circle_smoke.py" --sha "$RELEASE_SHA" --workflow-id "$CIRCLE_WORKFLOW_ID" --output "$RUNNER_TEMP/circle-smoke.json"
|
||||
- name: Verify upstream release, signed tag, exact-commit smoke, public pins, and public GHCR
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh api "repos/QRun-IO/qqq/releases/tags/v$VERSION" > "$RUNNER_TEMP/upstream-release.json"
|
||||
next_version="$(python3 -c 'import sys; import os; sys.path.insert(0, os.path.join(os.environ["RUNNER_TEMP"], "central-release")); from qqq_all_release_gate import properties, validate_poms; from pathlib import Path; validate_poms(Path("."), os.environ["VERSION"]); print(properties(Path("qqq-all-bom/pom.xml"))["qqq-frontend-next.version"])')"
|
||||
gh api "repos/QRun-IO/qqq-frontend-next/releases/tags/v$next_version" > "$RUNNER_TEMP/next-release.json"
|
||||
smoke_args=()
|
||||
if [[ "$SMOKE_EVIDENCE" == github ]]; then
|
||||
gh api "repos/$GITHUB_REPOSITORY/actions/runs/$SMOKE_RUN_ID" > "$RUNNER_TEMP/smoke-run.json"
|
||||
gh api "repos/$GITHUB_REPOSITORY/actions/runs/$SMOKE_RUN_ID/jobs?per_page=100" > "$RUNNER_TEMP/smoke-jobs.json"
|
||||
smoke_args=(--smoke-run "$RUNNER_TEMP/smoke-run.json" --smoke-jobs "$RUNNER_TEMP/smoke-jobs.json")
|
||||
else
|
||||
smoke_args=(--circle-smoke "$RUNNER_TEMP/circle-smoke.json")
|
||||
fi
|
||||
central="https://repo.maven.apache.org/maven2/com/kingsrook/qqq"
|
||||
for artifact in qqq-all-parent qqq-all-bom; do
|
||||
curl --fail --silent --show-error \
|
||||
"$central/$artifact/$VERSION/$artifact-$VERSION.pom" \
|
||||
--output "$RUNNER_TEMP/$artifact.pom"
|
||||
done
|
||||
python3 "$RUNNER_TEMP/central-release/qqq_all_release_gate.py" --root . --version "$VERSION" --sha "$RELEASE_SHA" \
|
||||
"${smoke_args[@]}" \
|
||||
--published-parent "$RUNNER_TEMP/qqq-all-parent.pom" \
|
||||
--published-bom "$RUNNER_TEMP/qqq-all-bom.pom" \
|
||||
--upstream-release "$RUNNER_TEMP/upstream-release.json" \
|
||||
--next-release "$RUNNER_TEMP/next-release.json" \
|
||||
--tag-object "$RUNNER_TEMP/tag-object.json" \
|
||||
--tag-sha "$(git rev-parse "refs/tags/$TAG")" \
|
||||
--public-inputs "$RUNNER_TEMP/public-inputs"
|
||||
test "$(gh api /orgs/QRun-IO/packages/container/qqq-all --jq .visibility)" = public
|
||||
gh api --paginate 'orgs/QRun-IO/packages/container/qqq-all/versions?per_page=100' \
|
||||
--jq '.[] | .metadata.container.tags[]?' > "$RUNNER_TEMP/ghcr-tags.txt"
|
||||
if grep -Fxq "$VERSION" "$RUNNER_TEMP/ghcr-tags.txt"; then
|
||||
echo "GHCR tag $VERSION already exists" >&2
|
||||
exit 1
|
||||
fi
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
cache: maven
|
||||
- name: Verify release reactor
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
printf '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"/>\n' > "$RUNNER_TEMP/public-settings.xml"
|
||||
python3 -m unittest discover -s scripts -p 'test_*.py' -v
|
||||
mvn -B -ntp -s "$RUNNER_TEMP/public-settings.xml" -gs "$RUNNER_TEMP/public-settings.xml" \
|
||||
-Dmaven.repo.local="$RUNNER_TEMP/release-m2" verify \
|
||||
org.apache.maven.plugins:maven-enforcer-plugin:3.5.0:enforce -Drules=requireReleaseDeps
|
||||
- name: Recheck develop, annotated tag, and release absence before publication
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$(gh api "repos/$GITHUB_REPOSITORY/branches/develop" --jq .commit.sha)" = "$RELEASE_SHA"
|
||||
test "$(git ls-remote origin "refs/tags/$TAG" | cut -f1)" = "$(git rev-parse "refs/tags/$TAG")"
|
||||
test "$(git ls-remote origin "refs/tags/$TAG^{}" | cut -f1)" = "$RELEASE_SHA"
|
||||
if release_check="$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$TAG" 2>&1)"; then
|
||||
echo "GitHub release $TAG already exists" >&2
|
||||
exit 1
|
||||
elif [[ "$release_check" != *"HTTP 404"* ]]; then
|
||||
echo "$release_check" >&2
|
||||
exit 1
|
||||
fi
|
||||
gh api --paginate 'orgs/QRun-IO/packages/container/qqq-all/versions?per_page=100' \
|
||||
--jq '.[] | .metadata.container.tags[]?' > "$RUNNER_TEMP/ghcr-tags-final.txt"
|
||||
if grep -Fxq "$VERSION" "$RUNNER_TEMP/ghcr-tags-final.txt"; then
|
||||
echo "GHCR tag $VERSION already exists" >&2
|
||||
exit 1
|
||||
fi
|
||||
- uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Publish versioned image
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
image="ghcr.io/qrun-io/qqq-all:$VERSION"
|
||||
docker build \
|
||||
--label org.opencontainers.image.source=https://github.com/QRun-IO/qqq-all \
|
||||
--label "org.opencontainers.image.version=$VERSION" \
|
||||
--label "org.opencontainers.image.revision=$RELEASE_SHA" \
|
||||
--tag "$image" .
|
||||
docker push "$image"
|
||||
printf 'Published image: %s\n' "$image" >> "$GITHUB_STEP_SUMMARY"
|
||||
- name: Build image Compose distribution bundle
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
image="$(docker image inspect --format '{{index .RepoDigests 0}}' "ghcr.io/qrun-io/qqq-all:$VERSION")"
|
||||
python3 scripts/release_bundle.py --root . --version "$VERSION" --sha "$RELEASE_SHA" \
|
||||
--image "$image" --output "$RUNNER_TEMP"
|
||||
- name: Publish GitHub release with Compose bundle
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
release_flags=()
|
||||
case "$VERSION" in
|
||||
4.1.0) ;;
|
||||
4.1.0-RC.1) release_flags=(--prerelease --latest=false) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
gh release create "$TAG" "$RUNNER_TEMP/qqq-all-$VERSION.tar.gz" \
|
||||
"$RUNNER_TEMP/qqq-all-$VERSION/compose.yaml" --repo "$GITHUB_REPOSITORY" \
|
||||
--verify-tag --title "qqq-all $VERSION" --notes-from-tag "${release_flags[@]}"
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: always()
|
||||
with:
|
||||
name: release-evidence-${{ inputs.version }}
|
||||
path: |
|
||||
${{ runner.temp }}/public-inputs/receipts.json
|
||||
${{ runner.temp }}/tag-object.json
|
||||
${{ runner.temp }}/upstream-release.json
|
||||
${{ runner.temp }}/next-release.json
|
||||
${{ runner.temp }}/circle-smoke.json
|
||||
${{ runner.temp }}/smoke-run.json
|
||||
${{ runner.temp }}/smoke-jobs.json
|
||||
${{ runner.temp }}/qqq-all-${{ inputs.version }}/release.json
|
||||
@@ -0,0 +1,13 @@
|
||||
name: Workflow lint
|
||||
'on':
|
||||
workflow_call:
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
actionlint:
|
||||
runs-on: ubuntu-24.04
|
||||
container: cimg/go:1.24
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Lint GitHub Actions workflows
|
||||
run: go run github.com/rhysd/actionlint/cmd/actionlint@v1.7.7 -color .github/workflows/*.yml
|
||||
+12
@@ -2,3 +2,15 @@
|
||||
orb.yml
|
||||
.DS_Store
|
||||
target
|
||||
|
||||
# Test data directory (created dynamically during tests)
|
||||
tests/test_data
|
||||
|
||||
# IDE
|
||||
.idea
|
||||
|
||||
.claude
|
||||
|
||||
# Local Python regression-test caches.
|
||||
__pycache__/
|
||||
*.pyc
|
||||
Generated
-120
@@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="39f8d35a-1bb7-489b-b59c-b0ba3ffefe23" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/calculate-version.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/calculate-version.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/check_middleware_api_versions.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/check_middleware_api_versions.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/create_github_release.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/create_github_release.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/manage_version_calculate.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/manage_version_calculate.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/manage_version_commit.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/manage_version_commit.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/manage_version_git_config.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/manage_version_git_config.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_build_compile.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_build_compile.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_deploy.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_deploy.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_gpg_setup.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_jar_deploy_gpg_setup.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_verify_save_test_results.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_verify_save_test_results.sh" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/scripts/mvn_verify_verify.sh" beforeDir="false" afterPath="$PROJECT_DIR$/src/scripts/mvn_verify_verify.sh" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="GitHubPullRequestSearchHistory">{
|
||||
"lastFilter": {
|
||||
"state": "OPEN",
|
||||
"assignee": "KofTwentyTwo"
|
||||
}
|
||||
}</component>
|
||||
<component name="GithubPullRequestsUISettings">{
|
||||
"selectedUrlAndAccountId": {
|
||||
"url": "git@github.com:Kingsrook/qqq-orb.git",
|
||||
"accountId": "7a0b7646-5b0c-4647-976d-932a62661dd2"
|
||||
}
|
||||
}</component>
|
||||
<component name="MacroExpansionManager">
|
||||
<option name="directoryName" value="Qi1Hqxgr" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 5
|
||||
}</component>
|
||||
<component name="ProjectId" id="32YtZdjn4FeSrJsD5VMG3tLBHKD" />
|
||||
<component name="ProjectLevelVcsManager">
|
||||
<ConfirmationsSetting value="2" id="Add" />
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="autoscrollFromSource" value="true" />
|
||||
<option name="showExcludedFiles" value="false" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"RunOnceActivity.git.unshallow": "true",
|
||||
"RunOnceActivity.go.formatter.settings.were.checked": "true",
|
||||
"RunOnceActivity.go.migrated.go.modules.settings": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"git-widget-placeholder": "develop",
|
||||
"go.import.settings.migrated": "true",
|
||||
"io.aesy.yamllint.do.not.ask.to.enable": "true",
|
||||
"last_opened_file_path": "/Users/james.maes/Git.Local/Kingsrook/qqq-orb/src/jobs",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"org.rust.cargo.project.model.impl.CargoExternalSystemProjectAware.subscribe.first.balloon": "",
|
||||
"org.rust.first.attach.projects": "true",
|
||||
"settings.editor.selected.configurable": "preferences.sourceCode.yaml"
|
||||
},
|
||||
"keyToStringList": {
|
||||
"stardust.markdown.MarkdownSplitEditorSuppressor:keyList": []
|
||||
}
|
||||
}</component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="$PROJECT_DIR$/src/jobs" />
|
||||
<recent name="$PROJECT_DIR$/src/commands" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RustProjectSettings">
|
||||
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
|
||||
</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9823dce3aa75-bf35d07a577b-intellij.indexing.shared.core-IU-252.25557.131" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-b598e85cdad2-JavaScript-IU-252.25557.131" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="39f8d35a-1bb7-489b-b59c-b0ba3ffefe23" name="Changes" comment="" />
|
||||
<created>1757609391348</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1757609391348</updated>
|
||||
<workItem from="1757609392578" duration="5983000" />
|
||||
<workItem from="1757633227531" duration="300000" />
|
||||
<workItem from="1757633543711" duration="945000" />
|
||||
<workItem from="1757634532876" duration="26000" />
|
||||
<workItem from="1757634568948" duration="111000" />
|
||||
<workItem from="1757634683262" duration="86000" />
|
||||
<workItem from="1757634778652" duration="275000" />
|
||||
<workItem from="1757635061044" duration="63000" />
|
||||
<workItem from="1757721395861" duration="3728000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="VgoProject">
|
||||
<settings-migrated>true</settings-migrated>
|
||||
</component>
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
repos:
|
||||
- hooks:
|
||||
- id: commitizen
|
||||
- id: commitizen-branch
|
||||
stages:
|
||||
- pre-push
|
||||
repo: https://github.com/commitizen-tools/commitizen
|
||||
rev: v4.9.1
|
||||
+176
-18
@@ -7,7 +7,116 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Maven compile, verify and frontend test steps pass `--update-snapshots`, so SNAPSHOT dependencies restored from the pom-checksum-keyed `~/.m2` cache are re-checked against the remote on every build instead of going stale
|
||||
|
||||
### Added
|
||||
- Auto-publish `dev:snapshot` on develop branch pushes
|
||||
- Auto-publish production releases on main branch pushes with semantic version bumping
|
||||
- Support for `[major]` and `[minor]` commit keywords to control version bumps (default: patch)
|
||||
- Security scanning job with Gitleaks, Semgrep, OWASP Dependency Check, and CycloneDX SBOM
|
||||
|
||||
## [0.6.2] - 2026-01-30
|
||||
|
||||
### Fixed
|
||||
- Node.js version commit fails with `invalid refspec 'HEAD:'` when `CIRCLE_BRANCH` is empty (detached HEAD builds)
|
||||
- Aligned `node_version_commit.sh` with Maven equivalent: added feature branch skip, empty branch fallback, and non-fatal push handling
|
||||
|
||||
## [0.6.1] - 2026-01-18
|
||||
|
||||
### Fixed
|
||||
- Skip version commit for feature branches (prevents unnecessary commits)
|
||||
|
||||
## [0.6.0] - 2026-01-14
|
||||
|
||||
### Added
|
||||
- SpotBugs and PMD static analysis workflows
|
||||
|
||||
### Fixed
|
||||
- Use `mvn install` for multi-module dependency resolution in static analysis
|
||||
|
||||
## [0.5.3] - 2026-01-10
|
||||
|
||||
### Fixed
|
||||
- NPM prerelease tags now correctly formatted
|
||||
- Skip GitHub release creation for release candidates
|
||||
|
||||
## [0.5.2] - 2026-01-09
|
||||
|
||||
### Fixed
|
||||
- Version commit push failures no longer fail the build (moved from 0.5.1 notes)
|
||||
- Strip `<rerunFailure>` elements from JUnit XML (moved from 0.5.1 notes)
|
||||
|
||||
## [0.5.1] - 2026-01-07
|
||||
|
||||
### Fixed
|
||||
- Added `DEBIAN_FRONTEND=noninteractive` to browser dependency installation to prevent interactive prompts from blocking CI
|
||||
|
||||
## [0.5.0] - 2025-12-28
|
||||
|
||||
### Added
|
||||
- Machine executor with native Docker support for Testcontainers and LocalStack
|
||||
- `install_java` command to install Temurin JDK and Maven on machine executors
|
||||
- Optional Node.js installation for frontend builds on machine executor
|
||||
|
||||
### Changed
|
||||
- Switched from Docker executor (cimg/openjdk) to Ubuntu machine executor
|
||||
- All Maven jobs now use machine executor with Docker pre-installed
|
||||
|
||||
### Fixed
|
||||
- GitHub SSH host key added before clone operations
|
||||
|
||||
## [0.4.0] - 2025-12-28
|
||||
|
||||
### Added
|
||||
- Java 21 support with configurable executor - New `java` executor using `cimg/openjdk` with version parameter (default: 21.0)
|
||||
- Automatic GitHub release creation for releases and release candidates
|
||||
- RC support for GitHub releases (published as pre-releases)
|
||||
|
||||
### Changed
|
||||
- License changed to AGPL-3.0 with QRun-IO copyright
|
||||
- Maven jobs now use the new `java` executor (resource_class: large)
|
||||
- Node jobs use `default` executor with configurable version
|
||||
|
||||
### Migration
|
||||
Projects needing Java 17 can explicitly set `java_version: "17.0"` in their workflow config.
|
||||
|
||||
## [0.3.13] - 2025-12-28
|
||||
|
||||
### Added
|
||||
- GitHub release configuration for CI pipeline
|
||||
- Standardized README documentation
|
||||
|
||||
### Changed
|
||||
- Merged develop branch updates in preparation for 0.4.0
|
||||
|
||||
## [0.3.12] - 2025-10-22
|
||||
|
||||
### Fixed
|
||||
- Version calculation now uses `CIRCLE_BRANCH` environment variable before falling back to git ref parsing
|
||||
|
||||
### Changed
|
||||
- Linting cleanup for spacing consistency
|
||||
|
||||
## [0.3.11] - 2025-10-09
|
||||
|
||||
### Fixed
|
||||
- Separated cache saves and restores by key for proper cache isolation
|
||||
|
||||
## [0.3.10] - 2025-10-09
|
||||
|
||||
### Fixed
|
||||
- Frontend build cache steps in test workflow corrected
|
||||
|
||||
## [0.3.9] - 2025-10-09
|
||||
|
||||
### Fixed
|
||||
- Frontend build now properly saves npm module cache
|
||||
|
||||
## [0.3.8] - 2025-09-29
|
||||
|
||||
### Added
|
||||
- Support for publishing snapshots for feature branches
|
||||
- Comprehensive README with detailed usage examples
|
||||
- CONTRIBUTING.md with development guidelines
|
||||
- SECURITY.md with security policy and reporting procedures
|
||||
@@ -17,40 +126,89 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Updated README to follow QQQ framework standards
|
||||
- Enhanced documentation structure and organization
|
||||
|
||||
## [2.1] - 2024-01-XX
|
||||
## [0.3.7] - 2025-09-18
|
||||
|
||||
### Added
|
||||
- Multi-platform support for Maven and Node.js projects
|
||||
- GitFlow integration with automated version management
|
||||
- Comprehensive testing framework with coverage reporting
|
||||
- Automated publishing to Maven Central and npm registries
|
||||
- Shell script automation and utilities
|
||||
- Documentation generation and publishing
|
||||
- Comprehensive README with current functionality and testing framework documentation
|
||||
|
||||
### Changed
|
||||
- Improved orb structure and organization
|
||||
- Enhanced error handling and validation
|
||||
- Updated dependencies and security patches
|
||||
- Enhanced documentation structure and organization
|
||||
|
||||
## [0.3.6] - 2025-09-16
|
||||
|
||||
### Fixed
|
||||
- Various bug fixes and stability improvements
|
||||
- Updated handling for tagged releases in main branch to properly promote to latest tag
|
||||
- Fixed git commit operations on main branch for production releases
|
||||
|
||||
## [2.0] - 2023-XX-XX
|
||||
## [0.3.5] - 2025-09-16
|
||||
|
||||
### Fixed
|
||||
- Updated git commit on main branch to work correctly for tag releases in production releases
|
||||
|
||||
## [0.3.4] - 2025-09-15
|
||||
|
||||
### Fixed
|
||||
- Removed conditionals around git operations after version checks for main and hotfix branches
|
||||
- Updated standard GitHub documentation to point to top-level project documentation
|
||||
|
||||
## [0.3.3] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Made publish_asciidoc a parameterized run option
|
||||
|
||||
### Changed
|
||||
- Enhanced parameterization for better flexibility
|
||||
|
||||
## [0.3.2] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Base level repository files and updated README
|
||||
|
||||
### Changed
|
||||
- Updated check_middleware_api_versions to run based on parameter configuration
|
||||
|
||||
## [0.3.1] - 2025-09-15
|
||||
|
||||
### Fixed
|
||||
- Version bump corrections
|
||||
- Fixed bad sync RC update
|
||||
- Updated example version references
|
||||
|
||||
## [0.3.0] - 2025-09-15
|
||||
|
||||
### Added
|
||||
- Support for pure Node.js projects
|
||||
- Support for building integrated frontend (npm) within Maven projects
|
||||
- Support for publishing snapshots and tags
|
||||
- Enhanced feature branch versioning with dynamic commit hash updates
|
||||
- Comprehensive test suite and improved linting for calculate_version.sh
|
||||
|
||||
### Changed
|
||||
- Reverted to only handle POM files (npm handled within its own job)
|
||||
- Adjusted default execution state for scripts
|
||||
- Converted longer commands to scripts per organization linting standards
|
||||
- Refactored calculate_version.sh for cleaner branch level code
|
||||
|
||||
### Fixed
|
||||
- Multiple linting fixes from CircleCI integration
|
||||
- Improved error handling and validation
|
||||
|
||||
## [0.2.0] - 2025-09-13
|
||||
|
||||
### Added
|
||||
- Initial CircleCI orb implementation
|
||||
- Basic Maven project support
|
||||
- Core CI/CD workflows
|
||||
- Initial documentation for orb
|
||||
|
||||
### Changed
|
||||
- Migrated from custom CI/CD to CircleCI orbs
|
||||
- Updated CircleCI to use new QQQ orb for workflows
|
||||
|
||||
## [1.x] - 2022-XX-XX
|
||||
|
||||
### Added
|
||||
- Legacy CI/CD implementation
|
||||
- Basic automation scripts
|
||||
### Fixed
|
||||
- Implemented initial linting fixes from CircleCI
|
||||
- Initial import of scripts and jobs from QQQ base repository
|
||||
|
||||
---
|
||||
|
||||
**Note**: For detailed release information and breaking changes, see the [QQQ Wiki](https://github.com/Kingsrook/qqq/wiki).
|
||||
**Note**: For detailed release information and breaking changes, see the [QQQ Wiki](https://github.com/Kingsrook/qqq/wiki).
|
||||
@@ -0,0 +1,94 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
CircleCI orb for QQQ framework projects. Provides pre-built jobs for building, testing, and publishing Maven and Node.js projects using GitFlow branching strategy.
|
||||
|
||||
## Build Commands
|
||||
|
||||
```bash
|
||||
make pack # Pack orb to target/qqq-orb-packed.yml
|
||||
make validate # Pack and validate orb
|
||||
make test # Pack and validate (alias for validate)
|
||||
make test-scripts # Run calculate_version.sh test suite
|
||||
make test-all # Run all tests (orb + scripts)
|
||||
make lint # Run yamllint, shellcheck, and CircleCI validation
|
||||
make dev # Development workflow: pack, validate, show status
|
||||
make clean # Remove target/ and tests/test_data/
|
||||
make publish-snapshot # Publish to kingsrook/qqq-orb@dev:snapshot
|
||||
make publish-release # Interactive production release with git tagging
|
||||
```
|
||||
|
||||
## Running Individual Tests
|
||||
|
||||
```bash
|
||||
./tests/run_tests.sh # Standard test run
|
||||
./tests/run_tests.sh --verbose # Verbose output
|
||||
./tests/run_tests.sh --ci # CI mode (minimal output)
|
||||
./tests/test_calculate_version.sh # Direct test suite execution
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
### Directory Structure
|
||||
|
||||
- `src/@orb.yml` - Main orb definition entry point
|
||||
- `src/commands/` - Reusable orb commands (YAML files that include scripts)
|
||||
- `src/jobs/` - Complete job definitions combining commands
|
||||
- `src/executors/` - Docker executor definitions (java.yml, default.yml)
|
||||
- `src/scripts/` - Bash scripts included in commands
|
||||
- `tests/` - Test suite for calculate_version.sh
|
||||
|
||||
### Key Components
|
||||
|
||||
**Executors:**
|
||||
- `java` - cimg/openjdk image with configurable version (17.0, 21.0), resource_class: large
|
||||
- `default` - cimg/node image for Node.js projects
|
||||
|
||||
**Jobs:**
|
||||
- `mvn_publish` - Full publish workflow (build, version, test, deploy, git ops, GitHub release)
|
||||
- `mvn_test_only` - Build and test for feature branches
|
||||
- `mvn_frontend_publish` / `mvn_frontend_test_only` - Same with frontend support
|
||||
- `node_publish` / `node_test_only` - Pure Node.js workflows
|
||||
|
||||
**Version Calculation:**
|
||||
The core logic is in `src/scripts/calculate_version.sh`. It determines version based on branch type:
|
||||
- `develop` -> `X.Y.Z-SNAPSHOT`
|
||||
- `release/*` -> `X.Y.Z-RC.N`
|
||||
- `main` (tagged) -> `X.Y.Z`
|
||||
- `hotfix/*` -> Patch version bump
|
||||
- `feature/*` -> `X.Y.Z-feature-{name}-{hash}-SNAPSHOT`
|
||||
|
||||
### Orb Packing
|
||||
|
||||
The orb uses CircleCI's "unpacked" format. YAML files in `src/` are packed into a single `target/qqq-orb-packed.yml`. Commands reference scripts via `<<include(scripts/scriptname.sh)>>` syntax.
|
||||
|
||||
### CI Pipeline
|
||||
|
||||
`.circleci/config.yml` runs lint/pack/review/shellcheck, then continues to `.circleci/test-deploy.yml` which runs command tests and publishes on release tags (`v*.*.*`).
|
||||
|
||||
## Linting Requirements
|
||||
|
||||
- YAML: yamllint for commands/jobs/examples
|
||||
- Shell: shellcheck for all .sh files in src/scripts/ and tests/
|
||||
- Orb: `circleci orb validate` for orb syntax
|
||||
|
||||
## Required Context Variables for Publishing
|
||||
|
||||
- `MAVEN_USERNAME`, `MAVEN_PASSWORD` - Sonatype credentials
|
||||
- `GPG_PRIVATE_KEY_B64`, `GPG_KEYNAME`, `GPG_PASSPHRASE` - GPG signing
|
||||
- `GITHUB_TOKEN` - GitHub API access
|
||||
|
||||
## Knowledge base
|
||||
|
||||
Deep-review dossiers for this repo and the wider QQQ platform live in the second-brain
|
||||
vault (Obsidian, `R:/Git.Local/KofTwentyTwo/second-brain`):
|
||||
|
||||
- Platform hub: `knowledge/qqq/qqq-hub.md`
|
||||
- This repo's dossier: `knowledge/qqq/repos/qqq-orb.md` (reviewed at develop
|
||||
commit `bdff16ff9582`, 2026-07-04) — covers 0.5.0→0.6.0→HEAD behavior changes,
|
||||
the npm dist-tag defect verdict, org-wide pin survey, licensing history, and
|
||||
open bug #5 (release-branch patch loss).
|
||||
- Release/versioning architecture: `knowledge/qqq/architecture/build-release-versioning.md`
|
||||
+2
-84
@@ -1,86 +1,4 @@
|
||||
# Code of Conduct
|
||||
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our community include:
|
||||
|
||||
- **Being respectful and inclusive** of differing viewpoints and experiences
|
||||
- **Accepting constructive criticism** gracefully
|
||||
- **Focusing on what is best** for the community
|
||||
- **Showing empathy** towards other community members
|
||||
- **Being collaborative** and helping others learn and grow
|
||||
- **Using welcoming and inclusive language** in all interactions
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- **Harassment** in any form, including sexual harassment
|
||||
- **Trolling, insulting, or derogatory comments** and personal or political attacks
|
||||
- **Public or private harassment** of any kind
|
||||
- **Publishing others' private information** without explicit permission
|
||||
- **Conduct that could reasonably be considered inappropriate** in a professional setting
|
||||
- **Dismissing or attacking inclusion-oriented requests** or concerns
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **conduct@kingsrook.com**. All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
**Community Impact**: A violation through a single incident or series of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq). Translations are available at [https://www.contributor-covenant.org/translations](https://www.contributor-covenant.org/translations).
|
||||
|
||||
## Contact Information
|
||||
|
||||
- **Code of Conduct Issues**: conduct@kingsrook.com
|
||||
- **General Contact**: contact@kingsrook.com
|
||||
- **Company**: Kingsrook, LLC
|
||||
- **Website**: https://qrun.io
|
||||
|
||||
---
|
||||
|
||||
**Thank you for helping create a welcoming and inclusive community!** 🌟
|
||||
See Project level [Code of Conduct](https://github.com/Kingsrook/qqq/blob/develop/CODE_OF_CONDUCT.md)
|
||||
+2
-306
@@ -1,307 +1,3 @@
|
||||
# Code Style Guide
|
||||
|
||||
This document outlines the coding standards and style guidelines for QQQ Orb development.
|
||||
|
||||
## 🎯 Overview
|
||||
|
||||
QQQ Orb follows consistent coding standards to ensure maintainability, readability, and reliability across all components.
|
||||
|
||||
## 📁 File Organization
|
||||
|
||||
### Directory Structure
|
||||
|
||||
```
|
||||
src/
|
||||
├── @orb.yml # Main orb definition
|
||||
├── commands/ # Reusable commands
|
||||
├── jobs/ # Complete workflow jobs
|
||||
├── scripts/ # Shell scripts
|
||||
├── executors/ # Execution environments
|
||||
└── examples/ # Usage examples
|
||||
```
|
||||
|
||||
### Naming Conventions
|
||||
|
||||
- **Files**: Use lowercase with underscores (`mvn_build.yml`)
|
||||
- **Directories**: Use lowercase with underscores (`commands/`)
|
||||
- **Variables**: Use uppercase with underscores (`MAVEN_USERNAME`)
|
||||
- **Functions**: Use lowercase with underscores (`calculate_version`)
|
||||
|
||||
## 🔧 YAML Configuration
|
||||
|
||||
### General Guidelines
|
||||
|
||||
- **Indentation**: Use 2 spaces (no tabs)
|
||||
- **Line Length**: Maximum 120 characters
|
||||
- **Quotes**: Use single quotes for strings when possible
|
||||
- **Comments**: Use `#` for comments, explain complex logic
|
||||
|
||||
### Orb Definition Structure
|
||||
|
||||
```yaml
|
||||
# @orb.yml
|
||||
version: 2.1
|
||||
|
||||
description: >
|
||||
Brief description of the orb's purpose.
|
||||
|
||||
display:
|
||||
home_url: "https://www.qrun.io"
|
||||
source_url: "https://github.com/Kingsrook/qqq-orb"
|
||||
|
||||
orbs:
|
||||
dependency-orb: circleci/dependency@1.0.0
|
||||
```
|
||||
|
||||
### Command Structure
|
||||
|
||||
```yaml
|
||||
# commands/example_command.yml
|
||||
description: "Brief description of what this command does"
|
||||
|
||||
parameters:
|
||||
param1:
|
||||
type: string
|
||||
default: "default_value"
|
||||
description: "Parameter description"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Step Name"
|
||||
command: |
|
||||
echo "Command content"
|
||||
# Additional commands
|
||||
```
|
||||
|
||||
### Job Structure
|
||||
|
||||
```yaml
|
||||
# jobs/example_job.yml
|
||||
description: "Brief description of what this job does"
|
||||
|
||||
executor: default
|
||||
|
||||
parameters:
|
||||
param1:
|
||||
type: string
|
||||
default: "default_value"
|
||||
description: "Parameter description"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- qqq-orb/example-command:
|
||||
param1: << parameters.param1 >>
|
||||
```
|
||||
|
||||
## 🐚 Shell Scripts
|
||||
|
||||
### General Guidelines
|
||||
|
||||
- **Shebang**: Always use `#!/bin/bash`
|
||||
- **Error Handling**: Use `set -euo pipefail`
|
||||
- **Variables**: Use `readonly` for constants
|
||||
- **Functions**: Use descriptive names and document parameters
|
||||
|
||||
### Script Template
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Script description
|
||||
# Usage: script_name [options] [arguments]
|
||||
|
||||
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
readonly SCRIPT_NAME="$(basename "$0")"
|
||||
|
||||
# Function documentation
|
||||
# Parameters: $1 - description, $2 - description
|
||||
function example_function() {
|
||||
local param1="$1"
|
||||
local param2="$2"
|
||||
|
||||
# Function implementation
|
||||
echo "Processing: $param1, $param2"
|
||||
}
|
||||
|
||||
# Main execution
|
||||
main() {
|
||||
# Main logic here
|
||||
example_function "value1" "value2"
|
||||
}
|
||||
|
||||
# Run main function if script is executed directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
main "$@"
|
||||
fi
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
```bash
|
||||
# Check if command exists
|
||||
if ! command -v mvn &> /dev/null; then
|
||||
echo "Error: Maven is not installed" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if file exists
|
||||
if [[ ! -f "pom.xml" ]]; then
|
||||
echo "Error: pom.xml not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Handle command failures
|
||||
if ! mvn clean compile; then
|
||||
echo "Error: Maven compilation failed" >&2
|
||||
exit 1
|
||||
fi
|
||||
```
|
||||
|
||||
## 📝 Documentation
|
||||
|
||||
### README Structure
|
||||
|
||||
- **Title**: Clear, descriptive title
|
||||
- **Badges**: Status badges for version, license, etc.
|
||||
- **Overview**: Brief description of purpose
|
||||
- **Quick Start**: Getting started instructions
|
||||
- **Usage**: Detailed usage examples
|
||||
- **Development**: Development setup and guidelines
|
||||
- **Contributing**: Contribution guidelines
|
||||
- **License**: License information
|
||||
|
||||
### Inline Documentation
|
||||
|
||||
```yaml
|
||||
# commands/mvn_build.yml
|
||||
description: >
|
||||
Builds a Maven project with specified goals.
|
||||
Supports multi-module projects and custom settings.
|
||||
|
||||
parameters:
|
||||
goals:
|
||||
type: string
|
||||
default: "clean compile"
|
||||
description: >
|
||||
Maven goals to execute.
|
||||
Common values: clean, compile, test, package, install
|
||||
```
|
||||
|
||||
### Shell Script Documentation
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# Script: calculate_version.sh
|
||||
# Description: Calculates semantic version based on GitFlow branch
|
||||
# Usage: calculate_version.sh [branch_name]
|
||||
# Parameters:
|
||||
# branch_name - Git branch name (optional, defaults to current branch)
|
||||
# Returns: Semantic version string
|
||||
```
|
||||
|
||||
## 🧪 Testing Standards
|
||||
|
||||
### Test Structure
|
||||
|
||||
- **Unit Tests**: Test individual functions and commands
|
||||
- **Integration Tests**: Test complete workflows
|
||||
- **Validation Tests**: Test orb configuration and packing
|
||||
|
||||
### Test Naming
|
||||
|
||||
- **Test Files**: `test_<component>.yml`
|
||||
- **Test Functions**: `test_<function_name>`
|
||||
- **Test Descriptions**: Clear, descriptive test names
|
||||
|
||||
### Coverage Requirements
|
||||
|
||||
- **Commands**: All parameters and error conditions
|
||||
- **Jobs**: All workflow paths and error handling
|
||||
- **Scripts**: All functions and error conditions
|
||||
|
||||
## 🔍 Code Review Standards
|
||||
|
||||
### Review Checklist
|
||||
|
||||
- [ ] **Functionality**: Code works as intended
|
||||
- [ ] **Style**: Follows project style guidelines
|
||||
- [ ] **Documentation**: Adequate documentation and comments
|
||||
- [ ] **Testing**: Appropriate test coverage
|
||||
- [ ] **Security**: No security vulnerabilities
|
||||
- [ ] **Performance**: Efficient implementation
|
||||
- [ ] **Maintainability**: Code is maintainable and readable
|
||||
|
||||
### Review Process
|
||||
|
||||
1. **Self Review**: Author reviews their own code first
|
||||
2. **Peer Review**: At least one peer review required
|
||||
3. **Testing**: All tests must pass
|
||||
4. **Documentation**: Documentation updated as needed
|
||||
5. **Approval**: Required approvals before merge
|
||||
|
||||
## 🛠️ Development Tools
|
||||
|
||||
### Required Tools
|
||||
|
||||
- **CircleCI CLI**: For orb development and validation
|
||||
- **ShellCheck**: For shell script linting
|
||||
- **yamllint**: For YAML linting
|
||||
- **Git**: For version control
|
||||
|
||||
### IDE Configuration
|
||||
|
||||
#### VS Code
|
||||
|
||||
```json
|
||||
{
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.rulers": [120],
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"yaml.schemas": {
|
||||
"https://json.schemastore.org/circle-ci-config.json": ".circleci/config.yml"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### IntelliJ IDEA
|
||||
|
||||
- **Code Style**: Use project code style settings
|
||||
- **File Templates**: Use project file templates
|
||||
- **Inspections**: Enable all relevant inspections
|
||||
|
||||
## 📋 Best Practices
|
||||
|
||||
### General Principles
|
||||
|
||||
- **DRY**: Don't Repeat Yourself
|
||||
- **KISS**: Keep It Simple, Stupid
|
||||
- **YAGNI**: You Aren't Gonna Need It
|
||||
- **SOLID**: Follow SOLID principles where applicable
|
||||
|
||||
### Security Considerations
|
||||
|
||||
- **Secrets**: Never commit secrets or credentials
|
||||
- **Input Validation**: Validate all inputs
|
||||
- **Error Handling**: Don't expose sensitive information in errors
|
||||
- **Dependencies**: Keep dependencies up to date
|
||||
|
||||
### Performance Considerations
|
||||
|
||||
- **Efficiency**: Use efficient algorithms and data structures
|
||||
- **Caching**: Cache expensive operations when appropriate
|
||||
- **Parallelization**: Use parallel execution where beneficial
|
||||
- **Resource Usage**: Minimize resource consumption
|
||||
|
||||
## 🔗 Resources
|
||||
|
||||
- **CircleCI Orb Development**: https://circleci.com/docs/2.0/orb-author-intro/
|
||||
- **Shell Script Best Practices**: https://google.github.io/styleguide/shellguide.html
|
||||
- **YAML Best Practices**: https://yaml.org/spec/1.2/spec.html
|
||||
- **GitFlow Workflow**: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow
|
||||
|
||||
---
|
||||
|
||||
**Remember**: Consistent code style improves maintainability and reduces bugs. When in doubt, follow existing patterns in the codebase.
|
||||
|
||||
* See Project [Code Style Guide](https://github.com/Kingsrook/qqq/blob/develop/CODE_STYLE.md)
|
||||
+2
-134
@@ -1,136 +1,4 @@
|
||||
# Contributing to QQQ Orb
|
||||
# Contributing to QBit User Role Permissions
|
||||
|
||||
First off, thanks for taking the time to contribute! ❤️
|
||||
* See Project [Contributing](https://github.com/Kingsrook/qqq/blob/develop/CONTRIBUTING.md)
|
||||
|
||||
QQQ Orb is **open source** and welcomes contributions from the community. This document provides a quick overview - for detailed guides, see our [Complete Documentation Wiki](https://github.com/Kingsrook/qqq/wiki).
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
**New to QQQ?** Start with our [Developer Onboarding Guide](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding) to get your environment set up.
|
||||
|
||||
## 📚 Documentation & Guides
|
||||
|
||||
All detailed information is in our [Wiki](https://github.com/Kingsrook/qqq/wiki):
|
||||
|
||||
- **[🏠 Home](https://github.com/Kingsrook/qqq/wiki/Home)** - Project overview
|
||||
- **[🔧 Development](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding)** - Complete setup guide
|
||||
- **[📝 Contribution Process](https://github.com/Kingsrook/qqq/wiki/Contribution-Guidelines)** - Detailed contribution workflow
|
||||
- **[🔍 Code Standards](https://github.com/Kingsrook/qqq/wiki/Code-Review-Standards)** - Coding standards and review process
|
||||
- **[🧪 Testing](https://github.com/Kingsrook/qqq/wiki/Testing)** - Testing strategy and requirements
|
||||
- **[🏗️ Architecture](https://github.com/Kingsrook/qqq/wiki/High-Level-Architecture)** - System design and principles
|
||||
|
||||
## 🤝 How to Contribute
|
||||
|
||||
### **1. Report Issues**
|
||||
Found a bug or have a feature request? [Create an issue](https://github.com/Kingsrook/qqq/issues).
|
||||
|
||||
### **2. Code Contributions**
|
||||
Want to contribute code? Follow our [Contribution Guidelines](https://github.com/Kingsrook/qqq/wiki/Contribution-Guidelines).
|
||||
|
||||
**Key Requirements:**
|
||||
- CircleCI CLI and orb development tools
|
||||
- Follow QQQ's [Code Review Standards](https://github.com/Kingsrook/qqq/wiki/Code-Review-Standards)
|
||||
- Meet testing coverage requirements
|
||||
- Use conventional commit messages
|
||||
- Validate orb configuration with `make lint`
|
||||
|
||||
### **3. Documentation**
|
||||
Improve our docs by updating the [Wiki](https://github.com/Kingsrook/qqq/wiki) or suggesting improvements via issues.
|
||||
|
||||
## 🔧 Development Setup
|
||||
|
||||
**Prerequisites:**
|
||||
- **macOS** (QQQ dev tools are macOS-optimized)
|
||||
- **CircleCI CLI** for orb development
|
||||
- **ShellCheck** and **yamllint** for linting
|
||||
- **Git** with SSH access
|
||||
|
||||
**Quick Setup:**
|
||||
```bash
|
||||
# Install CircleCI CLI
|
||||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo bash
|
||||
|
||||
# Install linting tools (macOS)
|
||||
brew install shellcheck yamllint
|
||||
|
||||
# Clone the repository
|
||||
git clone git@github.com:Kingsrook/qqq.git
|
||||
cd qqq/qqq-orb
|
||||
|
||||
# Run development workflow
|
||||
make dev
|
||||
```
|
||||
|
||||
For complete setup instructions, see [Developer Onboarding](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding).
|
||||
|
||||
## 📋 Contribution Checklist
|
||||
|
||||
Before submitting your contribution:
|
||||
|
||||
- [ ] **Environment**: Development environment properly set up
|
||||
- [ ] **Code Style**: Follows QQQ's [Code Review Standards](https://github.com/Kingsrook/qqq/wiki/Code-Review-Standards)
|
||||
- [ ] **Testing**: All tests pass with `make test`
|
||||
- [ ] **Linting**: All linting checks pass with `make lint`
|
||||
- [ ] **Documentation**: Updated relevant wiki pages
|
||||
- [ ] **Commit Messages**: Follow conventional commit format
|
||||
- [ ] **Orb Validation**: Orb packs and validates successfully
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
make test
|
||||
|
||||
# Run linting checks
|
||||
make lint
|
||||
|
||||
# Validate orb configuration
|
||||
make validate
|
||||
|
||||
# Development workflow
|
||||
make dev
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
The orb includes comprehensive testing:
|
||||
- **YAML Validation**: CircleCI orb configuration validation
|
||||
- **Shell Script Testing**: ShellCheck for shell script validation
|
||||
- **Orb Packing**: Tests orb packing and resolution
|
||||
- **Integration Testing**: End-to-end workflow testing
|
||||
|
||||
## 📦 Publishing
|
||||
|
||||
### Development Publishing
|
||||
|
||||
```bash
|
||||
# Publish snapshot for testing
|
||||
make publish-snapshot
|
||||
```
|
||||
|
||||
### Production Publishing
|
||||
|
||||
```bash
|
||||
# Publish production release
|
||||
make publish-release
|
||||
```
|
||||
|
||||
## 🆘 Getting Help
|
||||
|
||||
- **📖 [Wiki](https://github.com/Kingsrook/qqq/wiki)**: Start here for comprehensive guides
|
||||
- **🐛 [Issues](https://github.com/Kingsrook/qqq/issues)**: Search existing issues or create new ones
|
||||
- **💬 [Discussions](https://github.com/Kingsrook/qqq/discussions)**: Ask questions and get help
|
||||
|
||||
## 📄 Legal Notice
|
||||
|
||||
When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content, and that the content you contribute may be provided under the project license.
|
||||
|
||||
## 🏢 About Kingsrook
|
||||
|
||||
QQQ Orb is built by **[Kingsrook](https://qrun.io)** - making engineers more productive through intelligent automation and developer tools.
|
||||
|
||||
---
|
||||
|
||||
**Ready to contribute?** [Start with our Developer Onboarding Guide](https://github.com/Kingsrook/qqq/wiki/Developer-Onboarding)!
|
||||
@@ -1,21 +1,191 @@
|
||||
MIT License
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
Copyright (c) 2021-2024 Kingsrook, LLC
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
1. Definitions.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to the Licensor for inclusion in the Work by the copyright
|
||||
owner or by an individual or Legal Entity authorized to submit on
|
||||
behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written
|
||||
communication sent to the Licensor or its representatives, including
|
||||
but not limited to communication on electronic mailing lists, source
|
||||
code control systems, and issue tracking systems that are managed by,
|
||||
or on behalf of, the Licensor for the purpose of discussing and
|
||||
improving the Work, but excluding communication that is conspicuously
|
||||
marked or otherwise designated in writing by the copyright owner as
|
||||
"Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Copyright 2022-2025 QRunIO, LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,7 +1,7 @@
|
||||
# QQQ Orb Development Makefile
|
||||
# Provides convenient commands for orb development, validation, and publishing
|
||||
|
||||
.PHONY: help pack validate clean test publish-snapshot publish-release dev check-clean check-branch
|
||||
.PHONY: help pack validate clean test test-scripts test-all publish-snapshot publish-release dev check-clean check-branch
|
||||
|
||||
# Default target
|
||||
help:
|
||||
@@ -10,6 +10,8 @@ help:
|
||||
@echo " make pack - Pack the orb using 'orb pack' (recommended for orb development)"
|
||||
@echo " make validate - Validate the packed orb"
|
||||
@echo " make test - Pack and validate the orb"
|
||||
@echo " make test-scripts - Run comprehensive tests for calculate_version.sh"
|
||||
@echo " make test-all - Run all tests (orb + scripts)"
|
||||
@echo " make clean - Remove packed orb files"
|
||||
@echo " make dev - Development workflow: pack, validate, and show status"
|
||||
@echo " make lint - Run all CircleCI-style linting checks"
|
||||
@@ -17,11 +19,12 @@ help:
|
||||
@echo " make publish-release - Interactive production release (tagged version)"
|
||||
@echo ""
|
||||
@echo "Key Files:"
|
||||
@echo " src/@orb.yml - Main orb definition"
|
||||
@echo " src/@orb.yml - Main orb definition"
|
||||
@echo " target/qqq-orb-packed.yml - Packed orb (generated)"
|
||||
|
||||
# Pack the orb using the correct command for orb development
|
||||
pack:
|
||||
@python3 scripts/pack_pipeline.py
|
||||
@echo "Packing orb using 'circleci orb pack'..."
|
||||
@mkdir -p ./target/
|
||||
@circleci orb pack src > target/qqq-orb-packed.yml
|
||||
@@ -37,10 +40,59 @@ validate: pack
|
||||
test: validate
|
||||
@echo "✅ All tests passed!"
|
||||
|
||||
# Test scripts: run comprehensive tests for calculate_version.sh
|
||||
test-scripts:
|
||||
@echo "🧪 Running calculate_version.sh test suite..."
|
||||
@./tests/run_tests.sh --ci
|
||||
@echo "✅ Script tests passed!"
|
||||
|
||||
# Test all: run both orb tests and script tests
|
||||
test-all: test test-scripts test-pipelines
|
||||
@echo "🎉 All tests completed successfully!"
|
||||
|
||||
.PHONY: test-pipelines
|
||||
# PyYAML 6.0.3 is the same strict parser used by the setup job.
|
||||
test-pipelines: pack
|
||||
python3 tests/test_generate_pipeline.py --packed target/qqq-orb-packed.yml
|
||||
python3 tests/test_maven_ci_contract.py
|
||||
bash tests/test_cli_ci_behavior.sh
|
||||
python3 tests/test_cli_ci_contract.py
|
||||
python3 tests/test_standardize_qbit.py
|
||||
python3 tests/test_rollout_version.py
|
||||
python3 tests/test_validate_standard.py
|
||||
python3 tests/test_voyage_profile.py
|
||||
python3 tests/test_next_native.py
|
||||
python3 tests/test_auxiliary_workflows.py
|
||||
python3 tests/test_intellij_plugin.py
|
||||
python3 tests/test_workflow_lint.py
|
||||
python3 tests/test_business_e2e.py
|
||||
python3 tests/test_qctl_native.py
|
||||
python3 -m unittest discover -s tests -p test_generate_qctl_workflow.py
|
||||
python3 tests/test_rc_finalize_sweep.py
|
||||
python3 tests/test_rc_guard.py
|
||||
python3 -m unittest discover -s tests -p test_generate_rc_workflow.py
|
||||
python3 -m unittest discover -s tests -p test_audit_estate.py
|
||||
python3 tests/test_all_profiles.py
|
||||
python3 tests/test_generate_all_release.py
|
||||
python3 -m unittest discover -s tests -p 'test_qqq_all_release*.py'
|
||||
python3 tests/test_verify_all_circle_smoke.py
|
||||
python3 tests/test_mobile_policy_profiles.py
|
||||
bash tests/test_all_artifact.sh
|
||||
python3 tests/test_maven_ci_rc_completion.py
|
||||
bash tests/test_maven_ci_push.sh
|
||||
bash tests/test_create_github_release.sh
|
||||
bash tests/test_maven_ci_cache.sh
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
|
||||
# Clean up generated files
|
||||
clean:
|
||||
@echo "Cleaning up packed orb files..."
|
||||
@rm -rf target
|
||||
@echo "Cleaning up test data..."
|
||||
@rm -rf tests/test_data
|
||||
@echo "✅ Cleanup complete"
|
||||
|
||||
# Lint source files (same checks as CircleCI)
|
||||
@@ -53,13 +105,17 @@ lint:
|
||||
@echo ""
|
||||
@echo "2. Shell Script Linting (ShellCheck)..."
|
||||
@shellcheck src/scripts/*.sh
|
||||
@echo "✅ ShellCheck passed"
|
||||
@echo "✅ Source script ShellCheck passed"
|
||||
@echo ""
|
||||
@echo "3. CircleCI Orb Linting..."
|
||||
@echo "3. Test Script Linting (ShellCheck)..."
|
||||
@shellcheck tests/*.sh
|
||||
@echo "✅ Test script ShellCheck passed"
|
||||
@echo ""
|
||||
@echo "4. CircleCI Orb Linting..."
|
||||
@circleci orb validate src/@orb.yml
|
||||
@echo "✅ CircleCI orb validation passed"
|
||||
@echo ""
|
||||
@echo "4. Orb Packing Test..."
|
||||
@echo "5. Orb Packing Test..."
|
||||
@circleci orb pack src > /tmp/test-packed.yml
|
||||
@circleci orb validate /tmp/test-packed.yml
|
||||
@rm -f /tmp/test-packed.yml
|
||||
@@ -105,7 +161,7 @@ check-branch:
|
||||
fi
|
||||
|
||||
# Interactive snapshot release (dev:snapshot)
|
||||
publish-snapshot: check-clean lint validate
|
||||
publish-snapshot: check-clean lint clean dev test-all
|
||||
@echo "🚀 Publishing Snapshot Release"
|
||||
@echo ""
|
||||
@echo "This will publish to: kingsrook/qqq-orb@dev:snapshot"
|
||||
@@ -121,7 +177,7 @@ publish-snapshot: check-clean lint validate
|
||||
echo "✅ Snapshot published successfully!"
|
||||
|
||||
# Interactive production release (tagged version)
|
||||
publish-release: check-clean check-branch lint validate
|
||||
publish-release: check-clean check-branch lint clean dev test-all
|
||||
@echo "🚀 Publishing Production Release"
|
||||
@echo ""
|
||||
@echo "This will create a git tag and publish a production version."
|
||||
@@ -154,3 +210,9 @@ publish-release: check-clean check-branch lint validate
|
||||
echo "Pushing tag to remote..."; \
|
||||
git push origin "$$version"; \
|
||||
echo "✅ Production release $$version published successfully!"
|
||||
|
||||
.PHONY: test-publication-poms
|
||||
# Explicit integration gate: requires Java/Maven and public plugin downloads into
|
||||
# an isolated temporary repository. Never publishes or uses signing credentials.
|
||||
test-publication-poms:
|
||||
python3 tests/test_maven_publication_poms.py
|
||||
@@ -0,0 +1,6 @@
|
||||
QQQ CircleCI Orb
|
||||
Copyright 2022-2025 QRunIO, LLC
|
||||
|
||||
This product includes software developed at QRunIO, LLC (https://qrun.io/).
|
||||
|
||||
Licensed under the Apache License, Version 2.0.
|
||||
@@ -1,339 +1,144 @@
|
||||
# QQQ Orb
|
||||
# qqq-orb
|
||||
|
||||
[](https://circleci.com/developer/orbs/orb/kingsrook/qqq-orb)
|
||||
[](https://circleci.com/developer/orbs/orb/kingsrook/qqq-orb)
|
||||
[](LICENSE)
|
||||
CircleCI orb for QQQ framework projects.
|
||||
|
||||
> **CircleCI Orb for QQQ Framework Projects**
|
||||
For centralized pipeline ownership, see [standardized manifest-driven pipelines](docs/GENERATED-PIPELINES.md).
|
||||
The initial QBit profile uses a small `.qqq-ci.yml` and a setup entry point; existing direct job callers remain supported.
|
||||
|
||||
CircleCI orb for Maven and Node.js projects using GitFlow. Provides automated building, testing, version management, and publishing to Maven Central and npm registries.
|
||||
**For:** Teams using CircleCI to build, test, and publish QQQ applications
|
||||
**Status:** Stable (v0.6.x)
|
||||
|
||||
## 🚀 Overview
|
||||
## Why This Exists
|
||||
|
||||
QQQ Orb is a **CircleCI orb** that provides standardized CI/CD workflows for projects in the QQQ ecosystem. It handles the complete development lifecycle from building and testing to publishing releases.
|
||||
QQQ projects share common CI/CD patterns: build with Maven, run tests, publish to Maven Central or npm. Setting this up from scratch means duplicating workflow configuration across every repository.
|
||||
|
||||
### What This Repository Contains
|
||||
This orb provides pre-built jobs for the complete QQQ development lifecycle. Add a few lines of YAML and your project has automated testing, version management, and publishing.
|
||||
|
||||
- **CircleCI Orb**: Reusable CI/CD workflows and commands
|
||||
- **GitFlow Integration**: Automated branching and version management
|
||||
- **Multi-Platform Support**: Maven (Java) and npm (Node.js) project support
|
||||
- **Publishing Automation**: Automated publishing to Maven Central and npm
|
||||
- **Testing Framework**: Comprehensive testing with coverage reporting
|
||||
## Features
|
||||
|
||||
### What This Repository Does NOT Contain
|
||||
- **Maven and npm support** - Builds Java and Node.js projects
|
||||
- **Docker-native execution** - Machine executor with Docker pre-installed for Testcontainers/LocalStack
|
||||
- **GitFlow integration** - Automated versioning based on branch type
|
||||
- **Publishing automation** - Maven Central and npm registry publishing
|
||||
- **Test coverage** - JaCoCo integration with coverage reporting
|
||||
- **Version calculation** - Semantic versioning with SNAPSHOT, RC, and release support
|
||||
- **Java 21 default** - Temurin JDK with configurable version (17, 21)
|
||||
|
||||
- **QQQ Framework**: The actual low-code engine and backend
|
||||
- **Application Code**: Business logic or application-specific code
|
||||
- **Runtime Dependencies**: Libraries or frameworks used by applications
|
||||
## Quick Start
|
||||
|
||||
## 🏗️ Architecture
|
||||
|
||||
### Technology Stack
|
||||
|
||||
- **CircleCI Orbs**: Reusable configuration components
|
||||
- **GitFlow**: Branching strategy for release management
|
||||
- **Maven**: Java project build and dependency management
|
||||
- **npm**: Node.js package management
|
||||
- **Shell Scripts**: Automation and utility scripts
|
||||
- **YAML**: Configuration and workflow definitions
|
||||
|
||||
### Core Capabilities
|
||||
|
||||
- **Automated Building**: Maven and npm project compilation
|
||||
- **Testing**: Unit tests, integration tests, and coverage reporting
|
||||
- **Version Management**: Automated semantic versioning based on GitFlow
|
||||
- **Publishing**: Maven Central and npm registry publishing
|
||||
- **Documentation**: Automated documentation generation and publishing
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Using the Orb
|
||||
**Prerequisites:** CircleCI account, repository connected to CircleCI
|
||||
|
||||
```yaml
|
||||
# .circleci/config.yml
|
||||
version: 2.1
|
||||
orbs:
|
||||
qqq-orb: kingsrook/qqq-orb@2.1
|
||||
qqq-orb: kingsrook/qqq-orb@0.6
|
||||
|
||||
workflows:
|
||||
test_only:
|
||||
filters:
|
||||
branches:
|
||||
ignore: [develop, main, /release\/.*/, /hotfix\/.*/]
|
||||
build_and_test:
|
||||
jobs:
|
||||
- qqq-orb/build
|
||||
- qqq-orb/test:
|
||||
requires: [qqq-orb/build]
|
||||
- qqq-orb/mvn_test_only
|
||||
|
||||
publish_snapshot:
|
||||
filters: { branches: { only: develop } }
|
||||
when:
|
||||
equal: [develop, << pipeline.git.branch >>]
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: snapshot
|
||||
|
||||
publish_release_candidate:
|
||||
filters: { branches: { only: /release\/.*/ } }
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release_candidate
|
||||
|
||||
production_release:
|
||||
filters: { branches: { only: main } }
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release
|
||||
|
||||
hotfix_release:
|
||||
filters: { branches: { only: /hotfix\/.*/ } }
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: hotfix
|
||||
```
|
||||
|
||||
### Required Context
|
||||
## Usage
|
||||
|
||||
Set up `qqq-maven-registry-credentials` context in CircleCI:
|
||||
### Available Jobs
|
||||
|
||||
| Variable | Description | Required For |
|
||||
|----------|-------------|--------------|
|
||||
| `MAVEN_USERNAME` | Sonatype username | Maven publishing |
|
||||
| `MAVEN_PASSWORD` | Sonatype password | Maven publishing |
|
||||
| `GPG_PRIVATE_KEY_B64` | Base64 encoded GPG private key | Maven signing |
|
||||
| `GPG_KEYNAME` | GPG key identifier | Maven signing |
|
||||
| `GPG_PASSPHRASE` | GPG passphrase | Maven signing |
|
||||
| `GITHUB_TOKEN` | GitHub API token | GitHub releases |
|
||||
| `RDBMS_PASSWORD` | Database password | Integration testing |
|
||||
| Job | Purpose |
|
||||
|-----|---------|
|
||||
| `mvn_test_only` | Build and test Maven projects |
|
||||
| `mvn_publish` | Build, test, and publish Maven artifacts |
|
||||
| `mvn_frontend_test_only` | Build and test Maven projects with npm frontend |
|
||||
| `mvn_frontend_publish` | Build, test, and publish Maven projects with npm frontend |
|
||||
| `node_test_only` | Build and test Node.js projects |
|
||||
| `node_publish` | Build, test, and publish Node.js packages |
|
||||
| `static_analysis` | Run SpotBugs and PMD static analysis |
|
||||
| `security_scan` | Run Gitleaks, Semgrep, OWASP Dependency Check, and CycloneDX SBOM |
|
||||
|
||||
### Project Requirements
|
||||
### npm Trusted Publishing
|
||||
|
||||
- **Maven Projects**: `pom.xml` with `<revision>` property
|
||||
- **Node.js Projects**: `package.json` with version field
|
||||
- **Settings**: `/tmp/circleci/mvn-settings.xml` (auto-generated if missing)
|
||||
- **Documentation**: `docs/index.adoc` (optional, for documentation)
|
||||
For npm Trusted Publishing, set `npm_trusted_publishing: true` and use a supported
|
||||
executor such as `node_version: "24.21"` on `node_publish`. Configure the package's
|
||||
[npm Trusted Publisher](https://docs.npmjs.com/trusted-publishers/) for the exact
|
||||
CircleCI organization, project, pipeline definition and VCS origin, and allow
|
||||
direct `npm publish`. The job requires Node >=22.14.0 and npm >=11.5.1, obtains an
|
||||
OIDC identity at publish time, and does not run `npm whoami` or need `NPM_TOKEN`.
|
||||
Existing token authentication remains the default. Trusted mode requires no
|
||||
project `.npmrc` or npm credential/config-path environment settings; it ignores user/global
|
||||
npm config and clears conventional token variables to prevent token fallback.
|
||||
CircleCI does not currently provide npm provenance attestations. A successful
|
||||
real publication, not a dry run, verifies the trust relationship.
|
||||
|
||||
## 📁 Repository Structure
|
||||
### Branch Types
|
||||
|
||||
```
|
||||
src/
|
||||
├── @orb.yml # Main orb definition
|
||||
├── commands/ # Reusable commands
|
||||
│ ├── mvn_build.yml # Maven build command
|
||||
│ ├── mvn_verify.yml # Maven test and verify
|
||||
│ ├── mvn_jar_deploy.yml # Maven deployment
|
||||
│ ├── node_build_package.yml # Node.js build and package
|
||||
│ ├── node_publish.yml # npm publishing
|
||||
│ └── ... # Additional commands
|
||||
├── jobs/ # Complete workflow jobs
|
||||
│ ├── mvn_publish.yml # Maven publishing workflow
|
||||
│ ├── mvn_test_only.yml # Maven testing workflow
|
||||
│ ├── node_publish.yml # npm publishing workflow
|
||||
│ └── node_test_only.yml # npm testing workflow
|
||||
├── scripts/ # Shell scripts
|
||||
│ ├── calculate_version.sh # Version calculation
|
||||
│ ├── mvn_build_compile.sh # Maven compilation
|
||||
│ ├── node_npm_auth.sh # npm authentication
|
||||
│ └── ... # Additional scripts
|
||||
├── executors/ # Execution environments
|
||||
│ └── default.yml # Default executor configuration
|
||||
└── examples/ # Usage examples
|
||||
└── build.yml # Example configuration
|
||||
```
|
||||
| Branch | Version Format |
|
||||
|--------|----------------|
|
||||
| `develop` | `1.5.0-SNAPSHOT` |
|
||||
| `release/1.5` | `1.5.0-RC.1` |
|
||||
| `main` | `1.5.0` (requires tag) |
|
||||
| `hotfix/1.5.1` | `1.5.1` |
|
||||
| `feature/*` | `1.5.0-feature-abc1234-SNAPSHOT` |
|
||||
|
||||
## 🎯 Available Jobs
|
||||
### Java Version
|
||||
|
||||
| Job | Branch | Output | Description |
|
||||
|-----|--------|--------|-------------|
|
||||
| `build` | Any | Compiled artifacts | Build project without testing |
|
||||
| `test` | Any | Test results + JaCoCo | Run tests with coverage |
|
||||
| `publish` | Any | Published artifacts | Unified publishing based on branch_type |
|
||||
|
||||
### Publish Job Parameters
|
||||
|
||||
| Parameter | Type | Default | Description |
|
||||
|-----------|------|---------|-------------|
|
||||
| `branch_type` | string | "snapshot" | Branch type: snapshot, release_candidate, release, hotfix |
|
||||
|
||||
## 🔧 Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
```bash
|
||||
# Install CircleCI CLI
|
||||
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/main/install.sh | sudo bash
|
||||
|
||||
# Install linting tools (macOS)
|
||||
brew install shellcheck yamllint
|
||||
|
||||
# Install linting tools (Ubuntu/Debian)
|
||||
sudo apt-get install shellcheck yamllint
|
||||
```
|
||||
|
||||
### Development Commands
|
||||
|
||||
```bash
|
||||
make pack # Pack orb (resolves <<include()>>)
|
||||
make validate # Validate packed orb
|
||||
make lint # Run all linting checks
|
||||
make dev # Pack + validate
|
||||
make clean # Clean build artifacts
|
||||
```
|
||||
|
||||
### Publishing Commands
|
||||
|
||||
```bash
|
||||
make publish-snapshot # Publish as kingsrook/qqq-orb@dev:snapshot
|
||||
make publish-release # Publish as kingsrook/qqq-orb@X.Y.Z
|
||||
```
|
||||
|
||||
## 📋 Version Management
|
||||
|
||||
Automated version calculation based on GitFlow branches:
|
||||
|
||||
| Branch Pattern | Version Change | Example |
|
||||
|----------------|----------------|---------|
|
||||
| `develop` | Minor bump | `1.5.0-SNAPSHOT` → `1.6.0-SNAPSHOT` |
|
||||
| `release/1.5` | RC versions | `1.5.0-RC.1`, `1.5.0-RC.2`, ... |
|
||||
| `main` | Stable release | `1.5.0-RC.3` → `1.5.0` **requires v* tag** |
|
||||
| `hotfix/1.5.1` | Patch bump | `1.5.0` → `1.5.1` |
|
||||
|
||||
**Main branch requires release tags**:
|
||||
```bash
|
||||
git tag -a v1.5.0 -m "Release 1.5.0"
|
||||
git push origin v1.5.0
|
||||
```
|
||||
|
||||
## 🧪 Testing
|
||||
|
||||
### Running Tests
|
||||
|
||||
```bash
|
||||
# Run all tests
|
||||
make test
|
||||
|
||||
# Run linting checks
|
||||
make lint
|
||||
|
||||
# Validate orb configuration
|
||||
make validate
|
||||
```
|
||||
|
||||
### Test Coverage
|
||||
|
||||
The orb includes comprehensive testing:
|
||||
- **YAML Validation**: CircleCI orb configuration validation
|
||||
- **Shell Script Testing**: ShellCheck for shell script validation
|
||||
- **Orb Packing**: Tests orb packing and resolution
|
||||
- **Integration Testing**: End-to-end workflow testing
|
||||
|
||||
## 📦 Usage Examples
|
||||
|
||||
### Maven Project (Backend Only)
|
||||
Maven jobs run on Ubuntu machine executors with Temurin JDK. Default is Java 21. To use Java 17:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: snapshot
|
||||
- qqq-orb/mvn_test_only:
|
||||
java_version: "17"
|
||||
```
|
||||
|
||||
### Node.js Project (Frontend Only)
|
||||
### Docker Support
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release
|
||||
Maven jobs use machine executors with Docker pre-installed. Tests using Testcontainers, LocalStack, or other Docker-dependent frameworks work without additional configuration.
|
||||
|
||||
### Required Context Variables
|
||||
|
||||
| Variable | Purpose |
|
||||
|----------|---------|
|
||||
| `MAVEN_USERNAME` | Sonatype username |
|
||||
| `MAVEN_PASSWORD` | Sonatype password |
|
||||
| `GPG_PRIVATE_KEY_B64` | Base64-encoded GPG key |
|
||||
| `GPG_KEYNAME` | GPG key ID |
|
||||
| `GPG_PASSPHRASE` | GPG passphrase |
|
||||
| `GITHUB_TOKEN` | GitHub API token |
|
||||
|
||||
## Orb Publishing
|
||||
|
||||
The orb auto-publishes via CircleCI:
|
||||
|
||||
| Branch | Action |
|
||||
|--------|--------|
|
||||
| `develop` | Publishes `kingsrook/qqq-orb@dev:snapshot` |
|
||||
| `main` | Auto-increments version and publishes production release |
|
||||
| `vX.Y.Z` tag | Manual production release (legacy) |
|
||||
|
||||
Version bumps on main default to patch. Include `[minor]` or `[major]` in a commit message to bump accordingly.
|
||||
|
||||
## Project Status
|
||||
|
||||
**Maturity:** Stable, used across all QQQ repositories
|
||||
**Breaking changes:** See [CHANGELOG.md](CHANGELOG.md)
|
||||
|
||||
## Contributing
|
||||
|
||||
```bash
|
||||
git clone git@github.com:QRun-IO/qqq-orb.git
|
||||
cd qqq-orb
|
||||
make test-all
|
||||
```
|
||||
|
||||
### Hybrid Project (Maven + Node.js)
|
||||
See [QQQ Contribution Guidelines](https://github.com/Kingsrook/qqq/blob/develop/CONTRIBUTING.md).
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
- qqq-orb/publish:
|
||||
context: qqq-maven-registry-credentials
|
||||
branch_type: release_candidate
|
||||
```
|
||||
## License
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
**Important**: This repository is a component of the QQQ framework. All contributions, issues, and discussions should go through the main QQQ repository.
|
||||
|
||||
### Development Workflow
|
||||
|
||||
1. **Fork the main QQQ repository**: https://github.com/Kingsrook/qqq
|
||||
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
|
||||
3. **Make your changes** (including orb changes if applicable)
|
||||
4. **Run tests**: `make test`
|
||||
5. **Commit your changes**: `git commit -m 'Add amazing feature'`
|
||||
6. **Push to the branch**: `git push origin feature/amazing-feature`
|
||||
7. **Open a Pull Request** to the main QQQ repository
|
||||
|
||||
### Code Standards
|
||||
|
||||
- **YAML**: Follow CircleCI orb best practices
|
||||
- **Shell Scripts**: Use ShellCheck for validation
|
||||
- **Documentation**: Update README and inline documentation
|
||||
- **Testing**: Comprehensive test coverage
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
```
|
||||
QQQ Orb
|
||||
Copyright (C) 2021-2024 Kingsrook, LLC
|
||||
651 N Broad St Ste 205 # 6917 | Middletown DE 19709 | United States
|
||||
contact@kingsrook.com | https://github.com/Kingsrook/
|
||||
```
|
||||
|
||||
## 🆘 Support & Community
|
||||
|
||||
### ⚠️ Important: Use Main QQQ Repository
|
||||
|
||||
**All support, issues, discussions, and community interactions should go through the main QQQ repository:**
|
||||
|
||||
- **Main Repository**: https://github.com/Kingsrook/qqq
|
||||
- **Issues**: https://github.com/Kingsrook/qqq/issues
|
||||
- **Discussions**: https://github.com/Kingsrook/qqq/discussions
|
||||
- **Wiki**: https://github.com/Kingsrook/qqq/wiki
|
||||
|
||||
### Why This Repository Exists
|
||||
|
||||
This repository is maintained separately from the main QQQ repository to:
|
||||
- **Enable independent orb development** and versioning
|
||||
- **Allow orb-specific CI/CD** and deployment pipelines
|
||||
- **Provide clear separation** between orb and framework concerns
|
||||
- **Support different release cycles** for CI/CD tools vs. core framework
|
||||
|
||||
### Getting Help
|
||||
|
||||
- **Documentation**: Check the [QQQ Wiki](https://github.com/Kingsrook/qqq/wiki)
|
||||
- **Issues**: Report bugs and feature requests on [Main QQQ Issues](https://github.com/Kingsrook/qqq/issues)
|
||||
- **Discussions**: Join community discussions on [Main QQQ Discussions](https://github.com/Kingsrook/qqq/discussions)
|
||||
- **Questions**: Ask questions in the main QQQ repository
|
||||
|
||||
### Contact Information
|
||||
|
||||
- **Company**: Kingsrook, LLC
|
||||
- **Email**: contact@kingsrook.com
|
||||
- **Website**: https://qrun.io
|
||||
- **Main GitHub**: https://github.com/Kingsrook/qqq
|
||||
- **CircleCI Registry**: [kingsrook/qqq-orb](https://circleci.com/developer/orbs/orb/kingsrook/qqq-orb)
|
||||
|
||||
## 🙏 Acknowledgments
|
||||
|
||||
- **CircleCI Team**: For the excellent CI/CD platform and orb system
|
||||
- **Maven Team**: For the powerful Java build system
|
||||
- **npm Team**: For the Node.js package management system
|
||||
- **QQQ Framework Team**: For the underlying low-code platform
|
||||
- **Open Source Community**: For the tools and libraries that make this possible
|
||||
|
||||
---
|
||||
|
||||
**Built with ❤️ by the Kingsrook Team**
|
||||
|
||||
**This is a CI/CD component of the QQQ framework. For complete information, support, and community, visit: https://github.com/Kingsrook/qqq**
|
||||
Apache-2.0
|
||||
+2
-111
@@ -1,112 +1,3 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
QQQ Orb follows semantic versioning and provides security updates for the following versions:
|
||||
|
||||
| Version | Supported | End of Life |
|
||||
| ------- | ------------------ | ----------- |
|
||||
| 2.1.x | :white_check_mark: | TBD |
|
||||
| 2.0.x | :white_check_mark: | TBD |
|
||||
| 1.x.x | :white_check_mark: | TBD |
|
||||
| < 1.0 | :x: | EOL |
|
||||
|
||||
**Note**: We recommend using the latest stable version for security updates.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
**🚨 Security vulnerabilities should NEVER be reported publicly.**
|
||||
|
||||
If you discover a security vulnerability in QQQ Orb, please report it privately:
|
||||
|
||||
### **Email Security Reports**
|
||||
Send security reports to: **security@kingsrook.com**
|
||||
|
||||
### **What to Include**
|
||||
- **Description**: Clear description of the vulnerability
|
||||
- **Impact**: Potential impact on users and CI/CD systems
|
||||
- **Reproduction**: Steps to reproduce the issue
|
||||
- **Environment**: QQQ Orb version, CircleCI version, OS details
|
||||
- **Timeline**: If you need disclosure by a specific date
|
||||
|
||||
### **Response Timeline**
|
||||
- **Initial Response**: Within 24 hours
|
||||
- **Assessment**: Within 3 business days
|
||||
- **Update**: Regular updates on progress
|
||||
- **Resolution**: As quickly as possible based on severity
|
||||
|
||||
### **What Happens Next**
|
||||
1. **Acknowledgment**: We'll acknowledge receipt within 24 hours
|
||||
2. **Investigation**: Our security team will investigate the report
|
||||
3. **Assessment**: We'll assess the severity and impact
|
||||
4. **Fix Development**: Develop and test a security fix
|
||||
5. **Release**: Release a security update
|
||||
6. **Disclosure**: Public disclosure with credit (if requested)
|
||||
|
||||
## Security Best Practices
|
||||
|
||||
### **For Users**
|
||||
- **Keep Updated**: Always use the latest stable version
|
||||
- **Monitor Releases**: Watch for security advisories
|
||||
- **Report Issues**: Report any security concerns immediately
|
||||
- **Follow Guidelines**: Use QQQ Orb according to security best practices
|
||||
- **Secure Contexts**: Ensure CircleCI contexts contain only necessary secrets
|
||||
|
||||
### **For Contributors**
|
||||
- **Security Review**: All code changes undergo security review
|
||||
- **Dependency Scanning**: Regular vulnerability scanning of dependencies
|
||||
- **Secure Development**: Follow secure coding practices
|
||||
- **Testing**: Security testing is part of our development process
|
||||
- **Secret Management**: Never commit secrets or credentials
|
||||
|
||||
## Security Features
|
||||
|
||||
QQQ Orb includes several security features:
|
||||
|
||||
- **Input Validation**: Comprehensive input validation and sanitization
|
||||
- **Secret Management**: Secure handling of CI/CD secrets and credentials
|
||||
- **Audit Logging**: Comprehensive audit trails for CI/CD events
|
||||
- **Secure Defaults**: Secure-by-default configuration
|
||||
- **Dependency Scanning**: Regular scanning of orb dependencies
|
||||
|
||||
## Security Updates
|
||||
|
||||
### **Release Process**
|
||||
Security updates follow our standard [Release Flow](https://github.com/Kingsrook/qqq/wiki/Release-Flow):
|
||||
|
||||
1. **Security Fix**: Develop and test security fix
|
||||
2. **Release Branch**: Create release branch for security update
|
||||
3. **Testing**: Thorough testing of security fix
|
||||
4. **Release**: Release security update to users
|
||||
5. **Communication**: Notify users of security update
|
||||
|
||||
### **Update Notifications**
|
||||
- **GitHub Releases**: Security updates announced in release notes
|
||||
- **Security Advisories**: GitHub security advisories for critical issues
|
||||
- **Email Notifications**: Direct notifications for critical vulnerabilities
|
||||
- **CircleCI Registry**: Updated orb versions in CircleCI registry
|
||||
|
||||
## CI/CD Security Considerations
|
||||
|
||||
### **CircleCI Context Security**
|
||||
- **Minimal Permissions**: Use least-privilege access for contexts
|
||||
- **Secret Rotation**: Regularly rotate secrets and credentials
|
||||
- **Access Control**: Limit access to sensitive contexts
|
||||
- **Audit Logs**: Monitor context usage and access
|
||||
|
||||
### **Orb Security**
|
||||
- **Version Pinning**: Always pin specific orb versions
|
||||
- **Source Verification**: Verify orb source and integrity
|
||||
- **Regular Updates**: Keep orb versions up to date
|
||||
- **Security Scanning**: Scan orb dependencies regularly
|
||||
|
||||
## Contact Information
|
||||
|
||||
- **Security Email**: security@kingsrook.com
|
||||
- **General Contact**: contact@kingsrook.com
|
||||
- **Company**: Kingsrook, LLC
|
||||
- **Website**: https://qrun.io
|
||||
|
||||
---
|
||||
|
||||
**Thank you for helping keep QQQ Orb secure!** 🛡️
|
||||
|
||||
* See Project [Security Policy](https://github.com/Kingsrook/qqq/blob/develop/SECURITY.md)
|
||||
@@ -0,0 +1,37 @@
|
||||
# qqq-all manual release caller
|
||||
|
||||
Generate the tiny caller at the existing consumer path `.github/workflows/release.yml`:
|
||||
|
||||
```sh
|
||||
python src/scripts/generate_auxiliary_workflow.py all-release --ref <IMMUTABLE40SHA>
|
||||
```
|
||||
|
||||
No consumer files or workflow settings are changed by this patch. The immutable baseline
|
||||
is qqq-all `e35f1f6b99639eb998340f082fab89c7ac12426c`. The caller is manual-only, retaining
|
||||
its original name, version choice/default (`4.1.0` or `4.1.0-RC.1`) and required release SHA.
|
||||
No push, tag or scheduled release is introduced.
|
||||
|
||||
All five worker inputs are forwarded as inputs: `version`, `release_sha`, `smoke_run_id`,
|
||||
`smoke_evidence`, `circle_workflow_id`. Evidence defaults to `github`. The old required
|
||||
Smoke run field becomes optional in the dispatch form solely so Circle mode can omit it;
|
||||
the worker still requires a numeric Smoke run ID in GitHub mode and independently verifies
|
||||
it. Circle mode requires the exact successful workflow UUID, API-verified provenance,
|
||||
matching receipt and existing optional `CIRCLECI_TOKEN`. Missing evidence fails closed.
|
||||
|
||||
Original contents/packages write and actions read permissions remain; checks read is added
|
||||
for the central Circle-check validator. Only the optional existing Circle secret is mapped
|
||||
explicitly; Actions supplies the native GitHub token. No secret values or script inputs
|
||||
are added.
|
||||
|
||||
The protected `qqq-all-release` environment, enabled/license variables, exact version/tag,
|
||||
develop SHA, public artifacts/GHCR, independent cold verification and publication rechecks
|
||||
remain in the worker. Its concurrency group is the sole owner, avoiding caller/worker
|
||||
collision. Generation does not approve the environment or bypass central gates. Hosted
|
||||
approval/publication and token access remain unproven until an authorized release run.
|
||||
|
||||
```sh
|
||||
python3 -m unittest discover -s tests -p test_generate_all_release.py -v
|
||||
```
|
||||
|
||||
Root must actionlint the generated caller and worker. Legacy orchestration stays until the
|
||||
pinned worker and consumer evidence adapter are available and relevant tests pass.
|
||||
@@ -0,0 +1,42 @@
|
||||
# Business-platform E2E ownership
|
||||
|
||||
The reusable `.github/workflows/business-e2e.yml` preserves the exact audited jobs
|
||||
from `QRun-IO/qqq-business-platform` commit `8af799fce97e972f81f195df969d79a959f71dbc`,
|
||||
including actual Compose services, blocking Playwright tests, deployment dependency,
|
||||
alerts, summaries, artifacts, failure logs and unconditional cleanup. Tool versions
|
||||
and environment values are unchanged. The optional existing alert secret is declared
|
||||
and forwarded explicitly. No new credential is introduced.
|
||||
|
||||
The tiny caller is generated with:
|
||||
|
||||
```sh
|
||||
python src/scripts/generate_auxiliary_workflow.py business-e2e --ref <IMMUTABLE40SHA>
|
||||
```
|
||||
|
||||
It belongs at the SAME consumer path `.github/workflows/e2e.yml`. Events, schedule,
|
||||
manual dispatch and read permission remain identical. The caller owns the existing
|
||||
concurrency group; the worker has no second copy that could cancel its own caller.
|
||||
The worker is `workflow_call` only and cannot run its own schedule.
|
||||
|
||||
## Disabled coverage stays disabled
|
||||
|
||||
The existing consumer workflow is `disabled_inactivity`, as reported by the release
|
||||
owner. This source extraction does not enable, trigger, dispatch or alter settings.
|
||||
Before and after any later caller replacement, read back that same workflow ID/path
|
||||
and state; stop if disabled status changed. Do not call an enable API, rename the
|
||||
workflow path, or treat a source-only PR as coverage restoration. Any intentional
|
||||
reactivation is a separate authorized operation requiring working live-service proof.
|
||||
|
||||
This centralizes code ownership; disabled E2E coverage remains an explicit limitation.
|
||||
Likewise, `tools/no-ci-policy.json` records audited CI absence, not product readiness,
|
||||
quality approval or a claim that tests have passed.
|
||||
|
||||
Local contract tests compare every job/step to an immutable fixture and verify events,
|
||||
permissions, explicit secret mapping, pinned worker and concurrency ownership:
|
||||
|
||||
```sh
|
||||
python3 -m unittest discover -s tests -p test_business_e2e.py -v
|
||||
actionlint .github/workflows/business-e2e.yml
|
||||
```
|
||||
|
||||
Hosted E2E success is not claimed. Consumer/settings changes are outside this patch.
|
||||
@@ -0,0 +1,93 @@
|
||||
# Estate audit policy
|
||||
|
||||
`tools/audit_estate.py` classifies repositories from explicit mappings and observed source.
|
||||
It never changes consumers, branch rules or publication settings.
|
||||
|
||||
- Circle profiles include android, mcp-policy and marketing. Their manifest and canonical
|
||||
setup caller remain mandatory; a missing configuration is a finding.
|
||||
- MCP, business-platform and the organization `.github` repository use approved native
|
||||
bridges from `src/scripts/templates/auxiliary-bridges.json`. Unknown remaining workflows
|
||||
are findings. Legacy Circle configuration remains a finding until retired after equivalent
|
||||
native checks pass on the actual consumer head. Business E2E is not implicitly approved.
|
||||
- `qqq-orb` is the owner/bootstrap exception, not a consumer of itself. Audit requires its
|
||||
lint/pack/review/ShellCheck graph and continuation dependencies, executable command and
|
||||
pipeline-contract test jobs, and develop/main publishers gated by those tests. Both
|
||||
publishers must pack, validate and publish. This structural check is not hosted proof.
|
||||
- `tools/no-ci-policy.json` approves exactly nine named repositories with rationale,
|
||||
immutable baseline SHA and required identity paths. Their approved state has no Circle,
|
||||
Actions, manifest, Jenkins or GitLab entrypoint at the declared paths. A new workflow or
|
||||
missing identity path is drift; an unknown repository never inherits this exemption.
|
||||
Baseline SHA records audit provenance, not a requirement to freeze documentation forever.
|
||||
|
||||
`managed_branches` is an explicit, nonempty unique list of `main` and/or `develop`,
|
||||
provided only after branch inventory readback. Its default is both for compatibility.
|
||||
The auditor queries only listed branches. A missing policy remains unknown; an API
|
||||
403/404 does not prove a branch is absent and remains unknown. A policy entry alone
|
||||
never proves a branch exists: successful `Snapshot.checks` first reads the branch.
|
||||
|
||||
Only the exact approved no-CI repositories may declare an empty expected context list.
|
||||
They pass that check only after successful readback returns an actually empty set.
|
||||
Stale required contexts are findings. Ordinary, native and owner profiles still reject
|
||||
empty context policies. No-CI classification documents absence, not product readiness.
|
||||
|
||||
Required-check policy is independent of classification. Without an explicit observed
|
||||
context policy and successful branch-rule readback, check status stays `unknown`, including
|
||||
no-CI and bootstrap repositories. No classification fabricates a passing merge check.
|
||||
|
||||
## Organization workflow lint bridge
|
||||
|
||||
Generate only after the worker is published at an immutable commit:
|
||||
|
||||
```sh
|
||||
python src/scripts/generate_auxiliary_workflow.py github-workflow-lint --ref <40SHA>
|
||||
```
|
||||
|
||||
The output belongs at `.github/workflows/workflow-lint.yml` in `QRun-IO/.github`.
|
||||
The orb owns `.github/workflows/workflow-lint.yml` as a reusable worker. It retains the
|
||||
original Circle `cimg/go:1.24` image and exact actionlint v1.7.7 command over
|
||||
`.github/workflows/*.yml`, with checkout and read-only contents permission. Branch pushes
|
||||
run lint; fork PRs also run it without secrets. Same-repository PR events do not duplicate
|
||||
push lint, and tags do not add new builds. Manual dispatch is available for verification.
|
||||
|
||||
Keep the existing Circle actionlint pipeline and legacy RC worker until a hosted native
|
||||
canary proves tool/runtime equivalence and the required-check migration is reviewed.
|
||||
Do not remove the old RC coordinator while any consumer still references it.
|
||||
|
||||
## Checks
|
||||
|
||||
```sh
|
||||
python3 -m unittest discover -s tests -p test_audit_estate.py -v
|
||||
python3 -m unittest discover -s tests -p test_workflow_lint.py -v
|
||||
python3 -m unittest discover -s tests -p test_auxiliary_workflows.py -v
|
||||
actionlint .github/workflows/workflow-lint.yml
|
||||
```
|
||||
|
||||
Tests cover exact no-CI allowlists and drift, unknown repositories, missing configured
|
||||
profiles/native bridges, retained legacy workflows, bootstrap dependency/gate removal,
|
||||
required-check unknown states, and the lint image/tool/command/caller contract.
|
||||
|
||||
## Batch orb-version rollout
|
||||
|
||||
Upgrade existing canonical CircleCI consumers with one command:
|
||||
|
||||
```sh
|
||||
python tools/rollout_version.py --orb-version 0.7.11 /checkouts/qbit-one /checkouts/qqq-cli
|
||||
python tools/rollout_version.py --orb-version 0.7.11 --write /checkouts/qbit-one /checkouts/qqq-cli
|
||||
```
|
||||
|
||||
The first command previews the batch. The second updates only `.qqq-ci.yml` and
|
||||
`.circleci/config.yml`, after every supplied checkout passes the existing manifest
|
||||
and canonical-caller validators. It preserves publication opt-outs, release filters,
|
||||
credential context names and forwarded profile parameters. Already-current files
|
||||
are unchanged. Duplicate checkouts, custom jobs, invalid options and mismatched
|
||||
pins reject the batch before writing; resolve these in the central profile first.
|
||||
|
||||
Use isolated checkouts of the intended repository heads, inspect the resulting
|
||||
patches, then commit and push through the normal automated gates. The tool does not
|
||||
commit, push, publish packages, change GitHub rules or modify native/RC worker pins.
|
||||
A version update does not prove a publication succeeded: retain exact-head hosted
|
||||
verification and artifact evidence. The requested version must already be published.
|
||||
|
||||
```sh
|
||||
python3 -m unittest discover -s tests -p test_rollout_version.py
|
||||
```
|
||||
@@ -0,0 +1,224 @@
|
||||
# Standardized QQQ pipelines
|
||||
|
||||
The orb owns workflow selection and job configuration. A consumer declares a
|
||||
small manifest; it does not copy pipeline jobs. The initial supported profile is
|
||||
`qbit`; `core` owns the framework's complete acceptance/release graph. Frontend
|
||||
and CLI profiles described below retain their own publication contracts. Additional
|
||||
profiles belong in reviewed `PROFILE_TEMPLATES` renderers in
|
||||
`src/scripts/generate_pipeline.py`, with profile-specific schema and tests. There
|
||||
is no arbitrary script or job-YAML passthrough.
|
||||
|
||||
Use the same **published** orb version in all three positions below. `0.7.0` is
|
||||
an illustrative version, not a claim that this change is published. A development
|
||||
orb version can be used for a controlled canary.
|
||||
|
||||
`.circleci/config.yml`:
|
||||
|
||||
```yaml
|
||||
version: 2.1
|
||||
setup: true
|
||||
orbs:
|
||||
qqq-orb: kingsrook/qqq-orb@0.7.0
|
||||
workflows:
|
||||
setup:
|
||||
jobs:
|
||||
- qqq-orb/generate_pipeline:
|
||||
orb_version: "0.7.0"
|
||||
filters:
|
||||
branches:
|
||||
ignore: automation/qbit-rc-pending
|
||||
tags:
|
||||
only: /.*/
|
||||
```
|
||||
|
||||
`.qqq-ci.yml`:
|
||||
|
||||
```yaml
|
||||
profile: qbit
|
||||
orb_version: "0.7.0"
|
||||
default_branch: develop
|
||||
java_version: "21"
|
||||
browsers: false
|
||||
api_checks: false
|
||||
docs_only: false
|
||||
publish:
|
||||
snapshot: true
|
||||
release_candidate: true
|
||||
release: true
|
||||
asciidoc: false
|
||||
```
|
||||
|
||||
Only `profile`, `orb_version` and `default_branch` are required. `default_branch`
|
||||
must be `develop` or `main`; Java must be the string `17` or `21`. Browsers default
|
||||
to **true** for compatibility: opt out only after verifying that the consumer has
|
||||
no browser tests. API checks and docs-only default to false. Publication defaults
|
||||
to true for snapshots, RCs and tagged releases; AsciiDoc publication defaults to
|
||||
false. Unknown/duplicate keys, unexpected types, unsupported profiles and a setup
|
||||
parameter/manifest version mismatch fail before continuation. The canonical-caller
|
||||
validator also verifies the setup import, filters and profile-specific parameter
|
||||
declarations; additional jobs, commands, workflows or orbs fail validation. The
|
||||
parser is pinned to PyYAML 6.0.3 and uses its safe loader.
|
||||
|
||||
| Event | Workflow | Job contract |
|
||||
| --- | --- | --- |
|
||||
| develop | publish_snapshot | existing mvn_publish, snapshot |
|
||||
| release/* | publish_release_candidate | existing mvn_publish, release_candidate |
|
||||
| vX.Y.Z tag resolving to the checkout | publish_release | existing mvn_publish, release |
|
||||
| main, feature/*, hotfix/*, other/unknown branch | test_only | existing mvn_test_only |
|
||||
| Disabled publication or unrecognized/unproven tag | test_only | full verification, no publication |
|
||||
|
||||
The pipeline SHA must match the checkout when Circle supplies it. A tagged release
|
||||
must resolve to that checkout; missing local tags are fetched individually. A main
|
||||
push does **not** publish a release. Migrating a legacy main-publishing consumer
|
||||
therefore requires explicit review of its release contract. Existing direct orb
|
||||
callers remain supported.
|
||||
|
||||
The setup filter and generated jobs exclude `automation/qbit-rc-pending`, the
|
||||
shared RC orchestrator's persistent release lock. Lock updates must not trigger
|
||||
Maven test or publication work.
|
||||
|
||||
The shared jobs keep the `qqq-maven-registry-credentials` context, complete verify,
|
||||
coverage and configured API checks. Publishing retains version management, signed
|
||||
artifact deployment, Git operations and release handling. Generated calls disable
|
||||
the redundant preliminary compile; they do not skip tests or verification. Existing
|
||||
callers retain the compatibility defaults in the jobs.
|
||||
|
||||
## Core profile
|
||||
|
||||
QBit alone accepts `release_completion: true` (default false). It enables the
|
||||
shared Maven RC job's `notify_rc_published` only for RC publication, including
|
||||
fail-closed verification that the bumped version was pushed before dispatching
|
||||
the completion event. Enable this on a consumer only after its default branch
|
||||
contains the shared completion caller. Snapshot and GA jobs never receive this
|
||||
opt-in; other profiles reject the key.
|
||||
|
||||
Use `profile: core` for the QQQ framework. The orb owns the complete baseline
|
||||
acceptance, broker conformance, cold bootstrap, coverage, diagnostics, static
|
||||
analysis and publication graph. Core scripts remain in the core source repository.
|
||||
The independent baseline fixture pins job sets, dependency edges, contexts,
|
||||
coverage requirements and actual verification commands across all six workflows.
|
||||
|
||||
Core additionally supports `publish.feature` and `publish.hotfix` (both true by
|
||||
default), preserving `publish*` tag and hotfix branch publication. QBit does not
|
||||
accept these keys. Snapshot, RC and GA behavior remains distinct; RC/GA/hotfix
|
||||
publication still requires the complete source coverage gate. Cold bootstrap and
|
||||
fresh consumer Maven repositories remain uncached. Shared installer policy replaces
|
||||
local package preparation; preliminary compilation is disabled before clean
|
||||
lifecycles and the dependency cache is saved after successful verification.
|
||||
|
||||
Lambda XML copies remain in sample coverage evidence. The sample JUnit collector
|
||||
excludes those two copied reports because their original module directories are
|
||||
already uploaded, avoiding duplicate test identities without dropping evidence.
|
||||
|
||||
External core API triggers require these declarations in the tiny **setup** config:
|
||||
|
||||
```yaml
|
||||
parameters:
|
||||
mongo_bind_diagnostics:
|
||||
type: boolean
|
||||
default: false
|
||||
next_acceptance_bundle_url:
|
||||
type: string
|
||||
default: ""
|
||||
next_acceptance_bundle_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
next_acceptance_receipt_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
```
|
||||
|
||||
Forward each value on `qqq-orb/generate_pipeline`, for example
|
||||
`mongo_bind_diagnostics: << pipeline.parameters.mongo_bind_diagnostics >>`, and
|
||||
likewise for the three bundle parameters. Requested values become defaults in the
|
||||
continued configuration; the continuation POST deliberately omits `parameters` to
|
||||
avoid CircleCI's setup/continuation/API parameter conflict. Verify both default and
|
||||
explicit API-triggered parameter values in the hosted canary before migrating
|
||||
triggering consumers. Other profiles reject non-default core parameters.
|
||||
|
||||
## Frontend profiles
|
||||
|
||||
`frontend-material` preserves the Maven frontend build/test/package/publication
|
||||
jobs, Java21/Node20 defaults, registry context, feature-tag, RC, GA and hotfix
|
||||
contracts. Declare setup pipeline parameter `run_playwright` (boolean, default
|
||||
false) and forward `run_playwright: << pipeline.parameters.run_playwright >>` on
|
||||
the generator job. Test/snapshot events select exactly one base or Playwright graph,
|
||||
so enabling visual tests cannot publish twice. Visual testing retains the pinned
|
||||
Playwright image, npm ci with legacy peer dependencies and report uploads; only
|
||||
npm downloads (`~/.npm`) are cached, never node_modules.
|
||||
|
||||
`frontend-core` preserves Node24.21, npm trusted publishing and both existing
|
||||
registry/build-sample contexts. Unlike QBit, its existing main-push **and v-tag**
|
||||
release contract remains intentional. Both frontend profiles support explicit
|
||||
numeric-string `node_version` and publication toggles including feature/hotfix.
|
||||
Material also supports `java_version`. Browser/API/AsciiDoc flags are rejected
|
||||
rather than silently ignored on these profiles. Existing direct jobs remain usable.
|
||||
|
||||
## CLI profile
|
||||
|
||||
`cli` owns npm install, generated-client drift, build, unit tests and the real
|
||||
Prism smoke contract through `cli_verify_publish`. Publication is **disabled by
|
||||
default**. To enable the existing v-tag publication, declare `publish.release:
|
||||
true` plus `publish_context: VERIFIED_CONTEXT_NAME`, after verifying that an
|
||||
existing trusted CircleCI context grants the required GitHub Packages permission.
|
||||
No context name or credential availability is inferred from the former Actions
|
||||
GITHUB_TOKEN. A tag must resolve to the current checkout; the job additionally
|
||||
checks the client version before publishing its three fixed workspaces with the
|
||||
existing rc dist-tag. Main pushes never publish. CLI docs-only is currently
|
||||
rejected because generated-client verification remains mandatory.
|
||||
|
||||
## Conservative documentation routing
|
||||
|
||||
With `docs_only: true`, only feature/hotfix and main changes can take the light
|
||||
route. Feature/hotfix branches fetch the declared default branch without tags and
|
||||
compare its merge base with HEAD, covering the whole branch. Main compares its first
|
||||
parent. Develop, release branches and all tags remain full. Shallow repositories,
|
||||
missing ancestry, fetch/diff errors, empty diffs and unknown paths remain full.
|
||||
|
||||
Only root README.md, CHANGELOG.md, CONTRIBUTING.md and Markdown files below docs/
|
||||
are eligible. Renames are treated as deletion plus addition, so moving code into
|
||||
docs cannot hide it. The lightweight job checks whitespace over the proven diff;
|
||||
manifest validation already ran in setup. It adds no new security scanner and
|
||||
makes no security-scanning claim. Keep docs-only disabled if those paths are build
|
||||
inputs or packaged application content.
|
||||
|
||||
The light route keeps workflow `test_only` and names its job
|
||||
`qqq-orb/mvn_test_only`. Verify actual CircleCI/GitHub status contexts on the canary
|
||||
before changing any protection rule; workflow/job identity alone is not proof of
|
||||
the hosted context name. Current protections must not be removed speculatively.
|
||||
|
||||
## Implementation and verification
|
||||
|
||||
The setup job checks out source, installs the pinned parser, runs the embedded
|
||||
Python resource and invokes CircleCI's native continuation API once. JSON output
|
||||
is valid CircleCI configuration YAML; it is saved at
|
||||
`/tmp/qqq-generated-config.json`. No external framework or per-consumer generator
|
||||
installation is required. Readable templates live in src/scripts/templates. scripts/pack_pipeline.py embeds
|
||||
them as base64 into packed_generate_pipeline.py before orb packing, preventing
|
||||
CircleCI from interpolating template expressions during setup. The orb includes
|
||||
the complete generated resource; no runtime source-tree template access is needed.
|
||||
make pack regenerates it and CI rejects a stale generated resource.
|
||||
Continuation credentials and response bodies are never printed.
|
||||
|
||||
Run `make test-pipelines` with CircleCI CLI, Python3/PyYAML and Bash available.
|
||||
Tests use offline temporary Git repositories and a bare origin to cover selection,
|
||||
whole-branch changes, tags, errors, defaults and source/packed parity. The hosted
|
||||
pipeline-contract-test runs the source suite and shared Maven behavioral tests;
|
||||
the full local target additionally extracts and executes the actual packed command.
|
||||
|
||||
## Android and MCP policy profiles
|
||||
|
||||
`android` and `mcp-policy` accept only profile, orb_version and default_branch.
|
||||
Android retains the audited Android/GCP orb versions and every active unit,
|
||||
emulator and Maven-publication step. The emulator now runs on main as well as
|
||||
feature branches so main publication cannot omit its required instrumentation
|
||||
gate. Dormant Firebase benchmark and release-build definitions referencing absent
|
||||
app/macrobenchmark modules are not scheduled or copied into the profile.
|
||||
|
||||
MCP policy validation remains a small Python container validating all visible YAML
|
||||
and required pattern fields. Its existing PyYAML dependency is pinned to 6.0.3.
|
||||
Neither profile introduces Maven/JUnit stand-ins for its actual tests.
|
||||
|
||||
`tests/test_mobile_policy_profiles.py` protects Android steps and dependency edges
|
||||
and executes the policy validator with valid, incomplete and malformed documents.
|
||||
The generator suite verifies source/packed parity for both profiles.
|
||||
@@ -0,0 +1,41 @@
|
||||
# Marketing pipeline ownership
|
||||
|
||||
The `marketing` profile accepts only `profile`, `orb_version`, and
|
||||
`default_branch: main`. The QQQ version must match the setup caller's explicit
|
||||
orb version. The canonical QQQ setup produces one final continuation containing
|
||||
jobs from the pinned `kof22/munitor@0.3.11` orb. It never invokes Munitor's setup
|
||||
generator or creates another continuation.
|
||||
|
||||
The profile is the exact semantic graph rendered by Munitor 0.3.11 from
|
||||
marketing-website commit `4eb5f63b9fbfac8e5529fcd638324870cea08ae2`, with its
|
||||
manifest's floating `0.3` pin changed to `0.3.11` for the baseline render.
|
||||
The checked-in fixture records that real render; the JSON resource contains the
|
||||
same jobs, parameters, contexts, filters and dependency edges.
|
||||
|
||||
There are five workflows and 33 job invocations: PR checks (7), develop (7),
|
||||
staging (7), release candidate (8), and production (4). They preserve Node 22,
|
||||
Chromium Playwright and Lighthouse, the existing scan and quality jobs, advisory
|
||||
SAST, and the existing synthetic zero-threshold coverage command. That command
|
||||
does not measure actual coverage.
|
||||
|
||||
Production follows build → image build/Trivy/push/health → independent CD update
|
||||
and GitHub release. Both final jobs depend on the image job; neither depends on
|
||||
the other. Only main updates
|
||||
`KofTwentyTwo/cluster-gitops/tenants/qrun/website/kustomization.yaml`, using the
|
||||
existing `github` context; image publication uses `ghcr`. Production-only means
|
||||
no non-main deployment update, not no non-main artifacts: develop/staging image
|
||||
publishing and release-candidate GitHub releases remain unchanged.
|
||||
|
||||
Keep `.munitor.yml` as declarative worker input when migrating the consumer.
|
||||
Munitor's `generate_dockerfile` reads it from the attached workspace and requires
|
||||
`pipeline: node-webapp` and `docker.use_repo_dockerfile: true` to preserve the
|
||||
repository Dockerfile. The profile does not replace that file or validate all
|
||||
of its values. Changes to worker input require review alongside the centralized
|
||||
profile; arbitrary manifest job overrides are not supported. Health remains `/`
|
||||
on port 3000; the repository Dockerfile remains responsible for the standalone
|
||||
runtime without npm or npx.
|
||||
|
||||
`MarketingContractTests` checks whole-graph equality and explicit release/test
|
||||
contracts. The normal generator suite additionally checks source/packed parity.
|
||||
These are configuration tests, not a claim of hosted delivery, credentials,
|
||||
container health, or production deployment verification.
|
||||
@@ -0,0 +1,36 @@
|
||||
# Next native workers
|
||||
|
||||
The orb repository owns the reusable workers in `.github/workflows/next-*.yml`.
|
||||
`src/scripts/generate_next_workflow.py --ref FULL_ORB_COMMIT` emits the sole tiny
|
||||
consumer `.github/workflows/next.yml` bridge; `--check PATH` validates its canonical
|
||||
shape. Pins must be immutable 40-character commits. Do not point consumers at an
|
||||
unreleased working tree or mutable default branch.
|
||||
|
||||
Native GitHub execution preserves the existing dynamic PR-label acceptance matrix,
|
||||
native ARM64 dashboard image proof and ephemeral GitHub Packages token. It is not
|
||||
a second copy of Circle's frontend tests. The consumer's old CI/acceptance/image
|
||||
workflow bodies must be removed when the bridge is activated and its checks proven.
|
||||
|
||||
The initial extraction preserves all five CI jobs, real-backend plan/build/shards/
|
||||
gate/quarantine jobs and AMD64/ARM64 image jobs. Acceptance remains 18 cells for
|
||||
main/tag/manual/full-acceptance and four cells for ordinary PRs. Each cell retains
|
||||
its isolated backend and existing serial-worker contract; one built artifact feeds
|
||||
all cells. The report merger and every-planned-shard evidence check remain required.
|
||||
Unrelated PR label edits no longer rerun validation: only `full-acceptance` label
|
||||
changes rerun acceptance, while unit/browser/image jobs skip all label-only events.
|
||||
|
||||
The `frontend-next` Circle profile retains the existing tag-only delivery contract:
|
||||
the tag build plus immutable npm/Maven version comparison, typecheck, lint, tests,
|
||||
static export and signed JAR deployment. Its manifest accepts only `profile`,
|
||||
`orb_version` and `default_branch`; its canonical setup caller ignores all branches.
|
||||
The shared Java installer owns the existing unattended package-install policy.
|
||||
Native workers own branch checks, with no duplicate Circle branch test/build jobs.
|
||||
Tag validation intentionally still overlaps native validation during this initial
|
||||
move. As before, JAR publication is independent of native acceptance; no new
|
||||
cross-platform coordination gate or artifact-reuse guarantee is claimed.
|
||||
Hosted permissions and protection-context migration still need canary validation.
|
||||
|
||||
`python3 tests/test_next_native.py` compares every worker job/step against the audited
|
||||
baseline and executes the original selector fixture to prove 18/4 counts. It checks
|
||||
the immutable caller references and label conditions. Run actionlint and hosted
|
||||
canaries before consumer migration; generated required contexts may differ.
|
||||
@@ -0,0 +1,41 @@
|
||||
# Preserve existing QBit release selection
|
||||
|
||||
Migration now reads the audited job filters, not just the presence of a
|
||||
publication job. The following bounded QBit-only manifest fields preserve the
|
||||
recognized contracts:
|
||||
|
||||
| Field | Values | Behavior |
|
||||
|---|---|---|
|
||||
| `release_on_main` | boolean, default false | Main pushes select the existing release job when release publishing is enabled. |
|
||||
| `release_tag_policy` | `stable`, `v-prefix`, `none` | Stable `v1.2.3`, the existing broad `/v.*/` contract, or no tags. |
|
||||
| `test_branch_policy` | `all`, `non-release`, `non-release-no-integration`, `feature`, `non-release-no-main` | Selects one of the five audited test branch exclusions. |
|
||||
|
||||
`feature` preserves the original exclusion of develop, main, release branches,
|
||||
and integration-prefixed branches; it is not a new feature-prefix-only rule.
|
||||
All policies continue to exclude the RC coordination lock branch.
|
||||
No consumer-supplied regex, command, job, or arbitrary branch-publication rule
|
||||
is accepted.
|
||||
|
||||
An explicit tag policy also controls the canonical setup caller's tag filter.
|
||||
`none` prevents even setup from running on tags for the four test-only repos.
|
||||
Stable and broad policies run only their approved tags. Existing manifests
|
||||
without the field retain their previous canonical caller for compatibility.
|
||||
Every tag publication still verifies that the actual Git tag resolves to HEAD.
|
||||
Main publication does not invent a tag requirement that the existing jobs lacked.
|
||||
`publish.release: false` still disables release publication.
|
||||
|
||||
The 42 immutable source fixtures preserve eight main-push publishers, four broad
|
||||
tag publishers, the remaining stable tag publishers, and four test-only repos.
|
||||
Snapshot/RC inference accepts only the observed develop and release branch
|
||||
filters. Unknown filters, duplicate publication/test jobs, and custom job options
|
||||
fail migration rather than silently changing release behavior.
|
||||
|
||||
Use `tools/standardize_qbit.py --write` for the two-file migration. API callers
|
||||
must pass the inferred policy to
|
||||
`canonical_caller(version, manifest["release_tag_policy"])`; the legacy one-argument
|
||||
form is only for manifests without an explicit policy.
|
||||
|
||||
Focused tests cover the immutable inventory, unknown-filter rejection, canonical
|
||||
caller agreement, main opt-in, broad/stable tag selection, HEAD provenance,
|
||||
publication opt-out and test exclusions. The packed generator suite also exercises
|
||||
main, broad RC-shaped tags, and excluded integration branches.
|
||||
@@ -0,0 +1,51 @@
|
||||
# Specialist native ownership
|
||||
|
||||
`generate_auxiliary_workflow.py mcp-rag --ref FULL_ORB_COMMIT` and
|
||||
`business-db --ref FULL_ORB_COMMIT` emit canonical immutable bridges.
|
||||
Worker policy lives in this repository. No Circle pipeline is added for either
|
||||
bridge, and no consumer has been migrated by adding these definitions.
|
||||
|
||||
## MCP RAG
|
||||
|
||||
Audited source: `7ff9bc7af7e949eee164efb90e3b4a2b931b2278`.
|
||||
One `mvn -B -ntp clean verify` includes the POM-bound Checkstyle validate phase,
|
||||
Error Prone compiler, unit tests, Failsafe integration-test/verify and existing
|
||||
coverage checks. This replaces the separate native lint/compile and verify jobs.
|
||||
It does not introduce skipped tests or the old Circle-only PMD skip.
|
||||
|
||||
The worker keeps Java 21, Maven caching, the explicit optional
|
||||
`QQQ_MCP_VOYAGE_API_KEY` secret, JAR artifact handoff, and the original dependent
|
||||
main-push-only image job. GHCR authentication remains the ephemeral GitHub token
|
||||
with packages write permission. The repository Dockerfile, commit-SHA and latest
|
||||
tags are unchanged. Test reports are retained even when verification fails.
|
||||
|
||||
The caller covers all branch pushes (the old Circle coverage), PRs targeting main,
|
||||
and manual runs. A same-repository PR can still have both a branch-head and a
|
||||
merge-ref run: those inputs are not proven equivalent, so this migration does not
|
||||
silently drop merge validation. Superseded non-main runs of the same event/ref
|
||||
cancel; main publication is not cancelled. Native runtime cost still counts
|
||||
towards total CI cost; no measured savings are claimed.
|
||||
|
||||
Consumer Circle retirement requires hosted equivalence and an audit of existing
|
||||
`qstudio-ci` environment variables. Local source identifies the named Voyage
|
||||
secret, but cannot prove that a private Circle context has no other inputs.
|
||||
No credentials were copied, replaced or assumed. Hosted image publication,
|
||||
native permissions and required-check migration remain unverified here.
|
||||
|
||||
## Business database migrations
|
||||
|
||||
Audited source: `8af799fce97e972f81f195df969d79a959f71dbc`.
|
||||
The native worker retains the exact `mvn -B -pl db verify` job, Java 21,
|
||||
Maven cache, PR path filters and main push path filters. Its source paths are
|
||||
`db/**`, `pom.xml`, and the existing PR workflow path. It introduces no new
|
||||
schedule, publication, secret or Circle pipeline.
|
||||
|
||||
The existing disabled business-platform E2E workflow is an explicit exception.
|
||||
This implementation neither re-enables it nor claims that its live-service
|
||||
coverage has been standardized. Enablement is an external workflow setting,
|
||||
not something proven by the audited YAML. Consumer retirement/adoption must
|
||||
preserve that disabled state.
|
||||
|
||||
`tests/test_auxiliary_workflows.py` checks exact database worker/event equality,
|
||||
MCP image-job equality, the declared secret, all-branch coverage, and the actual
|
||||
POM phase bindings used to remove duplicate lint/compile work.
|
||||
@@ -0,0 +1,9 @@
|
||||
# GitOps validation
|
||||
|
||||
The orb owns `.github/workflows/gitops.yml`. The consumer keeps only the immutable caller generated by `generate_auxiliary_workflow.py gitops --ref <orb-commit>` at `.github/workflows/validate.yml`.
|
||||
|
||||
One native job downloads Kustomize 5.7.1 with its pinned official SHA-256 and renders every Kustomization, including bases, overlays and proxy declarations. Missing configurations or a failed render fail the job. Rendered resources are discarded rather than logged or uploaded because they may contain Secrets. This checks rendering, not Kubernetes schema compatibility or cluster health. No cluster access or publication credentials are required.
|
||||
|
||||
The caller runs on main pushes and pull requests without path filters, so a required check always reports. Superseded PR runs are canceled. Feature pushes do not create duplicate jobs. Remove the old Circle pipeline only after the native job passes on the consumer, then disable obsolete Circle build requests and require the observed native check with no human review.
|
||||
|
||||
For marketing-website-cd, the prior Circle job only printed Hello World. Its former production role moved to KofTwentyTwo/cluster-gitops; validation does not re-enable that retired deployment path.
|
||||
@@ -0,0 +1,28 @@
|
||||
# IntelliJ plugin native standard
|
||||
|
||||
The plugin is a real resource-only product, not a no-CI exemption. Its native
|
||||
profile is `intellij-plugin`, with an orb-owned reusable worker and canonical
|
||||
auxiliary bridge at `.github/workflows/build.yml`. Generate using
|
||||
`generate_auxiliary_workflow.py intellij-plugin --ref IMMUTABLE_ORB_SHA`.
|
||||
|
||||
PRs and main/develop/tag pushes use Linux/JDK17 and the committed Gradle wrapper
|
||||
(Gradle8.6 in audited source) to run `check buildPlugin`. Distribution ZIPs and
|
||||
reports are retained. There are no authored source tests in the audited product;
|
||||
this validates its actual Gradle packaging lifecycle without inventing app code.
|
||||
No consumer build.gradle.kts semantics are changed.
|
||||
|
||||
Publication remains opt-in manual: select `vVERSION`, set publish=true and the
|
||||
exact source version, then approve the `intellij-marketplace` environment. The
|
||||
worker requires successful same-source build, exact source version/tag/HEAD and
|
||||
remote tag identity, serializes publication, requires all four existing secret
|
||||
interfaces, then executes `signPlugin publishPlugin`. Secrets CERTIFICATE_CHAIN,
|
||||
PRIVATE_KEY, PRIVATE_KEY_PASSWORD and PUBLISH_TOKEN are passed only into that
|
||||
step. Ordinary builds and PRs never publish. The caller and worker need only
|
||||
contents:read; Marketplace authorization remains the existing token contract.
|
||||
|
||||
Root must configure/verify environment protection and existing secret availability,
|
||||
run the hosted build canary, and verify signed Marketplace release separately.
|
||||
No credentials, consumer migration or publication have been performed here.
|
||||
Version1.1.0 is already documented historically: do not republish it merely to
|
||||
test automation. The vVERSION convention is the explicit new guarded CI release
|
||||
contract, not a claim about historical tags. No GitHub release is synthesized.
|
||||
@@ -0,0 +1,47 @@
|
||||
# Orb-owned native maintenance workflows
|
||||
|
||||
Four existing workflows retain their event contracts in generated tiny callers:
|
||||
|
||||
| Repository | Caller path | Orb worker |
|
||||
| --- | --- | --- |
|
||||
| QRun-IO/qqq | `.github/workflows/codeql.yml` | `core-codeql.yml` |
|
||||
| QRun-IO/qqq | `.github/workflows/published-bom-consumer.yml` | `core-published-bom-consumer.yml` |
|
||||
| QRun-IO/qqq | `.github/workflows/quickstart-lifecycle.yml` | `core-quickstart-lifecycle.yml` |
|
||||
| QRun-IO/qbit-authentik | `.github/workflows/schema-drift.yml` | `qbit-schema-drift.yml` |
|
||||
|
||||
Generate a caller with `python src/scripts/generate_auxiliary_workflow.py KIND
|
||||
--ref IMMUTABLE_ORB_COMMIT_SHA`; `--check PATH` detects drift. The estate auditor
|
||||
recognizes these exact approved bridges. No consumer files are changed by the
|
||||
generator unless its output is explicitly redirected by the rollout operator.
|
||||
|
||||
Worker jobs preserve audited QQQ commit
|
||||
`bc0b0f11ef9d436c80b2e3c5268726a6bc0881c1` and Authentik commit
|
||||
`dbae77da5b6236268900f1238ce083f9d078d66d`. Tests compare the complete job objects,
|
||||
events and permissions against those fixtures, with explicit exceptions for the
|
||||
CodeQL additions below and the portable quickstart directory-creation correction.
|
||||
This preserves BOM source/ref/version validation, immutable acceptance-tools
|
||||
checkout, browser/OS matrix, private diagnostic handling and schema drift test.
|
||||
The caller retains schedules, tag filters and dispatch choices. Reusable inputs
|
||||
supply empty defaults on scheduled/tag runs, matching the original absent inputs;
|
||||
quickstart tag runs still derive the candidate and source SHA in the original job.
|
||||
No credentials are inherited beyond the automatic job token.
|
||||
|
||||
Publish the orb commit and verify reusable access before adoption. Hosted check
|
||||
names may gain the reusable caller prefix: observe actual canary check names and
|
||||
update required checks only after successful execution, preserving other rules.
|
||||
Local structural tests cannot prove hosted CodeQL upload or native execution.
|
||||
No consumer migration, rule update or publication is performed by these files.
|
||||
|
||||
## CodeQL coverage before retiring duplicate default setup
|
||||
|
||||
The central matrix covers `actions`, `java-kotlin`, `javascript-typescript`, and
|
||||
`python`. The original Java/Kotlin and JavaScript/TypeScript entries and build
|
||||
modes remain unchanged. Actions and Python cover the additional language families
|
||||
observed in the repository's active default setup. No custom queries or packs
|
||||
are supplied, preserving the default query suite.
|
||||
|
||||
Do not disable default setup yet. First publish and adopt the immutable central
|
||||
worker, then prove a hosted canary successfully completes and uploads analyses
|
||||
for all four languages. Only after that evidence may the rollout retire duplicate
|
||||
default setup without reducing coverage. These source changes do not modify
|
||||
repository settings or claim hosted four-language success.
|
||||
@@ -0,0 +1,37 @@
|
||||
# qctl native platform worker
|
||||
|
||||
`qctl-native.yml` centrally owns qctl's source tests, native builds, release,
|
||||
Docker, Homebrew, Scoop and AUR jobs. This is the explicit native-runner exception
|
||||
to Circle profiles: macOS and Windows release binaries use GitHub-hosted runners.
|
||||
The orb owns the tiny caller generator and canonical-definition check; consumers
|
||||
retain no platform matrix or custom build/release logic.
|
||||
|
||||
Every PR and main/develop push runs the complete `mvn clean verify` source suite.
|
||||
Ordinary branch pushes additionally qualify Linux AMD64. Tags qualify all five
|
||||
Linux/macOS AMD64/ARM64 and Windows AMD64 binaries, then reuse those artifacts in
|
||||
release and packaging jobs. Manual `full_native: true` qualifies all five without
|
||||
publishing; false runs the source suite only. Publishing requires a tag push;
|
||||
fork PRs cannot enter native/publishing jobs and test tokens have read-only
|
||||
contents permissions. Existing Homebrew credential and packaging PR behavior stay
|
||||
unchanged. Tag runs are not auto-canceled.
|
||||
|
||||
The Intel macOS runner is explicitly `macos-15-intel`; `macos-15` is ARM64.
|
||||
Each native build also checks its actual machine architecture before compilation.
|
||||
See https://docs.github.com/en/actions/reference/runners/github-hosted-runners.
|
||||
|
||||
## Adoption
|
||||
|
||||
After publishing this worker at a reviewed immutable commit SHA, set
|
||||
`QCTL_SHARED_REF` to that SHA and run the orb's
|
||||
`src/scripts/generate_qctl_workflow.py` to produce `.github/workflows/build.yml`.
|
||||
`--check .github/workflows/build.yml` rejects local drift. The corresponding orb
|
||||
command is `generate_qctl_workflow`; the optional rendering job is
|
||||
`qctl_generate_workflow`. This is separate from the Circle pipeline generator.
|
||||
|
||||
Canary the caller before deleting/replacing the existing workflow. Verify full
|
||||
source tests, representative branch native build, manual five-platform output,
|
||||
and existing publishing/packaging permissions. Confirm actual hosted required
|
||||
check names before changing any rules: reusable calls may change their prefixes.
|
||||
Local configuration tests and actionlint do not prove native builds or release
|
||||
credentials. Keep the working native workflow until equivalent hosted evidence
|
||||
exists. No consumer migration or release has been performed by this patch.
|
||||
@@ -0,0 +1,55 @@
|
||||
# qqq-all Circle smoke evidence (opt-in, not yet adopted)
|
||||
|
||||
`qqq-all-release.yml` defaults to genuine GitHub Smoke evidence. Circle mode is
|
||||
explicit `smoke_evidence: circle`, `circle_workflow_id: <UUID>`, with a separately
|
||||
passed reusable secret `CIRCLECI_TOKEN` and `checks: read`. No credential is
|
||||
created or assumed available. The protected worker writes the reviewed orb-owned `qqq_all_release_gate.py` and
|
||||
`verify_all_circle_smoke.py` into its temporary directory and executes that gate
|
||||
against `--root .` (the consumer checkout). No consumer adapter is required.
|
||||
|
||||
The reviewed verifier is embedded verbatim in the reusable worker (a regression
|
||||
test prevents drift). It reads Circle workflow, pipeline, jobs and pipeline
|
||||
workflows, then checks GitHub app 18001's latest same-SHA `verify-and-smoke` Check
|
||||
Run and exact Circle workflow URL. Evidence requires QRun-IO/qqq-all, the release
|
||||
SHA on develop without a tag, a webhook trigger with actor and received time,
|
||||
successful workflow and all jobs, and exactly one successful build-and-test/core/full
|
||||
job each. API/manual triggers are rejected. Circle's webhook metadata does not
|
||||
expose a GitHub event subtype; this proves a develop webhook, not an asserted
|
||||
`push` event field. It is never represented as a GitHub Smoke run.
|
||||
|
||||
Selective reruns are not accepted: explicit rerun ancestry/auto-rerun flags or
|
||||
multiple same-name workflows within a pipeline fail closed. Paginated evidence
|
||||
also fails closed; the tool does not infer omitted jobs or attempts. A newer
|
||||
failed/pending check or different workflow UUID cannot be bypassed by selecting
|
||||
an older success. Both API sources must be readable; errors deny authorization.
|
||||
This conservative policy may require a fresh complete develop pipeline after a
|
||||
failure. Hosted schema/credential verification is still required before enabling.
|
||||
|
||||
## Central gate and rollout
|
||||
|
||||
`src/scripts/qqq_all_release_gate.py` is copied from audited qqq-all commit
|
||||
`e35f1f6b99639eb998340f082fab89c7ac12426c`. Every original validator body is
|
||||
unchanged. Its CLI accepts exactly one complete evidence mode: the original
|
||||
`--smoke-run`/`--smoke-jobs` pair, or `--circle-smoke`. Circle mode checks the schema,
|
||||
repository and SHA, then invokes the same verifier on every nested evidence field.
|
||||
It never treats an arbitrary Boolean or caller-uploaded receipt as proof.
|
||||
|
||||
The original `test_release_gate.py` and `test_release_rc.py` are retained in orb
|
||||
tests with only module/path import adaptations. They still exercise GA/RC limits,
|
||||
immutable dependencies, published POM matching, signed tags, public upstream state
|
||||
and cold public downloads. New mode/parity tests ensure both central scripts match
|
||||
their embedded worker definitions and all source-relative paths remain in the
|
||||
consumer checkout. The consumer's product tests and release bundle script remain.
|
||||
|
||||
Rollout needs a tiny caller passing `smoke_evidence: circle`, the workflow UUID,
|
||||
`checks: read`, and the existing explicitly authorized Circle credential. Validate
|
||||
a real complete develop Circle workflow and secret scope before removing the old
|
||||
GH Smoke workflow. No release-gate implementation should be copied back into a
|
||||
consumer. Existing legacy consumers can keep `smoke_evidence: github` by default.
|
||||
|
||||
The protected `qqq-all-release` environment, release flags, exact annotated signed
|
||||
tag checks, source identity, cold Maven verification, public input receipts,
|
||||
GHCR checks and prepublication develop/tag recheck remain in place. No consumer
|
||||
source changes, credential provisioning, release attempt or publication has been
|
||||
performed. Do not remove the genuine GH Smoke path until the new evidence mode
|
||||
has passed a real complete pipeline and central gate validation.
|
||||
@@ -0,0 +1,109 @@
|
||||
# RC completion without waiting runners
|
||||
|
||||
The reusable `qbit-release-rc.yml` keeps the existing cut entry point. `finalize: false`
|
||||
(the default) briefly merges develop, then records `qbit-rc-intent-<merge SHA>` as a
|
||||
90-day Actions artifact. It does not wait for CircleCI or Central. `finalize: true`
|
||||
accepts `merge_sha`, `bump_sha`, `branch`, and `version` from a publisher callback
|
||||
or explicit recovery retry. The callback is only a hint, never release authority.
|
||||
|
||||
The caller must remain `.github/workflows/release-rc.yml` on the repository default
|
||||
branch. It handles `repository_dispatch` type `qbit-rc-published` and passes those
|
||||
four fields and `finalize: true` to this reusable, with `secrets: inherit` and
|
||||
`contents: write`, `actions: read`, `checks: read`. Existing manual dispatch and merged/labelled
|
||||
PR cut behavior remains in the tiny caller. Add an explicit finalization retry
|
||||
option to manual dispatch; retrying finalization must not request another cut.
|
||||
GitHub documents dispatch/default-branch behavior at:
|
||||
https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#repository_dispatch
|
||||
|
||||
## Ownership and provenance
|
||||
|
||||
- A cut atomically creates `refs/heads/automation/qbit-rc-pending` before changing
|
||||
the release branch. The ref initially points at develop and then at the exact
|
||||
merge API response SHA. A second cut fails while it exists. CI must ignore this
|
||||
exact automation branch. The lock has no expiry or automatic takeover.
|
||||
- Cut and finalizer share one repository concurrency group. The pending ref holds
|
||||
ownership between these short runs; workflow concurrency alone cannot do that.
|
||||
- Finalization retrieves the unique unexpired intent artifact and verifies its
|
||||
originating successful `release-rc.yml` run, repository, trigger and attempt.
|
||||
Callback fields must match that immutable intent.
|
||||
- The exact merge SHA must have a successful `publish_release_candidate` Check Run
|
||||
from CircleCI app ID `18001`; unrelated job statuses cannot authorize release.
|
||||
Terminal publisher failure stops finalization immediately. Pending/absent publication cannot authorize a tag.
|
||||
The RC bump must have exactly that one parent and the release branch must still
|
||||
point to it. A later unrelated bump or an old version is never substituted.
|
||||
- The Central POM must identify the expected artifact/version and have a
|
||||
Last-Modified time after the cut. Missing Central visibility leaves the intent
|
||||
pending, with no tag, no lock release, no sleeping runner.
|
||||
- Tags remain SSH-signed annotated tags using `QRUN_TAG_SIGNING_KEY`. Temporary
|
||||
key/repository/intent files are cleaned on all shell exits. Existing annotated
|
||||
tags must resolve to the exact bump; duplicate delivery cannot retarget a tag.
|
||||
A tag created before an interrupted release operation can finish the missing
|
||||
prerelease on retry. Ownership is compared again before lock deletion.
|
||||
|
||||
## Automatic retry and rollout
|
||||
|
||||
The orb's single centrally scheduled `rc_finalize_sweep` job uses the existing
|
||||
`qqq-maven-registry-credentials` context's `GITHUB_TOKEN` (or `GH_TOKEN`) and an
|
||||
explicit JSON allowlist, not `.github`'s repository-limited Actions token. It
|
||||
reads only pending locks, validates cut provenance and exact publisher success,
|
||||
checks Central availability, and redispatches the same immutable candidate.
|
||||
Idle repositories cause one read and no finalizer job. Central delay causes a
|
||||
later scheduled retry, not allocated polling. Terminal failure is visible in
|
||||
sweep job failure; the lock stays for diagnosis. Bound: 64 repositories,
|
||||
500 GitHub calls, 480 seconds plus the current bounded request; no infinite retry.
|
||||
The root owns the single Circle schedule and confirms existing credential access
|
||||
before enabling it. No new credential or service is required by this patch.
|
||||
|
||||
Roll out shared reusable and default-branch callers first, then the released orb
|
||||
callback/profile plus automation-branch exclusion. Enable the one central sweep
|
||||
only after checking the allowlist and representative cross-repository API access.
|
||||
The orb callback must be opt-in until callers exist, RC-only, after successful
|
||||
deployment AND successful pushed bump, with remote head and direct parent checks.
|
||||
Do not emit a callback after the legacy warning-only failed version push.
|
||||
|
||||
## Recovery
|
||||
|
||||
A failed cut, expired artifact, failed publisher or conflicting tag deliberately
|
||||
retains the lock. Inspect the cut run, lock SHA, release branch, Circle result,
|
||||
Central artifact and tag/release before changing state. If the cut is recoverable,
|
||||
retry the same publication/finalization; do not delete the lock merely to unblock
|
||||
another version. For an abandoned cut, an authorized operator must compare the
|
||||
current lock with the recorded expected SHA immediately before deleting that
|
||||
exact ref, under the same release lane. Never delete a different cut's lock or
|
||||
retag a published version. A missing/expired trusted artifact requires explicit
|
||||
release-captain reconciliation; the sweep does not invent provenance.
|
||||
|
||||
## Local checks
|
||||
|
||||
`python -m unittest discover -s tests -v` exercises the exact inline evaluator.
|
||||
`actionlint -shellcheck= .github/workflows/qbit-release-rc.yml` validates Actions
|
||||
syntax. Full actionlint with Windows native ShellCheck hung locally and was
|
||||
stopped; Linux actionlint/ShellCheck and end-to-end credential/callback rollout
|
||||
verification remain required. The orb has separate sweep/dispatch fixture tests.
|
||||
|
||||
### Published upload timeout recovery
|
||||
|
||||
A Circle deployment step can time out after Central has accepted and published its
|
||||
bundle. Use the canonical caller's explicit manual `recover` input with the existing
|
||||
`merge_sha`, `branch`, `version` and original `circle_build`. Run with `dry_run: true`
|
||||
first to verify evidence without changing the branch, tag, release or pending lock.
|
||||
This mode never builds, uploads, cuts a new candidate, or changes the failed Circle check.
|
||||
|
||||
The pinned orb worker requires the original successful cut intent and unchanged lock,
|
||||
the exact failed Circle workflow/check, a final deployment timeout after all preceding
|
||||
actions (including Maven Verify) succeeded, exactly one successful upload receipt,
|
||||
and an authenticated Central `PUBLISHED` response matching every staged coordinate.
|
||||
It also checks public POM coordinates and publication timestamps after the cut.
|
||||
Existing organization `CENTRAL_USERNAME` and `CENTRAL_PASSWORD` secrets authenticate
|
||||
only the Central status request; Circle evidence uses its public API. Redirects are
|
||||
rejected and credentials are never included in the recovery receipt.
|
||||
|
||||
After verification, recovery creates only the missing signed version bump as a direct
|
||||
child of the original release merge, using a normal fast-forward push. An existing
|
||||
bump must pass the same parent/version checks. The existing signed-tag/prerelease
|
||||
finalizer then completes the candidate and compares lock ownership before cleanup.
|
||||
A later explicit recovery retry verifies the original receipt again. Once the lock
|
||||
is gone, the completed release needs no recovery dispatch. Ordinary callbacks and
|
||||
scheduled reconciliation retain the requirement for a successful Circle publisher.
|
||||
|
||||
Central status API: https://central.sonatype.org/publish/publish-portal-api/
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Embed profile resources before Circle packs/interpolates its own syntax."""
|
||||
import base64
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
source = root / "src/scripts/generate_pipeline.py"
|
||||
output = root / "src/scripts/packed_generate_pipeline.py"
|
||||
text = source.read_text(encoding="utf-8")
|
||||
start = text.index("# BEGIN PROFILE RESOURCES")
|
||||
end = text.index("# END PROFILE RESOURCES") + len("# END PROFILE RESOURCES")
|
||||
embedded = ["# Generated by scripts/pack_pipeline.py; edit source/resources, then regenerate.", "import base64", "import zlib"]
|
||||
for variable, name in (("CORE_TEMPLATE", "core"), ("MATERIAL_TEMPLATE", "frontend-material"), ("VOYAGE_TEMPLATE", "voyage"), ("NEXT_TEMPLATE", "frontend-next"), ("ALL_TEMPLATE", "all"), ("STARTER_TEMPLATE", "app-starter"), ("ANDROID_TEMPLATE", "android"), ("POLICY_TEMPLATE", "mcp-policy"), ("MARKETING_TEMPLATE", "marketing")):
|
||||
payload = base64.b64encode(zlib.compress((source.parent / "templates" / (name + ".json")).read_bytes(), level=9)).decode("ascii")
|
||||
embedded.append(f'{variable} = json.loads(zlib.decompress(base64.b64decode("{payload}")))')
|
||||
packed = text[:start] + "\n".join(embedded) + text[end:]
|
||||
if len(packed.encode("utf-8")) > 100_000:
|
||||
sys.exit("Packed generator exceeds the tested CircleCI command-argument budget")
|
||||
if "--check" in sys.argv:
|
||||
if not output.exists() or output.read_text(encoding="utf-8") != packed:
|
||||
sys.exit("Packed generator is stale; run python3 scripts/pack_pipeline.py")
|
||||
else:
|
||||
output.write_text(packed, encoding="utf-8", newline="\n")
|
||||
+3
-4
@@ -4,14 +4,13 @@ version: 2.1
|
||||
|
||||
description: >
|
||||
QQQ Orb to handle the branching, testing, releasing, and auto updating of
|
||||
all maven and npm based projects within the Kingsrook/QRunIO Repo world.
|
||||
all Maven and npm based projects within the QRun-IO ecosystem.
|
||||
|
||||
display:
|
||||
home_url: "https://www.qrun.io"
|
||||
source_url: "https://github.com/Kingsrook/qqq-orb"
|
||||
home_url: "https://github.com/QRun-IO/qqq-orb"
|
||||
source_url: "https://github.com/QRun-IO/qqq-orb"
|
||||
|
||||
orbs:
|
||||
localstack: localstack/platform@2.1
|
||||
browser-tools: circleci/browser-tools@1.4.7
|
||||
slack: circleci/slack@5.2.1
|
||||
node: circleci/node@4.7
|
||||
@@ -0,0 +1,9 @@
|
||||
description: >
|
||||
Collects all security scan reports into a central location for artifact
|
||||
storage. Generates a summary.txt with finding counts from each tool.
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Collect Security Reports
|
||||
command: <<include(scripts/collect_security_reports.sh)>>
|
||||
when: always
|
||||
@@ -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
|
||||
@@ -11,6 +11,8 @@ steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Setup NPM authentication
|
||||
@@ -30,5 +32,8 @@ steps:
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
- node_modules
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
@@ -33,6 +33,9 @@ steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
|
||||
# (Optional) Guard: if node_modules is missing, install it quickly so "npm run build" works
|
||||
- run:
|
||||
@@ -67,3 +70,9 @@ steps:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
|
||||
# Re-cache Node deps
|
||||
- save_cache:
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-npm-dependencies-{{ checksum "package.json" }}
|
||||
@@ -0,0 +1,49 @@
|
||||
description: Read a strict QQQ manifest and continue with its standardized pipeline.
|
||||
parameters:
|
||||
orb_version:
|
||||
type: string
|
||||
description: Explicit orb version, identical to the setup import and manifest.
|
||||
manifest:
|
||||
type: string
|
||||
default: .qqq-ci.yml
|
||||
description: Repository manifest path.
|
||||
mongo_bind_diagnostics:
|
||||
type: boolean
|
||||
default: false
|
||||
description: Core owned Mongo fixture diagnostics.
|
||||
run_playwright:
|
||||
type: boolean
|
||||
default: false
|
||||
description: Material frontend Playwright validation before test or snapshot publication.
|
||||
next_acceptance_bundle_url:
|
||||
type: string
|
||||
default: ""
|
||||
description: Core Next acceptance bundle URL.
|
||||
next_acceptance_bundle_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
description: Core Next acceptance bundle SHA256.
|
||||
next_acceptance_receipt_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
description: Core Next acceptance receipt SHA256.
|
||||
steps:
|
||||
- run:
|
||||
name: Install manifest parser
|
||||
command: python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
- validate_standard:
|
||||
orb_version: << parameters.orb_version >>
|
||||
manifest: << parameters.manifest >>
|
||||
- run:
|
||||
name: Generate and continue standardized pipeline
|
||||
shell: python3
|
||||
environment:
|
||||
QQQ_CI_MANIFEST: << parameters.manifest >>
|
||||
QQQ_CI_ORB_VERSION: << parameters.orb_version >>
|
||||
QQQ_CI_CONTINUE: "true"
|
||||
QQQ_CI_MONGO_DIAGNOSTICS: << parameters.mongo_bind_diagnostics >>
|
||||
QQQ_CI_RUN_PLAYWRIGHT: << parameters.run_playwright >>
|
||||
QQQ_CI_NEXT_ACCEPTANCE_BUNDLE_URL: << parameters.next_acceptance_bundle_url >>
|
||||
QQQ_CI_NEXT_ACCEPTANCE_BUNDLE_SHA256: << parameters.next_acceptance_bundle_sha256 >>
|
||||
QQQ_CI_NEXT_ACCEPTANCE_RECEIPT_SHA256: << parameters.next_acceptance_receipt_sha256 >>
|
||||
command: << include(scripts/packed_generate_pipeline.py) >>
|
||||
@@ -0,0 +1,12 @@
|
||||
description: Emit the canonical qctl native-platform GitHub bridge pinned to a reviewed central worker SHA.
|
||||
parameters:
|
||||
shared_ref:
|
||||
type: string
|
||||
description: Immutable 40-character QRun-IO/.github commit containing qctl-native.yml.
|
||||
steps:
|
||||
- run:
|
||||
name: Generate qctl native workflow caller
|
||||
shell: python3
|
||||
environment:
|
||||
QCTL_SHARED_REF: << parameters.shared_ref >>
|
||||
command: <<include(scripts/generate_qctl_workflow.py)>>
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
description: >
|
||||
Full checkout of the repository with complete git history.
|
||||
Uses CircleCI's checkout (handles SSH keys and known_hosts)
|
||||
then fetches full history for version calculation.
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Fetch full git history
|
||||
command: |
|
||||
git fetch --unshallow || true
|
||||
git fetch --tags || true
|
||||
@@ -2,7 +2,18 @@ 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:
|
||||
require_pushed_version:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Require and record a successful version push for release completion"
|
||||
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 +21,7 @@ steps:
|
||||
command: <<include(scripts/manage_version_git_config.sh)>>
|
||||
- run:
|
||||
name: Commit version change if modified
|
||||
environment:
|
||||
BRANCH_TYPE: << parameters.branch_type >>
|
||||
REQUIRE_PUSHED_VERSION: << parameters.require_pushed_version >>
|
||||
command: <<include(scripts/manage_version_commit.sh)>>
|
||||
@@ -0,0 +1,31 @@
|
||||
description: >
|
||||
Installs Eclipse Temurin JDK and Maven on Ubuntu machine executor.
|
||||
Sets JAVA_HOME and updates PATH for subsequent steps.
|
||||
Configures unattended package installation centrally.
|
||||
Optionally installs Node.js for frontend builds.
|
||||
Also verifies Docker is available (required for Testcontainers/LocalStack tests).
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: >
|
||||
Java major version to install (e.g., "17", "21").
|
||||
Uses Eclipse Temurin (AdoptOpenJDK successor) distribution.
|
||||
install_node:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Whether to also install Node.js (for frontend builds)"
|
||||
node_version:
|
||||
type: string
|
||||
default: "20"
|
||||
description: "Node.js major version to install (e.g., '18', '20')"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Install Java << parameters.java_version >> and build tools
|
||||
environment:
|
||||
PARAM_JAVA_VERSION: << parameters.java_version >>
|
||||
PARAM_INSTALL_NODE: << parameters.install_node >>
|
||||
PARAM_NODE_VERSION: << parameters.node_version >>
|
||||
command: <<include(scripts/install_java.sh)>>
|
||||
+25
-17
@@ -1,23 +1,31 @@
|
||||
description: >
|
||||
Builds the project and sets up the development environment
|
||||
- Restores Maven dependency cache for faster builds
|
||||
- Installs Chrome/ChromeDriver for browser testing
|
||||
- Compiles the project with Maven
|
||||
- Saves Maven cache for future builds
|
||||
Prepares Maven settings and restores the dependency repository.
|
||||
Browser installation and preliminary compilation retain their legacy defaults.
|
||||
The complete verification lifecycle saves the warmed repository.
|
||||
|
||||
parameters:
|
||||
install_browsers:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Install Chrome and ChromeDriver for browser tests"
|
||||
compile_before_verify:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run preliminary compile; disable when a later lifecycle compiles the project"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Setup Maven Settings
|
||||
command: <<include(scripts/setup_maven_settings.sh)>>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- browser-tools/install-chrome
|
||||
- browser-tools/install-chromedriver
|
||||
- run:
|
||||
name: Run Maven Compile
|
||||
command: <<include(scripts/mvn_build_compile.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- mvn_cache_restore
|
||||
- when:
|
||||
condition: << parameters.install_browsers >>
|
||||
steps:
|
||||
- browser-tools/install-chrome
|
||||
- browser-tools/install-chromedriver
|
||||
- when:
|
||||
condition: << parameters.compile_before_verify >>
|
||||
steps:
|
||||
- run:
|
||||
name: Run Maven Compile
|
||||
command: <<include(scripts/mvn_build_compile.sh)>>
|
||||
@@ -0,0 +1,12 @@
|
||||
description: >
|
||||
Restores Maven repository downloads using all tracked Maven inputs.
|
||||
A compatible repository fallback reuses downloads after dependency changes.
|
||||
Maven lifecycle invocations must refresh SNAPSHOT dependencies.
|
||||
steps:
|
||||
- run:
|
||||
name: Fingerprint Maven inputs
|
||||
command: <<include(scripts/maven_cache_fingerprint.sh)>>
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v2-maven-repository-{{ arch }}-{{ checksum "/tmp/circleci/maven-cache-fingerprint" }}
|
||||
- v2-maven-repository-{{ arch }}-
|
||||
@@ -0,0 +1,13 @@
|
||||
description: >
|
||||
Saves the Maven repository after a successful complete lifecycle.
|
||||
Includes snapshot metadata, classifiers and installed reactor artifacts;
|
||||
excludes user settings and credentials outside the repository.
|
||||
Call after verify/install, never after preliminary compile alone.
|
||||
steps:
|
||||
- run:
|
||||
name: Fingerprint verified Maven inputs
|
||||
command: <<include(scripts/maven_cache_fingerprint.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2/repository
|
||||
key: v2-maven-repository-{{ arch }}-{{ checksum "/tmp/circleci/maven-cache-fingerprint" }}
|
||||
@@ -1,9 +1,8 @@
|
||||
description: >
|
||||
Publishes artifacts to Maven Central (Sonatype Central Portal)
|
||||
- Restores Maven dependency cache
|
||||
- Debugs Maven settings to verify configuration
|
||||
- Configures Maven credentials without logging settings
|
||||
- Sets up GPG signing for artifact verification
|
||||
- Deploys signed artifacts to Maven Central using release profile
|
||||
- Deploys signed artifacts and waits for confirmed Central release publication
|
||||
- Saves Maven cache for future builds
|
||||
|
||||
steps:
|
||||
@@ -15,6 +14,9 @@ steps:
|
||||
command: <<include(scripts/mvn_jar_deploy_gpg_setup.sh)>>
|
||||
- run:
|
||||
name: Publish to Sonatype Central (releases and SNAPSHOTs)
|
||||
# Central's native publication wait can be silent for its 30-minute limit.
|
||||
# Let Maven return its real result before CircleCI's inactivity watchdog.
|
||||
no_output_timeout: 35m
|
||||
command: <<include(scripts/mvn_jar_deploy.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
|
||||
@@ -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)>>
|
||||
@@ -1,6 +1,6 @@
|
||||
description: >
|
||||
Runs the complete Maven lifecycle including tests and generates reports
|
||||
- Restores Maven dependency cache
|
||||
- Saves the complete Maven dependency repository after successful verification
|
||||
- Runs Maven verify (compile, test, package, verify)
|
||||
- Collects JaCoCo code coverage reports
|
||||
- Stores test output artifacts
|
||||
@@ -13,6 +13,7 @@ steps:
|
||||
- run:
|
||||
name: Run Maven Verify
|
||||
command: <<include(scripts/mvn_verify.sh)>>
|
||||
- mvn_cache_save
|
||||
- run:
|
||||
name: Collect JaCoCo reports
|
||||
command: <<include(scripts/collect_jacoco_reports.sh)>>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
description: >
|
||||
Runs the production build for a Node.js application
|
||||
- Executes the build script with timing output
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
build_script:
|
||||
type: string
|
||||
default: "build"
|
||||
description: "Name of the build script in package.json."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Production build"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
BUILD_SCRIPT: << parameters.build_script >>
|
||||
command: <<include(scripts/node_app_build.sh)>>
|
||||
@@ -0,0 +1,31 @@
|
||||
description: >
|
||||
Runs Playwright end-to-end tests for a Node.js application
|
||||
- Installs Playwright browsers
|
||||
- Runs e2e test suite producing JUnit output
|
||||
- Stores test results and Playwright traces as artifacts
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
e2e_script:
|
||||
type: string
|
||||
default: "test:e2e"
|
||||
description: "Name of the e2e test script in package.json."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Run Playwright e2e tests"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
E2E_SCRIPT: << parameters.e2e_script >>
|
||||
command: <<include(scripts/node_app_e2e.sh)>>
|
||||
- store_test_results:
|
||||
path: test-results/e2e
|
||||
- store_artifacts:
|
||||
path: test-results/e2e
|
||||
destination: e2e-results
|
||||
- store_artifacts:
|
||||
path: playwright-report
|
||||
destination: playwright-report
|
||||
@@ -0,0 +1,72 @@
|
||||
description: >
|
||||
Installs dependencies for a Node.js application
|
||||
- Restores dependency cache
|
||||
- Runs install via configured package manager (pnpm, npm, yarn)
|
||||
- Saves dependency cache
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
|
||||
steps:
|
||||
# Restore cache using only the lockfile for the configured pkg manager.
|
||||
# All three lockfiles cannot be checksummed simultaneously — CircleCI
|
||||
# fails hard if any referenced file doesn't exist.
|
||||
- when:
|
||||
condition:
|
||||
equal: [ pnpm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-app-v1-pnpm-{{ checksum "pnpm-lock.yaml" }}
|
||||
- node-app-v1-pnpm-
|
||||
- when:
|
||||
condition:
|
||||
equal: [ npm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-app-v1-npm-{{ checksum "package-lock.json" }}
|
||||
- node-app-v1-npm-
|
||||
- when:
|
||||
condition:
|
||||
equal: [ yarn, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-app-v1-yarn-{{ checksum "yarn.lock" }}
|
||||
- node-app-v1-yarn-
|
||||
- run:
|
||||
name: "Install dependencies"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
command: <<include(scripts/node_app_install.sh)>>
|
||||
- when:
|
||||
condition:
|
||||
equal: [ pnpm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: node-app-v1-pnpm-{{ checksum "pnpm-lock.yaml" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.cache/pnpm
|
||||
- when:
|
||||
condition:
|
||||
equal: [ npm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: node-app-v1-npm-{{ checksum "package-lock.json" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.npm
|
||||
- when:
|
||||
condition:
|
||||
equal: [ yarn, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: node-app-v1-yarn-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.cache/yarn
|
||||
@@ -0,0 +1,37 @@
|
||||
description: >
|
||||
Runs type-check, lint, and unit tests for a Node.js application
|
||||
- Runs type checking, linting, and tests via package.json scripts
|
||||
- Stores test results as artifacts
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
typecheck_script:
|
||||
type: string
|
||||
default: "typecheck"
|
||||
description: "Name of the typecheck script in package.json."
|
||||
lint_script:
|
||||
type: string
|
||||
default: "lint"
|
||||
description: "Name of the lint script in package.json."
|
||||
test_script:
|
||||
type: string
|
||||
default: "test"
|
||||
description: "Name of the test script in package.json."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Run type-check, lint, and tests"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
TYPECHECK_SCRIPT: << parameters.typecheck_script >>
|
||||
LINT_SCRIPT: << parameters.lint_script >>
|
||||
TEST_SCRIPT: << parameters.test_script >>
|
||||
command: <<include(scripts/node_app_test.sh)>>
|
||||
- store_test_results:
|
||||
path: test-results
|
||||
- store_artifacts:
|
||||
path: test-results
|
||||
destination: test-results
|
||||
@@ -3,7 +3,13 @@ description: >
|
||||
- Adds SSH keys for Git operations
|
||||
- Sets up Git identity for version commits
|
||||
- Synchronizes NPM version
|
||||
- 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)
|
||||
@@ -15,4 +21,6 @@ steps:
|
||||
command: <<include(scripts/sync-npm-version.sh)>>
|
||||
- run:
|
||||
name: Commit version changes if modified
|
||||
environment:
|
||||
BRANCH_TYPE: << parameters.branch_type >>
|
||||
command: <<include(scripts/node_version_commit.sh)>>
|
||||
@@ -3,10 +3,21 @@ description: >
|
||||
- Sets up NPM authentication
|
||||
- Publishes the package to NPM
|
||||
|
||||
parameters:
|
||||
trusted_publishing:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Authenticate npm publish using the CircleCI job's OIDC identity."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Setup NPM authentication"
|
||||
command: <<include(scripts/node_npm_auth.sh)>>
|
||||
- unless:
|
||||
condition: << parameters.trusted_publishing >>
|
||||
steps:
|
||||
- run:
|
||||
name: "Setup NPM authentication"
|
||||
command: <<include(scripts/node_npm_auth.sh)>>
|
||||
- run:
|
||||
name: "Publish to NPM"
|
||||
command: npm publish --access public
|
||||
environment:
|
||||
QQQ_NPM_TRUSTED_PUBLISHING: << parameters.trusted_publishing >>
|
||||
command: <<include(scripts/node_npm_publish.sh)>>
|
||||
@@ -0,0 +1,26 @@
|
||||
description: >
|
||||
Creates a GitHub Release for the current version tag.
|
||||
- Extracts version from pom.xml or package.json
|
||||
- Verifies the Git tag exists
|
||||
- Creates GitHub release with auto-generated notes
|
||||
- Adds artifact links to Maven Central and/or npmjs
|
||||
- Handles prerelease versions (RC, SNAPSHOT, alpha, beta)
|
||||
|
||||
parameters:
|
||||
project_type:
|
||||
type: enum
|
||||
enum: [maven, node, both, auto]
|
||||
default: auto
|
||||
description: >
|
||||
Project type for artifact link generation.
|
||||
- maven: Link to Maven Central
|
||||
- node: Link to npmjs
|
||||
- both: Link to both registries
|
||||
- auto: Auto-detect from project files
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Create GitHub Release
|
||||
command: <<include(scripts/create_github_release.sh)>>
|
||||
environment:
|
||||
PROJECT_TYPE: << parameters.project_type >>
|
||||
@@ -0,0 +1,12 @@
|
||||
description: Reconcile pending RC intents and dispatch verified finalizers without waiting runners.
|
||||
parameters:
|
||||
repositories:
|
||||
type: string
|
||||
description: Explicit JSON allowlist of QRun-IO qbit repositories (maximum 64).
|
||||
steps:
|
||||
- run:
|
||||
name: Reconcile pending release candidates
|
||||
environment:
|
||||
RC_REPOSITORIES_JSON: << parameters.repositories >>
|
||||
shell: python3
|
||||
command: <<include(scripts/rc_finalize_sweep.py)>>
|
||||
@@ -0,0 +1,9 @@
|
||||
description: >
|
||||
Generates a CycloneDX Software Bill of Materials (SBOM) in JSON format.
|
||||
Uses the CycloneDX Maven plugin to produce an aggregate BOM across all
|
||||
modules. No pom.xml changes required -- runs as a CLI Maven goal.
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Generate CycloneDX SBOM
|
||||
command: <<include(scripts/run_cyclonedx_sbom.sh)>>
|
||||
@@ -0,0 +1,17 @@
|
||||
description: >
|
||||
Runs Gitleaks secret detection scan on the repository.
|
||||
Detects hardcoded secrets, API keys, passwords, and tokens in source code
|
||||
and git history. Reports findings in JSON format.
|
||||
|
||||
parameters:
|
||||
fail_on_findings:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if Gitleaks detects secrets"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Run Gitleaks Secret Detection
|
||||
environment:
|
||||
GITLEAKS_FAIL_ON_FINDINGS: << parameters.fail_on_findings >>
|
||||
command: <<include(scripts/run_gitleaks.sh)>>
|
||||
@@ -0,0 +1,32 @@
|
||||
description: >
|
||||
Runs OWASP Dependency-Check to scan project dependencies for known CVEs.
|
||||
Uses the dependency-check-maven plugin as a CLI goal (no pom.xml changes needed).
|
||||
Includes retry logic (3 attempts) for NVD database download reliability.
|
||||
Supports NVD API key for faster database updates via NVD_API_KEY env var.
|
||||
|
||||
parameters:
|
||||
fail_on_cvss:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if vulnerabilities exceed the CVSS threshold"
|
||||
cvss_threshold:
|
||||
type: string
|
||||
default: "7"
|
||||
description: "CVSS score threshold (0-10). Vulnerabilities at or above this score are flagged."
|
||||
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-owasp-nvd-cache-{{ .Branch }}
|
||||
- v1-owasp-nvd-cache-
|
||||
- run:
|
||||
name: Run OWASP Dependency-Check
|
||||
environment:
|
||||
OWASP_FAIL_ON_CVSS: << parameters.fail_on_cvss >>
|
||||
OWASP_CVSS_THRESHOLD: << parameters.cvss_threshold >>
|
||||
command: <<include(scripts/run_owasp_dependency_check.sh)>>
|
||||
no_output_timeout: 30m
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2/repository/org/owasp
|
||||
key: v1-owasp-nvd-cache-{{ .Branch }}-{{ epoch }}
|
||||
@@ -0,0 +1,22 @@
|
||||
description: >
|
||||
Runs Semgrep SAST (Static Application Security Testing) analysis.
|
||||
Scans source code for security vulnerabilities, code quality issues,
|
||||
and OWASP Top 10 patterns. Produces JSON and SARIF reports.
|
||||
|
||||
parameters:
|
||||
fail_on_findings:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if Semgrep finds security issues"
|
||||
rulesets:
|
||||
type: string
|
||||
default: "p/java p/owasp-top-ten p/security-audit"
|
||||
description: "Space-separated list of Semgrep rulesets to run"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Run Semgrep SAST Analysis
|
||||
environment:
|
||||
SEMGREP_FAIL_ON_FINDINGS: << parameters.fail_on_findings >>
|
||||
SEMGREP_RULESETS: << parameters.rulesets >>
|
||||
command: <<include(scripts/run_semgrep.sh)>>
|
||||
@@ -0,0 +1,19 @@
|
||||
description: >
|
||||
Enforces the canonical setup caller and profile-specific pipeline parameters.
|
||||
Run after installing pinned PyYAML and before generating the continuation.
|
||||
parameters:
|
||||
orb_version:
|
||||
type: string
|
||||
description: Exact version imported by setup and pinned in the manifest.
|
||||
manifest:
|
||||
type: string
|
||||
default: .qqq-ci.yml
|
||||
description: Standard manifest path (only .qqq-ci.yml is accepted).
|
||||
steps:
|
||||
- run:
|
||||
name: Validate central CI ownership
|
||||
shell: python3
|
||||
environment:
|
||||
QQQ_CI_ORB_VERSION: << parameters.orb_version >>
|
||||
QQQ_CI_MANIFEST: << parameters.manifest >>
|
||||
command: <<include(scripts/validate_standard.py)>>
|
||||
+47
-22
@@ -1,58 +1,83 @@
|
||||
description: >
|
||||
Complete CI/CD workflow example for Maven-based projects using GitFlow branching strategy.
|
||||
This example demonstrates how to use the qqq-orb for automated building, testing, and releasing.
|
||||
This example demonstrates how to use the qqq-orb for automated building, testing, releasing,
|
||||
and security scanning.
|
||||
|
||||
usage:
|
||||
version: 2.1
|
||||
|
||||
orbs:
|
||||
qqq-orb: kingsrook/qqq-orb@0.3.1
|
||||
qqq-orb: kingsrook/qqq-orb@0.3.8
|
||||
|
||||
workflows:
|
||||
# Test workflow for feature branches
|
||||
|
||||
test_only:
|
||||
jobs:
|
||||
- qqq-orb/mvn_test_only:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
filters:
|
||||
branches:
|
||||
ignore: [develop, main, /release\/.*/, /hotfix\/.*/]
|
||||
filters:
|
||||
branches:
|
||||
ignore: /(develop|main|release/.*|hotfix/.*|integration.*)/
|
||||
tags:
|
||||
only: []
|
||||
|
||||
# Snapshot deployment for develop branch
|
||||
publish_snapshot:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: snapshot
|
||||
filters:
|
||||
branches:
|
||||
only: [develop]
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- develop
|
||||
|
||||
publish_feature:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: feature
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- feature/.*
|
||||
tags:
|
||||
only: [ /publish.*/ ]
|
||||
|
||||
# Release candidate workflow
|
||||
publish_release_candidate:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: release_candidate
|
||||
filters:
|
||||
branches:
|
||||
only: [/release\/.*/]
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /release\/.*/
|
||||
|
||||
# Production release workflow
|
||||
publish_release:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: release
|
||||
filters:
|
||||
branches:
|
||||
only: [main]
|
||||
filters:
|
||||
branches:
|
||||
only: [ main ]
|
||||
tags:
|
||||
only: [ /v.*/ ]
|
||||
|
||||
# Hotfix release workflow
|
||||
publish_hotfix_release:
|
||||
jobs:
|
||||
- qqq-orb/mvn_publish:
|
||||
context: [ qqq-maven-registry-credentials ]
|
||||
branch_type: hotfix
|
||||
filters:
|
||||
branches:
|
||||
only: [/hotfix\/.*/]
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /hotfix\/.*/
|
||||
|
||||
security_scan:
|
||||
jobs:
|
||||
- qqq-orb/security_scan:
|
||||
context: [ qqq-maven-registry-credentials, qqq-security-credentials ]
|
||||
filters:
|
||||
branches:
|
||||
only: [ develop ]
|
||||
@@ -0,0 +1,18 @@
|
||||
description: >
|
||||
Java/OpenJDK machine executor with Docker support.
|
||||
Uses Ubuntu 22.04 VM with Docker pre-installed.
|
||||
Java is installed via the install_java command.
|
||||
Required for tests that use Testcontainers or LocalStack Docker extensions.
|
||||
|
||||
parameters:
|
||||
image:
|
||||
default: ubuntu-2204:current
|
||||
description: >
|
||||
Ubuntu machine image tag. Use 'current' for latest or pin to specific
|
||||
version like 'ubuntu-2204:2023.02.1' for reproducibility.
|
||||
type: string
|
||||
|
||||
machine:
|
||||
image: '<<parameters.image>>'
|
||||
|
||||
resource_class: large
|
||||
@@ -0,0 +1,12 @@
|
||||
description: Publish a develop image only from the verified and smoke-tested workspace artifact.
|
||||
executor: java
|
||||
steps:
|
||||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
name: Verify source and artifact identity
|
||||
command: <<include(scripts/qqq_all_artifact.sh)>>
|
||||
- run:
|
||||
name: Publish public develop image
|
||||
command: <<include(scripts/qqq_all_develop_image.sh)>>
|
||||
@@ -0,0 +1,33 @@
|
||||
description: Run actual core HTTP or private full Compose acceptance against the exact verified jar.
|
||||
executor: java
|
||||
parameters:
|
||||
profile:
|
||||
type: enum
|
||||
enum: [core, full]
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: "21"
|
||||
- mvn_cache_restore
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run:
|
||||
name: Verify source and artifact identity
|
||||
command: <<include(scripts/qqq_all_artifact.sh)>>
|
||||
- when:
|
||||
condition:
|
||||
equal: ["<< parameters.profile >>", core]
|
||||
steps:
|
||||
- run:
|
||||
name: Smoke packaged core over HTTP
|
||||
command: <<include(scripts/qqq_all_core_smoke.sh)>>
|
||||
- when:
|
||||
condition:
|
||||
equal: ["<< parameters.profile >>", full]
|
||||
steps:
|
||||
- run:
|
||||
name: Smoke private full Compose over HTTP
|
||||
command: python3 scripts/run_full_smoke.py
|
||||
- store_artifacts:
|
||||
path: target/smoke-diagnostics
|
||||
destination: full-smoke-diagnostics
|
||||
@@ -0,0 +1,37 @@
|
||||
description: Verify the complete qqq-all reactor once and record exact artifacts for smoke and image jobs.
|
||||
executor: java
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: "21"
|
||||
- mvn_cache_restore
|
||||
- run:
|
||||
name: Test smoke and release assertions
|
||||
command: python3 -m unittest discover -s scripts -p 'test_*.py' -v
|
||||
- run:
|
||||
name: Verify complete reactor including BOM tests and packaged integration tests
|
||||
command: mvn -B -ntp --update-snapshots clean verify
|
||||
- run:
|
||||
name: Record framework dependency classpath for smoke diagnostics
|
||||
command: <<include(scripts/qqq_all_classpath.sh)>>
|
||||
- run:
|
||||
name: Record verified artifact identity
|
||||
environment:
|
||||
QQQ_ALL_ARTIFACT_ACTION: write
|
||||
command: <<include(scripts/qqq_all_artifact.sh)>>
|
||||
- mvn_cache_save
|
||||
- store_test_results:
|
||||
path: qqq-all-app/target/surefire-reports
|
||||
- store_test_results:
|
||||
path: qqq-all-app/target/failsafe-reports
|
||||
- store_test_results:
|
||||
path: qqq-all-bom-test/target/surefire-reports
|
||||
- store_artifacts:
|
||||
path: qqq-all-app/target/site
|
||||
destination: app-reports
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- qqq-all-app/target/qqq-all-app.jar
|
||||
- qqq-all-app/target/smoke-classpath.txt
|
||||
- .qqq-ci-artifact.json
|
||||
@@ -0,0 +1,35 @@
|
||||
description: >
|
||||
Authoritative QQQ CLI validation, with optional tagged GitHub Packages publication.
|
||||
Preserves generated-schema drift, build, tests and Prism smoke before publishing.
|
||||
docker:
|
||||
- image: cimg/node:22.12
|
||||
parameters:
|
||||
publish:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Publish three workspaces with rc dist-tag; requires matching version tag and GITHUB_TOKEN"
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-cli-npm-{{ arch }}-{{ checksum "package-lock.json" }}
|
||||
- v1-cli-npm-{{ arch }}-
|
||||
- run:
|
||||
name: Install locked CLI dependencies
|
||||
command: npm ci
|
||||
- run:
|
||||
name: Validate generated client, build, tests and Prism
|
||||
command: <<include(scripts/cli_verify.sh)>>
|
||||
- save_cache:
|
||||
key: v1-cli-npm-{{ arch }}-{{ checksum "package-lock.json" }}
|
||||
paths:
|
||||
- ~/.npm
|
||||
- store_artifacts:
|
||||
path: prism.log
|
||||
destination: prism.log
|
||||
- when:
|
||||
condition: << parameters.publish >>
|
||||
steps:
|
||||
- run:
|
||||
name: Publish verified CLI packages
|
||||
command: <<include(scripts/cli_publish.sh)>>
|
||||
@@ -0,0 +1,42 @@
|
||||
description: Setup entry point for the standardized manifest-driven QQQ pipelines.
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
parameters:
|
||||
orb_version:
|
||||
type: string
|
||||
description: Explicit version matching the imported setup orb and manifest.
|
||||
manifest:
|
||||
type: string
|
||||
default: .qqq-ci.yml
|
||||
description: Repository manifest path.
|
||||
mongo_bind_diagnostics:
|
||||
type: boolean
|
||||
default: false
|
||||
description: Core owned Mongo fixture diagnostics.
|
||||
run_playwright:
|
||||
type: boolean
|
||||
default: false
|
||||
description: Material frontend Playwright validation before test or snapshot publication.
|
||||
next_acceptance_bundle_url:
|
||||
type: string
|
||||
default: ""
|
||||
description: Core Next acceptance bundle URL.
|
||||
next_acceptance_bundle_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
description: Core Next acceptance bundle SHA256.
|
||||
next_acceptance_receipt_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
description: Core Next acceptance receipt SHA256.
|
||||
steps:
|
||||
- checkout
|
||||
- generate_pipeline:
|
||||
orb_version: << parameters.orb_version >>
|
||||
manifest: << parameters.manifest >>
|
||||
mongo_bind_diagnostics: << parameters.mongo_bind_diagnostics >>
|
||||
run_playwright: << parameters.run_playwright >>
|
||||
next_acceptance_bundle_url: << parameters.next_acceptance_bundle_url >>
|
||||
next_acceptance_bundle_sha256: << parameters.next_acceptance_bundle_sha256 >>
|
||||
next_acceptance_receipt_sha256: << parameters.next_acceptance_receipt_sha256 >>
|
||||
@@ -1,27 +1,34 @@
|
||||
description: >
|
||||
Unified publishing job for all branch types
|
||||
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: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
node_version:
|
||||
type: string
|
||||
default: "20"
|
||||
description: "Node.js major version to install (e.g., '18', '20')"
|
||||
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:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
install_node: true
|
||||
node_version: << parameters.node_version >>
|
||||
- git_full_checkout
|
||||
- mvn_manage_version
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
- frontend_package
|
||||
- mvn_jar_deploy
|
||||
- when:
|
||||
condition:
|
||||
or:
|
||||
- equal: ["snapshot", << parameters.branch_type >>]
|
||||
- equal: ["release_candidate", << parameters.branch_type >>]
|
||||
steps:
|
||||
- git_operations
|
||||
- git_operations:
|
||||
branch_type: << parameters.branch_type >>
|
||||
@@ -1,12 +1,26 @@
|
||||
description: >
|
||||
Complete test-only workflow for feature branches
|
||||
Complete test-only workflow for feature branches with frontend
|
||||
Runs build, test, API version check, and documentation generation
|
||||
Used by: test_only workflow for feature branches
|
||||
Triggers: Any push to branches NOT matching develop, main, release/*, hotfix/*
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
node_version:
|
||||
type: string
|
||||
default: "20"
|
||||
description: "Node.js major version to install (e.g., '18', '20')"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
install_node: true
|
||||
node_version: << parameters.node_version >>
|
||||
- git_full_checkout
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
@@ -1,37 +1,95 @@
|
||||
description: >
|
||||
Unified publishing job for all branch types
|
||||
Handles version management, building, testing, and publishing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
Supports: snapshot, release_candidate, release (tagged), feature (tagged) and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
notify_rc_published:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Dispatch trusted RC completion after deployment and a verified version push"
|
||||
install_browsers:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Install Chrome and ChromeDriver for browser tests"
|
||||
compile_before_verify:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run preliminary compile; disable when a later lifecycle compiles the project"
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
description: "Branch type: snapshot, release_candidate, release, features, or hotfix"
|
||||
check_middleware_api_versions:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Whether to run middleware API version checks"
|
||||
publish_asciidoc:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Whether to publish AsciiDoc documentation"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- mvn_build
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
|
||||
- git_full_checkout
|
||||
|
||||
- mvn_build:
|
||||
install_browsers: << parameters.install_browsers >>
|
||||
compile_before_verify: << parameters.compile_before_verify >>
|
||||
|
||||
- mvn_manage_version
|
||||
|
||||
- attach_workspace:
|
||||
at: .
|
||||
|
||||
- mvn_verify
|
||||
|
||||
- when:
|
||||
condition: << parameters.check_middleware_api_versions >>
|
||||
steps:
|
||||
- check_middleware_api_versions
|
||||
|
||||
- mvn_jar_deploy
|
||||
|
||||
- when:
|
||||
condition:
|
||||
not:
|
||||
equal: [ "<< parameters.branch_type >>", "feature" ]
|
||||
steps:
|
||||
- git_operations:
|
||||
branch_type: << parameters.branch_type >>
|
||||
require_pushed_version: << parameters.notify_rc_published >>
|
||||
|
||||
- when:
|
||||
condition:
|
||||
and:
|
||||
- << parameters.notify_rc_published >>
|
||||
- equal: [ "<< parameters.branch_type >>", "release_candidate" ]
|
||||
steps:
|
||||
- run:
|
||||
name: Notify verified RC publication
|
||||
command: <<include(scripts/notify_rc_published.sh)>>
|
||||
|
||||
- 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: ["snapshot", << parameters.branch_type >>]
|
||||
- equal: ["release_candidate", << parameters.branch_type >>]
|
||||
- equal: [ "<< parameters.branch_type >>", "release" ]
|
||||
- equal: [ "<< parameters.branch_type >>", "hotfix" ]
|
||||
steps:
|
||||
- git_operations
|
||||
- publish_asciidoc
|
||||
- publish_github_release:
|
||||
project_type: maven
|
||||
@@ -4,17 +4,33 @@ description: >
|
||||
Used by: test_only workflow for feature branches
|
||||
Triggers: Any push to branches NOT matching develop, main, release/*, hotfix/*
|
||||
|
||||
executor: localstack/default
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
install_browsers:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Install Chrome and ChromeDriver for browser tests"
|
||||
compile_before_verify:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run preliminary compile; disable when a later lifecycle compiles the project"
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install (e.g., '17', '21')"
|
||||
check_middleware_api_versions:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Whether to run middleware API version checks"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- mvn_build
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
- git_full_checkout
|
||||
- mvn_build:
|
||||
install_browsers: << parameters.install_browsers >>
|
||||
compile_before_verify: << parameters.compile_before_verify >>
|
||||
- mvn_verify
|
||||
- when:
|
||||
condition: << parameters.check_middleware_api_versions >>
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
description: >
|
||||
Build job for Node.js applications on protected branches
|
||||
Runs checkout, install, test, and production build
|
||||
Persists build output to workspace for downstream jobs (e.g., e2e)
|
||||
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
typecheck_script:
|
||||
type: string
|
||||
default: "typecheck"
|
||||
description: "Name of the typecheck script in package.json."
|
||||
lint_script:
|
||||
type: string
|
||||
default: "lint"
|
||||
description: "Name of the lint script in package.json."
|
||||
test_script:
|
||||
type: string
|
||||
default: "test"
|
||||
description: "Name of the test script in package.json."
|
||||
build_script:
|
||||
type: string
|
||||
default: "build"
|
||||
description: "Name of the build script in package.json."
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- node_app_install:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
- node_app_test:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
typecheck_script: << parameters.typecheck_script >>
|
||||
lint_script: << parameters.lint_script >>
|
||||
test_script: << parameters.test_script >>
|
||||
- node_app_build_step:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
build_script: << parameters.build_script >>
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- .next/
|
||||
- node_modules/
|
||||
- package.json
|
||||
@@ -0,0 +1,29 @@
|
||||
description: >
|
||||
End-to-end test job for Node.js applications using Playwright
|
||||
Attaches workspace from a prior build job and runs e2e tests
|
||||
Stores JUnit results and Playwright traces as artifacts
|
||||
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
e2e_script:
|
||||
type: string
|
||||
default: "test:e2e"
|
||||
description: "Name of the e2e test script in package.json."
|
||||
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- node_app_e2e:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
e2e_script: << parameters.e2e_script >>
|
||||
@@ -0,0 +1,40 @@
|
||||
description: >
|
||||
Test-only job for Node.js application feature branches
|
||||
Runs checkout, dependency install, and test suite
|
||||
Supports: pnpm, npm, and yarn package managers
|
||||
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
typecheck_script:
|
||||
type: string
|
||||
default: "typecheck"
|
||||
description: "Name of the typecheck script in package.json."
|
||||
lint_script:
|
||||
type: string
|
||||
default: "lint"
|
||||
description: "Name of the lint script in package.json."
|
||||
test_script:
|
||||
type: string
|
||||
default: "test"
|
||||
description: "Name of the test script in package.json."
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- node_app_install:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
- node_app_test:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
typecheck_script: << parameters.typecheck_script >>
|
||||
lint_script: << parameters.lint_script >>
|
||||
test_script: << parameters.test_script >>
|
||||
@@ -3,20 +3,43 @@ description: >
|
||||
Handles version management, building, testing, and publishing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
npm_trusted_publishing:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Use CircleCI OIDC instead of NPM_TOKEN (Node >=22.14, npm >=11.5.1)."
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- git_full_checkout
|
||||
- node_install_dependencies
|
||||
- node_run_tests
|
||||
- node_manage_version
|
||||
- node_manage_version:
|
||||
branch_type: << parameters.branch_type >>
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- node_build_package
|
||||
- node_publish
|
||||
- node_publish:
|
||||
trusted_publishing: << parameters.npm_trusted_publishing >>
|
||||
|
||||
# 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 >>", "hotfix" ]
|
||||
steps:
|
||||
- publish_github_release:
|
||||
project_type: node
|
||||
@@ -3,15 +3,21 @@ description: >
|
||||
Handles testing based on branch type
|
||||
Supports: snapshot, release_candidate, release, and hotfix workflows
|
||||
|
||||
executor: localstack/default
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
branch_type:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- git_full_checkout
|
||||
- node_install_dependencies
|
||||
- node_run_tests
|
||||
@@ -0,0 +1,11 @@
|
||||
description: Render the native qctl workflow bridge. Does not build duplicate Circle binaries or publish.
|
||||
parameters:
|
||||
shared_ref:
|
||||
type: string
|
||||
description: Reviewed immutable QRun-IO/.github worker commit.
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
resource_class: small
|
||||
steps:
|
||||
- generate_qctl_workflow:
|
||||
shared_ref: << parameters.shared_ref >>
|
||||
@@ -0,0 +1,11 @@
|
||||
description: Central scheduled RC finalization sweep. Requires existing cross-repository GITHUB_TOKEN context.
|
||||
parameters:
|
||||
repositories:
|
||||
type: string
|
||||
description: Explicit JSON repository allowlist owned by the central schedule.
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
resource_class: small
|
||||
steps:
|
||||
- rc_finalize_sweep:
|
||||
repositories: << parameters.repositories >>
|
||||
@@ -0,0 +1,101 @@
|
||||
description: >
|
||||
Runs security scanning tools on a Maven project: Gitleaks (secret detection),
|
||||
Semgrep (SAST), OWASP Dependency-Check (CVE scanning), and CycloneDX (SBOM).
|
||||
All tools default to report-only mode. Use fail_on_* parameters to enforce gates.
|
||||
|
||||
Usage in consuming repo:
|
||||
workflows:
|
||||
security_scan:
|
||||
jobs:
|
||||
- qqq-orb/security_scan:
|
||||
context: [qqq-maven-registry-credentials, qqq-security-credentials]
|
||||
filters:
|
||||
branches:
|
||||
only: [develop]
|
||||
|
||||
executor: java
|
||||
|
||||
parameters:
|
||||
java_version:
|
||||
type: string
|
||||
default: "21"
|
||||
description: "Java major version to install"
|
||||
run_gitleaks:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run Gitleaks secret detection"
|
||||
run_semgrep:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run Semgrep SAST analysis"
|
||||
run_owasp:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run OWASP Dependency-Check CVE scanning"
|
||||
run_sbom:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Run CycloneDX SBOM generation"
|
||||
fail_on_gitleaks:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if Gitleaks finds secrets"
|
||||
fail_on_semgrep:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if Semgrep finds security issues"
|
||||
fail_on_owasp:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Fail the build if OWASP finds CVEs above threshold"
|
||||
semgrep_rulesets:
|
||||
type: string
|
||||
default: "p/java p/owasp-top-ten p/security-audit"
|
||||
description: "Space-separated list of Semgrep rulesets"
|
||||
owasp_cvss_threshold:
|
||||
type: string
|
||||
default: "7"
|
||||
description: "CVSS score threshold for OWASP (0-10)"
|
||||
|
||||
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 Security Analysis
|
||||
command: <<include(scripts/mvn_install_for_analysis.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: v1-dependencies-{{ checksum "pom.xml" }}
|
||||
- when:
|
||||
condition: << parameters.run_gitleaks >>
|
||||
steps:
|
||||
- run_gitleaks:
|
||||
fail_on_findings: << parameters.fail_on_gitleaks >>
|
||||
- when:
|
||||
condition: << parameters.run_semgrep >>
|
||||
steps:
|
||||
- run_semgrep:
|
||||
fail_on_findings: << parameters.fail_on_semgrep >>
|
||||
rulesets: << parameters.semgrep_rulesets >>
|
||||
- when:
|
||||
condition: << parameters.run_owasp >>
|
||||
steps:
|
||||
- run_owasp_dependency_check:
|
||||
fail_on_cvss: << parameters.fail_on_owasp >>
|
||||
cvss_threshold: << parameters.owasp_cvss_threshold >>
|
||||
- when:
|
||||
condition: << parameters.run_sbom >>
|
||||
steps:
|
||||
- run_cyclonedx_sbom
|
||||
- collect_security_reports
|
||||
- store_artifacts:
|
||||
path: /home/circleci/security-reports
|
||||
destination: security-reports
|
||||
@@ -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
|
||||
+274
-142
@@ -18,7 +18,7 @@ set -e
|
||||
###################
|
||||
## Configuration ##
|
||||
###################
|
||||
POM_FILE="pom.xml"
|
||||
POM_FILE="${POM_FILE:-pom.xml}"
|
||||
DRY_RUN=false
|
||||
|
||||
##################################
|
||||
@@ -29,13 +29,45 @@ if [[ "$1" == "--dry-run" ]]; then
|
||||
echo "DRY RUN MODE - No changes will be made"
|
||||
fi
|
||||
|
||||
################################################
|
||||
## Function to find original feature branch ##
|
||||
################################################
|
||||
find_original_feature_branch() {
|
||||
local original_branch=""
|
||||
|
||||
# Method 1: Look for remote branches containing this commit
|
||||
echo "Method 1: Checking remote branches..." >&2
|
||||
original_branch=$(git branch -r --contains HEAD 2>/dev/null | grep 'origin/feature/' | head -1 | sed 's/origin\///' | sed 's/^[[:space:]]*//' || echo "")
|
||||
if [[ -n "$original_branch" ]]; then
|
||||
echo "Found via remote branches: [$original_branch]" >&2
|
||||
fi
|
||||
|
||||
# Return the result
|
||||
if [[ "$original_branch" =~ ^feature/ ]]; then
|
||||
echo "✅ Found original feature branch: [$original_branch]" >&2
|
||||
echo "$original_branch"
|
||||
else
|
||||
echo "⚠️ Could not determine original feature branch, using generic name" >&2
|
||||
echo "feature/publish"
|
||||
fi
|
||||
}
|
||||
|
||||
####################################
|
||||
## Get current branch and version ##
|
||||
####################################
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
CURRENT_VERSION=$(grep '<revision>' $POM_FILE | sed 's/.*<revision>//;s/<.*//')
|
||||
# Try to get branch from CircleCI environment variable first (for CI environments)
|
||||
# then fall back to git command (for local development)
|
||||
if [[ -n "$CIRCLE_BRANCH" ]]; then
|
||||
echo "Using branch from CircleCI environment: $CIRCLE_BRANCH"
|
||||
CURRENT_BRANCH="$CIRCLE_BRANCH"
|
||||
else
|
||||
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
fi
|
||||
|
||||
CURRENT_VERSION=$(grep '<revision>' "$POM_FILE" | sed 's/.*<revision>//;s/<.*//')
|
||||
|
||||
# Check if we're on a tag (HEAD means we're on a tag)
|
||||
CURRENT_TAG=""
|
||||
if [[ "$CURRENT_BRANCH" == "HEAD" ]]; then
|
||||
# Get the tag name we're on
|
||||
CURRENT_TAG=$(git describe --tags --exact-match HEAD 2>/dev/null || echo "")
|
||||
@@ -49,6 +81,9 @@ if [[ "$CURRENT_BRANCH" == "HEAD" ]]; then
|
||||
echo "This is a release candidate tag, treating as release branch"
|
||||
CURRENT_BRANCH="release/${CURRENT_TAG#v}"
|
||||
CURRENT_BRANCH="release/${CURRENT_BRANCH%-RC.*}"
|
||||
elif [[ "$CURRENT_TAG" =~ ^publish- ]]; then
|
||||
echo "This is a publish tag for feature branch, treating as feature branch"
|
||||
CURRENT_BRANCH=$(find_original_feature_branch)
|
||||
else
|
||||
echo "Unknown tag format: $CURRENT_TAG"
|
||||
CURRENT_BRANCH="unknown"
|
||||
@@ -67,6 +102,12 @@ echo "Current version: $CURRENT_VERSION"
|
||||
############################################
|
||||
extract_version_parts() {
|
||||
local version=$1
|
||||
|
||||
# Remove 'v' prefix if present
|
||||
if [[ "$version" =~ ^v(.+)$ ]]; then
|
||||
version=${BASH_REMATCH[1]}
|
||||
fi
|
||||
|
||||
########################################
|
||||
## Handle RC versions like 1.5.0-RC.1 ##
|
||||
########################################
|
||||
@@ -81,6 +122,14 @@ extract_version_parts() {
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
#############################################################
|
||||
## Handle feature-specific versions like 1.5.0-NEW-abc1234-SNAPSHOT ##
|
||||
## or 1.4.0-test-new-orb-825957d-SNAPSHOT ##
|
||||
#############################################################
|
||||
elif [[ "$version" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-[a-zA-Z0-9-]+-[a-f0-9]+-SNAPSHOT$ ]]; then
|
||||
MAJOR=${BASH_REMATCH[1]}
|
||||
MINOR=${BASH_REMATCH[2]}
|
||||
PATCH=${BASH_REMATCH[3]}
|
||||
#######################################
|
||||
## Handle stable versions like 1.5.0 ##
|
||||
#######################################
|
||||
@@ -94,139 +143,6 @@ extract_version_parts() {
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################################
|
||||
## Function to calculate next version based on branch type ##
|
||||
#############################################################
|
||||
calculate_next_version() {
|
||||
local branch=$1
|
||||
|
||||
case "$branch" in
|
||||
"develop")
|
||||
#############################################################################
|
||||
## Check if we just merged a release branch back to develop ##
|
||||
## Look for very specific patterns that indicate a release completion ##
|
||||
## Only look at recent commits to avoid historical merges triggering bumps ##
|
||||
#############################################################################
|
||||
RECENT_RELEASE_MERGES=$(git log --oneline -10 --grep="Merge.*release.*into.*develop" --grep="Merge.*release.*back.*develop" --grep="Bump.*version.*after.*release.*v" --since="3 days ago" || true)
|
||||
|
||||
#######################################################################
|
||||
## Also check if current version suggests we're ready for next cycle ##
|
||||
#######################################################################
|
||||
if [[ -n "$RECENT_RELEASE_MERGES" ]] || [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]] || [[ "$CURRENT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
#########################################################################
|
||||
## We just merged a release or have an RC/stable version, bump to next ##
|
||||
#########################################################################
|
||||
NEW_VERSION="$MAJOR.$((MINOR + 1)).0-SNAPSHOT"
|
||||
else
|
||||
################################################################
|
||||
## Keep current SNAPSHOT version - no recent release activity ##
|
||||
################################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
;;
|
||||
|
||||
"main")
|
||||
###############################################################################
|
||||
## Main should always have stable versions ##
|
||||
## Check for version tags to detect releases instead of merge commits ##
|
||||
###############################################################################
|
||||
echo "In Main - Looking for the most recent version tag"
|
||||
|
||||
# If we're on a tag, use that tag; otherwise find the latest tag
|
||||
if [[ "$CURRENT_BRANCH" == "main" && -n "$CURRENT_TAG" ]]; then
|
||||
LATEST_TAG="$CURRENT_TAG"
|
||||
echo "Using current tag: $LATEST_TAG"
|
||||
else
|
||||
LATEST_TAG=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "")
|
||||
echo "Found latest tag: $LATEST_TAG"
|
||||
fi
|
||||
|
||||
if [[ -n "$LATEST_TAG" ]]; then
|
||||
# Extract version from tag (e.g., v1.5.0 -> 1.5.0)
|
||||
if [[ "$LATEST_TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||
TAG_VERSION=${BASH_REMATCH[1]}
|
||||
echo "Release tag: $LATEST_TAG (version: $TAG_VERSION)"
|
||||
|
||||
# Check if current version matches the tag
|
||||
if [[ "$CURRENT_VERSION" == "$TAG_VERSION" ]]; then
|
||||
################################################################
|
||||
## We're at the tagged release, keep stable version ##
|
||||
################################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Version matches release tag, keeping stable version"
|
||||
elif [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||
########################################################################
|
||||
## We have an RC version, convert to the tag version ##
|
||||
########################################################################
|
||||
NEW_VERSION="$TAG_VERSION"
|
||||
echo "Converting RC version to tag version: $NEW_VERSION"
|
||||
else
|
||||
#####################################################################
|
||||
## Keep current version (might be ahead of tag) ##
|
||||
#####################################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current version (ahead of tag)"
|
||||
fi
|
||||
else
|
||||
echo "Warning: Tag format not recognized: $LATEST_TAG"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
else
|
||||
#####################################################################
|
||||
## No tags found - main branch should always have a release tag ##
|
||||
#####################################################################
|
||||
echo "ERROR: No version tags found on main branch"
|
||||
echo "Main branch should always have a corresponding release tag (e.g., v1.5.0)"
|
||||
echo "Please create a release tag before deploying from main"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
release/*)
|
||||
############################################################################
|
||||
## Extract major.minor from branch name (e.g., release/1.5 -> 1.5.0-RC.n) ##
|
||||
############################################################################
|
||||
if [[ "$branch" =~ release/([0-9]+)\.([0-9]+) ]]; then
|
||||
BRANCH_MAJOR=${BASH_REMATCH[1]}
|
||||
BRANCH_MINOR=${BASH_REMATCH[2]}
|
||||
|
||||
############################################
|
||||
## Check if we already have an RC version ##
|
||||
############################################
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-RC\.([0-9]+)$ ]]; then
|
||||
################################################
|
||||
## Extract current RC number and increment it ##
|
||||
################################################
|
||||
CURRENT_RC=${BASH_REMATCH[4]}
|
||||
NEW_RC=$((CURRENT_RC + 1))
|
||||
NEW_VERSION="$BRANCH_MAJOR.$BRANCH_MINOR.0-RC.$NEW_RC"
|
||||
else
|
||||
###############################
|
||||
## First RC for this release ##
|
||||
###############################
|
||||
NEW_VERSION="$BRANCH_MAJOR.$BRANCH_MINOR.0-RC.1"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Invalid release branch format: $branch"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
hotfix/*)
|
||||
###################################
|
||||
## Bump patch version for hotfix ##
|
||||
###################################
|
||||
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
|
||||
;;
|
||||
|
||||
feature/*|*)
|
||||
###############################################################
|
||||
## Feature branches inherit version from develop, no changes ##
|
||||
###############################################################
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#########################################
|
||||
## Function to set version using Maven ##
|
||||
@@ -237,7 +153,6 @@ set_version() {
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "DRY RUN: Would set version to: $new_version"
|
||||
echo "Command: mvn versions:set-property -Dproperty=revision -DnewVersion=$new_version -DgenerateBackupPoms=false"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
@@ -247,12 +162,11 @@ set_version() {
|
||||
## Use Maven versions plugin to set version ##
|
||||
##############################################
|
||||
mvn versions:set-property -Dproperty=revision -DnewVersion="$new_version" -DgenerateBackupPoms=false
|
||||
|
||||
|
||||
#######################
|
||||
## Verify the change ##
|
||||
#######################
|
||||
ACTUAL_VERSION=$(grep "<revision>" $POM_FILE | sed 's/.*<revision>//;s/<.*//')
|
||||
ACTUAL_VERSION=$(grep "<revision>" "$POM_FILE" | sed 's/.*<revision>//;s/<.*//')
|
||||
if [[ "$ACTUAL_VERSION" == "$new_version" ]]; then
|
||||
echo "✅ Version successfully updated to: $ACTUAL_VERSION"
|
||||
else
|
||||
@@ -261,6 +175,195 @@ set_version() {
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################
|
||||
## Branch Detection and Routing Functions ##
|
||||
#############################################
|
||||
|
||||
detect_branch_type() {
|
||||
local branch=$1
|
||||
|
||||
if [[ "$branch" == "main" ]]; then
|
||||
echo "main"
|
||||
elif [[ "$branch" == "develop" ]]; then
|
||||
echo "develop"
|
||||
elif [[ "$branch" =~ ^release/ ]]; then
|
||||
echo "release"
|
||||
elif [[ "$branch" =~ ^hotfix/ ]]; then
|
||||
echo "hotfix"
|
||||
elif [[ "$branch" =~ ^feature/ ]]; then
|
||||
echo "feature"
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
#############################################
|
||||
## Branch-Specific Version Handlers ##
|
||||
#############################################
|
||||
|
||||
handle_main_branch() {
|
||||
echo "=== Handling MAIN branch ==="
|
||||
echo "Main branch should always have stable versions"
|
||||
echo "Looking for the most recent version tag"
|
||||
|
||||
# If we're on a tag, use that tag; otherwise find the latest tag
|
||||
local latest_tag=""
|
||||
if [[ -n "$CURRENT_TAG" ]]; then
|
||||
latest_tag="$CURRENT_TAG"
|
||||
echo "Using current tag: $latest_tag"
|
||||
else
|
||||
latest_tag=$(git describe --tags --abbrev=0 --match="v*" 2>/dev/null || echo "")
|
||||
echo "Found latest tag: $latest_tag"
|
||||
fi
|
||||
|
||||
if [[ -n "$latest_tag" ]]; then
|
||||
# Extract version from tag (e.g., v1.5.0 -> 1.5.0)
|
||||
if [[ "$latest_tag" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||
local tag_version=${BASH_REMATCH[1]}
|
||||
echo "Release tag: $latest_tag (version: $tag_version)"
|
||||
|
||||
# Check if current version matches the tag
|
||||
if [[ "$CURRENT_VERSION" == "$tag_version" ]]; then
|
||||
echo "Version matches release tag, keeping stable version"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
elif [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||
echo "Converting RC version to tag version: $tag_version"
|
||||
NEW_VERSION="$tag_version"
|
||||
else
|
||||
NEW_VERSION="$tag_version"
|
||||
fi
|
||||
else
|
||||
echo "Warning: Tag format not recognized: $latest_tag"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: No version tags found on main branch"
|
||||
echo "Main branch should always have a corresponding release tag (e.g., v1.5.0)"
|
||||
echo "Please create a release tag before deploying from main"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
handle_develop_branch() {
|
||||
echo "=== Handling DEVELOP branch ==="
|
||||
echo "Develop branch manages SNAPSHOT versions"
|
||||
|
||||
# Check if we just merged a release branch back to develop
|
||||
local recent_release_merges
|
||||
recent_release_merges=$(git log --oneline -10 --grep="Merge.*release.*into.*develop" --grep="Merge.*release.*back.*develop" --grep="Bump.*version.*after.*release.*v" --since="3 days ago" || true)
|
||||
|
||||
# Also check if current version suggests we're ready for next cycle
|
||||
if [[ -n "$recent_release_merges" ]] || [[ "$CURRENT_VERSION" =~ -RC\.[0-9]+$ ]] || [[ "$CURRENT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Recent release activity detected or RC/stable version found"
|
||||
echo "Bumping to next minor version SNAPSHOT"
|
||||
NEW_VERSION="$MAJOR.$((MINOR + 1)).0-SNAPSHOT"
|
||||
else
|
||||
echo "No recent release activity, keeping current SNAPSHOT version"
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
fi
|
||||
}
|
||||
|
||||
handle_release_branch() {
|
||||
echo "=== Handling RELEASE branch ==="
|
||||
echo "Release branch manages RC versions"
|
||||
|
||||
# Extract major.minor from branch name (e.g., release/1.5 -> 1.5.0-RC.n)
|
||||
if [[ "$CURRENT_BRANCH" =~ release/([0-9]+)\.([0-9]+) ]]; then
|
||||
local branch_major=${BASH_REMATCH[1]}
|
||||
local branch_minor=${BASH_REMATCH[2]}
|
||||
|
||||
echo "Release branch: $branch_major.$branch_minor"
|
||||
|
||||
# Check if we already have an RC version
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-RC\.([0-9]+)$ ]]; then
|
||||
# Extract current RC number and increment it
|
||||
local current_rc=${BASH_REMATCH[4]}
|
||||
local new_rc=$((current_rc + 1))
|
||||
echo "Incrementing RC from $current_rc to $new_rc"
|
||||
NEW_VERSION="$branch_major.$branch_minor.0-RC.$new_rc"
|
||||
else
|
||||
# First RC for this release
|
||||
echo "Creating first RC for this release"
|
||||
NEW_VERSION="$branch_major.$branch_minor.0-RC.1"
|
||||
fi
|
||||
else
|
||||
echo "ERROR: Invalid release branch format: $CURRENT_BRANCH"
|
||||
echo "Expected format: release/X.Y (e.g., release/1.5)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
handle_hotfix_branch() {
|
||||
echo "=== Handling HOTFIX branch ==="
|
||||
echo "Hotfix branch bumps patch version"
|
||||
|
||||
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
|
||||
echo "Bumping patch version: $CURRENT_VERSION -> $NEW_VERSION"
|
||||
}
|
||||
|
||||
handle_feature_branch() {
|
||||
echo "=== Handling FEATURE branch ==="
|
||||
echo "Feature branches create unique SNAPSHOT versions"
|
||||
|
||||
# Extract feature name from branch (e.g., feature/new-feature -> new-feature)
|
||||
local feature_name
|
||||
if [[ "$CURRENT_BRANCH" =~ ^feature/(.+)$ ]]; then
|
||||
feature_name=${BASH_REMATCH[1]}
|
||||
else
|
||||
feature_name="unknown"
|
||||
fi
|
||||
|
||||
# Create safe abbreviation (first 3 characters, uppercase)
|
||||
local feature_abbrev
|
||||
feature_abbrev=$(echo "$feature_name" | cut -c1-100 | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
# Generate short commit hash
|
||||
local commit_hash
|
||||
commit_hash=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||
|
||||
# Create unique SNAPSHOT version
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-SNAPSHOT$ ]]; then
|
||||
# Convert SNAPSHOT to feature-specific version
|
||||
local base_version=${BASH_REMATCH[1]}
|
||||
NEW_VERSION="$base_version-$feature_abbrev-$commit_hash-SNAPSHOT"
|
||||
echo "Creating feature-specific version: $NEW_VERSION"
|
||||
elif [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
|
||||
# Convert stable version to feature-specific SNAPSHOT
|
||||
NEW_VERSION="$CURRENT_VERSION-$feature_abbrev-$commit_hash-SNAPSHOT"
|
||||
echo "Converting stable version to feature-specific SNAPSHOT: $NEW_VERSION"
|
||||
else
|
||||
# Check if it's already a feature-specific format
|
||||
if [[ "$CURRENT_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)-([A-Z]{3})-([a-f0-9]{7})-SNAPSHOT$ ]]; then
|
||||
local base_version=${BASH_REMATCH[1]}
|
||||
local existing_abbrev=${BASH_REMATCH[2]}
|
||||
local existing_hash=${BASH_REMATCH[3]}
|
||||
|
||||
# Check if the commit hash has changed
|
||||
if [[ "$existing_hash" != "$commit_hash" ]]; then
|
||||
# Update to new commit hash
|
||||
NEW_VERSION="$base_version-$existing_abbrev-$commit_hash-SNAPSHOT"
|
||||
echo "Updating feature-specific version with new commit hash: $NEW_VERSION"
|
||||
else
|
||||
# Keep current version if commit hash hasn't changed
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current feature-specific version: $NEW_VERSION"
|
||||
fi
|
||||
else
|
||||
# Unknown format, keep as-is
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current version (unknown format): $NEW_VERSION"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
handle_unknown_branch() {
|
||||
echo "=== Handling UNKNOWN branch ==="
|
||||
echo "Unknown branch type, keeping current version"
|
||||
|
||||
NEW_VERSION="$CURRENT_VERSION"
|
||||
echo "Keeping current version: $NEW_VERSION"
|
||||
}
|
||||
|
||||
####################
|
||||
## Main execution ##
|
||||
####################
|
||||
@@ -278,9 +381,38 @@ main() {
|
||||
echo ""
|
||||
|
||||
############################
|
||||
## Calculate next version ##
|
||||
## Detect branch type and route ##
|
||||
############################
|
||||
calculate_next_version "$CURRENT_BRANCH"
|
||||
local branch_type
|
||||
branch_type=$(detect_branch_type "$CURRENT_BRANCH")
|
||||
echo "Detected branch type: $branch_type"
|
||||
echo ""
|
||||
|
||||
############################
|
||||
## Route to appropriate handler ##
|
||||
############################
|
||||
case "$branch_type" in
|
||||
"main")
|
||||
handle_main_branch
|
||||
;;
|
||||
"develop")
|
||||
handle_develop_branch
|
||||
;;
|
||||
"release")
|
||||
handle_release_branch
|
||||
;;
|
||||
"hotfix")
|
||||
handle_hotfix_branch
|
||||
;;
|
||||
"feature")
|
||||
handle_feature_branch
|
||||
;;
|
||||
*)
|
||||
handle_unknown_branch
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
echo "Calculated next version: $NEW_VERSION"
|
||||
echo ""
|
||||
|
||||
@@ -296,7 +428,7 @@ main() {
|
||||
###################
|
||||
echo ""
|
||||
echo "Changes made:"
|
||||
git diff $POM_FILE
|
||||
git diff "$POM_FILE"
|
||||
else
|
||||
echo "No version change needed. Current version is correct for branch: $CURRENT_BRANCH"
|
||||
fi
|
||||
|
||||
Loaded 100 of 221 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user