Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04a929aae9 | ||
|
|
1c389210e6 | ||
|
|
9438ab0762 | ||
|
|
7fed7eee82 | ||
|
|
ed880fcb77 | ||
|
|
50fa564006 | ||
|
|
35e5312fc7 | ||
|
|
99ac8dec53 | ||
|
|
859eb4badb | ||
|
|
357aba57bc | ||
|
|
fb86d1a4a7 | ||
|
|
e9eb225480 | ||
|
|
09dac40a1e | ||
|
|
07a8f5cec2 | ||
|
|
c4f7b5ba76 | ||
|
|
3fd8baeda9 | ||
|
|
1334ababf1 | ||
|
|
3ca2b71ffa | ||
|
|
df9113296e | ||
|
|
9b73a4ed5f | ||
|
|
aa865fefd5 | ||
|
|
a5d10e8c1c | ||
|
|
4f1e5e663d | ||
|
|
898862a095 | ||
|
|
21403d2287 | ||
|
|
2675bb7a36 | ||
|
|
12eccc9e7d | ||
|
|
9e2652d735 | ||
|
|
c4e41dea6b | ||
|
|
4562d5c2d2 | ||
|
|
322a194c05 | ||
|
|
a92d6d13bb | ||
|
|
9772090684
|
||
|
|
ab666bb785 | ||
|
|
fc39293b9d
|
||
|
|
e83b8481b9 | ||
|
|
e4ecae6294
|
||
|
|
37b91db07b | ||
|
|
c30d821f7e
|
||
|
|
6ae688dcf4 | ||
|
|
78207c16be
|
||
|
|
efd50aee2f | ||
|
|
6dd473be25
|
||
|
|
1c8a7c57e5 | ||
|
|
abaebf50ff
|
||
|
|
c56e52d4cb | ||
|
|
09046d45b0
|
||
|
|
9e9e6c1fa5 | ||
|
|
45aaccd2a9 | ||
|
|
ab77962b6a | ||
|
|
d0792d60d6 | ||
|
|
72f5f4d4e7 | ||
|
|
00af9aae31 | ||
|
|
7e60372948 | ||
|
|
45bab9d960 | ||
|
|
f304afb0be | ||
|
|
f76b9f7a7c | ||
|
|
fdf62a2f5a | ||
|
|
94341ef481 | ||
|
|
2debeada5d | ||
|
|
6febeff590 | ||
|
|
8b58a45f35 | ||
|
|
fbe36d683d | ||
|
|
bd5ee3bec5 | ||
|
|
d4d6e97df0 | ||
|
|
c288a8864f | ||
|
|
9906c8f120 | ||
|
|
4dcf2c1891 | ||
|
|
cc30f599e6 | ||
|
|
05a2a5217a | ||
|
|
7d73ac90b6 | ||
|
|
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 |
No files matched your search
@@ -1,5 +1,12 @@
|
||||
version: 2.1
|
||||
setup: true
|
||||
parameters:
|
||||
run_rc_finalize_sweep:
|
||||
type: boolean
|
||||
default: false
|
||||
run_enrollment_reconcile:
|
||||
type: boolean
|
||||
default: false
|
||||
orbs:
|
||||
orb-tools: circleci/orb-tools@12.3
|
||||
shellcheck: circleci/shellcheck@3.2
|
||||
@@ -8,8 +15,43 @@ filters: &filters
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
jobs:
|
||||
enrollment-reconcile:
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
resource_class: small
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install reconciliation tools
|
||||
command: |
|
||||
bash tools/install_reconcile_gh.sh
|
||||
python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
- run:
|
||||
name: Reconcile current QQQ branches
|
||||
no_output_timeout: 21m
|
||||
command: python3 tools/run_enrollment.py
|
||||
- store_artifacts:
|
||||
path: artifacts/enrollment
|
||||
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:
|
||||
or:
|
||||
- << pipeline.parameters.run_rc_finalize_sweep >>
|
||||
- << pipeline.parameters.run_enrollment_reconcile >>
|
||||
jobs:
|
||||
- orb-tools/lint:
|
||||
filters: *filters
|
||||
@@ -27,3 +69,23 @@ 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: /.*/
|
||||
reconcile-enrollment:
|
||||
when: << pipeline.parameters.run_enrollment_reconcile >>
|
||||
jobs:
|
||||
- enrollment-reconcile:
|
||||
context: [qqq-maven-registry-credentials, orb-publishing]
|
||||
filters:
|
||||
branches:
|
||||
only: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
@@ -22,6 +22,87 @@ main-filters: &main-filters
|
||||
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
|
||||
- run:
|
||||
name: Verify calculated versions match installed Maven coordinates
|
||||
command: python3 tests/test_effective_publication_version.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 tests/test_marketing_link_check.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_qbit_hotfix_profile.py
|
||||
python3 tests/test_qbit_feature_profile.py
|
||||
python3 tests/test_ci_maintenance.py
|
||||
python3 tests/test_rollout_version.py
|
||||
python3 tests/test_enforce_orb_checks.py
|
||||
python3 tests/test_native_next_gates.py
|
||||
python3 tests/test_native_gitops_gates.py
|
||||
python3 tests/test_native_specialist_gates.py
|
||||
python3 tests/test_enroll_consumers.py
|
||||
python3 tests/test_reconcile_enrollment.py
|
||||
python3 tests/test_discover_enrollment.py
|
||||
python3 tests/test_finish_enrollment.py
|
||||
python3 tests/test_run_enrollment.py
|
||||
python3 tests/test_install_reconcile_gh.py
|
||||
python3 tests/test_circle_project_settings.py
|
||||
python3 tests/test_static_analysis_exit.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_qbit_codeql.py
|
||||
sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends shellcheck
|
||||
python3 tests/test_repository_policy.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_browser_install.sh
|
||||
bash tests/test_frontend_build_reuse.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:
|
||||
@@ -102,13 +183,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
|
||||
- pipeline-contract-test:
|
||||
filters: *filters
|
||||
- maven-publication-contract:
|
||||
filters: *filters
|
||||
# Auto-publish dev snapshot on develop
|
||||
- publish-dev-snapshot:
|
||||
context: orb-publishing
|
||||
filters: *develop-filters
|
||||
requires: [command-test]
|
||||
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]
|
||||
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,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,60 @@
|
||||
name: QBit CodeQL
|
||||
'on':
|
||||
workflow_call:
|
||||
permissions:
|
||||
contents: read
|
||||
actions: read
|
||||
security-events: write
|
||||
packages: read
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze branch source
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Select languages present in this checkout
|
||||
id: languages
|
||||
run: |
|
||||
python3 <<'PY'
|
||||
import os
|
||||
from pathlib import PurePosixPath
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
files = subprocess.check_output(['git', 'ls-files', '-z']).decode('utf-8').split('\0')
|
||||
extensions = {PurePosixPath(name).suffix.lower() for name in files if name}
|
||||
languages = []
|
||||
if extensions & {'.java', '.kt', '.kts'}:
|
||||
languages.append('java-kotlin')
|
||||
if extensions & {'.js', '.jsx', '.mjs', '.cjs', '.ts', '.tsx', '.mts', '.cts'}:
|
||||
languages.append('javascript-typescript')
|
||||
if '.py' in extensions:
|
||||
languages.append('python')
|
||||
if '.rb' in extensions:
|
||||
languages.append('ruby')
|
||||
if any((name.startswith('.github/workflows/') and PurePosixPath(name).suffix in {'.yml', '.yaml'})
|
||||
or PurePosixPath(name).name in {'action.yml', 'action.yaml'} for name in files if name):
|
||||
languages.append('actions')
|
||||
if not languages:
|
||||
sys.exit('No supported source in this branch; classify placeholders before enabling QBit scanning')
|
||||
build_mode = 'autobuild' if extensions & {'.kt', '.kts'} else 'none'
|
||||
with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as output:
|
||||
output.write('languages=' + ','.join(languages) + '\n')
|
||||
output.write('build-mode=' + build_mode + '\n')
|
||||
PY
|
||||
- uses: actions/setup-java@v4
|
||||
if: steps.languages.outputs.build-mode == 'autobuild'
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ steps.languages.outputs.languages }}
|
||||
build-mode: ${{ steps.languages.outputs.build-mode }}
|
||||
- name: Build Kotlin sources
|
||||
if: steps.languages.outputs.build-mode == 'autobuild'
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
- name: Analyze source
|
||||
uses: github/codeql-action/analyze@v4
|
||||
@@ -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; the CircleCI publisher 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") in ("publish_release_candidate", "verify") 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') not in ('publish_release_candidate', 'verify') 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') != workflow.get('workflow_name')
|
||||
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') in ('publish_release_candidate', 'verify') 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
|
||||
@@ -10,3 +10,7 @@ tests/test_data
|
||||
.idea
|
||||
|
||||
.claude
|
||||
|
||||
# Local Python regression-test caches.
|
||||
__pycache__/
|
||||
*.pyc
|
||||
@@ -24,6 +24,7 @@ help:
|
||||
|
||||
# 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
|
||||
@@ -46,9 +47,56 @@ test-scripts:
|
||||
@echo "✅ Script tests passed!"
|
||||
|
||||
# Test all: run both orb tests and script tests
|
||||
test-all: test test-scripts
|
||||
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_qbit_hotfix_profile.py
|
||||
python3 tests/test_ci_maintenance.py
|
||||
python3 tests/test_rollout_version.py
|
||||
python3 tests/test_enforce_orb_checks.py
|
||||
python3 tests/test_enroll_consumers.py
|
||||
python3 tests/test_reconcile_enrollment.py
|
||||
python3 tests/test_discover_enrollment.py
|
||||
python3 tests/test_finish_enrollment.py
|
||||
python3 tests/test_static_analysis_exit.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_qbit_codeql.py
|
||||
python3 tests/test_repository_policy.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..."
|
||||
@@ -172,3 +220,10 @@ publish-release: check-clean check-branch lint clean dev test-all
|
||||
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
|
||||
python3 tests/test_effective_publication_version.py
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
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.
|
||||
For centrally managed patch adoption and exact-version rollback, see
|
||||
[managed patch updates](docs/managed-patch-updates.md).
|
||||
|
||||
**For:** Teams using CircleCI to build, test, and publish QQQ applications
|
||||
**Status:** Stable (v0.6.x)
|
||||
|
||||
@@ -84,6 +89,11 @@ real publication, not a dry run, verifies the trust relationship.
|
||||
| `hotfix/1.5.1` | `1.5.1` |
|
||||
| `feature/*` | `1.5.0-feature-abc1234-SNAPSHOT` |
|
||||
|
||||
The Maven version step verifies the effective `project.version`, not only the
|
||||
`revision` property. For older POMs with a literal project version, it uses
|
||||
Maven's version plugin to align project and reactor coordinates with the
|
||||
calculated version. A mismatch after updating fails before publication.
|
||||
|
||||
### Java Version
|
||||
|
||||
Maven jobs run on Ubuntu machine executors with Temurin JDK. Default is Java 21. To use Java 17:
|
||||
@@ -111,6 +121,21 @@ Maven jobs use machine executors with Docker pre-installed. Tests using Testcont
|
||||
|
||||
## Orb Publishing
|
||||
|
||||
### QBit CI maintenance
|
||||
|
||||
The QBit profile runs Maven verification without publishing when a single-parent
|
||||
`ci: ...` or `ci(scope): ...` commit changes only `.qqq-ci.yml`,
|
||||
`.circleci/config.yml`, `.github/workflows/codeql.yml`, or
|
||||
`.github/workflows/release-rc.yml`. This applies on
|
||||
main, develop, release, and hotfix branches. The normal test job still runs,
|
||||
including on branches normally excluded from feature tests, and reports through
|
||||
the required `verify` workflow.
|
||||
|
||||
Tags, merge commits (including release automation), application changes, other
|
||||
files, empty diffs, and unavailable history retain normal publishing behavior.
|
||||
This lets central configuration updates avoid unnecessary application versions
|
||||
without introducing per-repository maintenance workflows.
|
||||
|
||||
The orb auto-publishes via CircleCI:
|
||||
|
||||
| Branch | Action |
|
||||
|
||||
@@ -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,143 @@
|
||||
# Estate audit policy
|
||||
|
||||
`tools/audit_estate.py` classifies repositories from explicit mappings and observed source.
|
||||
It never changes consumers, branch rules or publication settings.
|
||||
|
||||
Source auditing reads the repository's current default branch unless
|
||||
`--live --source-branch main` (or an explicit `release/...` or `hotfix/...` branch)
|
||||
is supplied. Run separate audits for each maintained source branch: a clean
|
||||
default-branch report does not establish conformity on main or release branches.
|
||||
The selected branch is resolved to an immutable commit before any files are read.
|
||||
Reports identify both `source_branch` and the repository's `default_branch`;
|
||||
the manifest's `default_branch` must still match the repository default.
|
||||
Unavailable selected branches remain unknown without falling back to default.
|
||||
Explicit branch selection requires live lookup and cannot relabel an offline SHA.
|
||||
Required-check policy still controls which branch settings are inspected;
|
||||
`--source-branch` changes source selection, not that enforcement policy.
|
||||
|
||||
- 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
|
||||
|
||||
For a standard QBit without a manifest, start directly on the managed patch
|
||||
track using `python tools/standardize_qbit.py /checkout --orb-version 0.8
|
||||
--default-branch main`. Inspect the preview, then repeat with `--write`.
|
||||
This preserves the inferred publication and branch-filter policy while writing
|
||||
the same track to the manifest and setup caller. Use `rollout_version.py` below
|
||||
for repositories that already have a manifest. Neither command configures
|
||||
repository protection or automatically enrolls newly created repositories.
|
||||
|
||||
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
|
||||
```
|
||||
|
||||
## Live organization discovery
|
||||
|
||||
Use `--organization QRun-IO --live` instead of `--inventory inventory.json` to
|
||||
include newly created repositories on each audit. Discovery uses the existing
|
||||
`gh` authentication and all API pages, retaining archived entries for explicit
|
||||
skip reporting. Unknown repositories receive no automatic exemption. Duplicate,
|
||||
empty, malformed or failed discovery aborts instead of reusing a stale inventory.
|
||||
|
||||
```sh
|
||||
python tools/audit_estate.py --organization QRun-IO --live --orb-version 0.8 \
|
||||
--worker-sha <40SHA> --policy observed-checks.json --output audit.json
|
||||
```
|
||||
|
||||
The organization mode has no fixed repository-count ceiling. Supply
|
||||
`--expected-active N` for an independent count check when needed; saved-inventory
|
||||
mode preserves its default of 68. Reports identify the inventory source and
|
||||
credential visibility limit: inaccessible repositories cannot be certified.
|
||||
This is discovery and audit, not automatic enrollment or branch-rule mutation.
|
||||
|
||||
For a qualified batch of canonical orb branches, use the shared
|
||||
[branch-check enforcement command](branch-enforcement.md). It adds the observed
|
||||
CircleCI setup/verify gates while preserving other protections. Source enrollment,
|
||||
scanner transitions and scheduled reconciliation remain separate requirements.
|
||||
Scheduling and authenticated onboarding still need to be configured centrally.
|
||||
|
||||
## Batch enrollment
|
||||
|
||||
Use [the shared enrollment command](consumer-enrollment.md) to convert recognized
|
||||
legacy QBits and update existing canonical consumers in one validated batch.
|
||||
@@ -0,0 +1,248 @@
|
||||
# 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 | verify | existing mvn_publish, snapshot |
|
||||
| release/* | verify | existing mvn_publish, release_candidate |
|
||||
| vX.Y.Z tag resolving to the checkout | verify | existing mvn_publish, release |
|
||||
| main, feature/*, hotfix/*, other/unknown branch | verify | existing mvn_test_only |
|
||||
| Disabled publication or unrecognized/unproven tag | verify | full verification, no publication |
|
||||
|
||||
Generated `qbit`, `core`, `frontend-core`, and `frontend-material` pipelines use
|
||||
the stable workflow name `verify`. All selected jobs, dependencies and filters
|
||||
remain intact; this adds no executor or duplicate build. Other profiles retain
|
||||
their existing workflow names and native checks.
|
||||
|
||||
When upgrading from legacy workflow names, upgrade the immutable RC worker pin
|
||||
alongside the orb so finalization recognizes both names. Confirm the CircleCI
|
||||
app's successful `verify` check on the exact migration commit before replacing
|
||||
legacy required contexts. Require `setup` and `verify` on managed branches,
|
||||
preserving other required checks and controls. Human approval is not required;
|
||||
automated checks authorize the migration.
|
||||
|
||||
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 supports
|
||||
both keys as explicit opt-ins (false by default). QBit feature publishing requires
|
||||
a `publish*` tag resolving to the checked-out commit; feature branch pushes remain
|
||||
test-only. 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 `verify` 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.
|
||||
|
||||
## Node snapshot versions
|
||||
|
||||
The shared Node publisher calculates develop snapshots as
|
||||
`MAJOR.MINOR.NEXT_PATCH-SNAPSHOT.CIRCLE_BUILD_NUM`. A positive CircleCI job number
|
||||
is required, so independent publication jobs receive distinct npm coordinates.
|
||||
The package version is changed only in the build workspace and published under
|
||||
the `snapshot` dist-tag. No snapshot version commit is pushed: the branch remains
|
||||
at the source revision whose required checks ran, avoiding unchecked `[skip ci]`
|
||||
heads and recursive publication. Stable, RC and hotfix version policies are unchanged.
|
||||
|
||||
## 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,46 @@
|
||||
# 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 baseline fixture records the original Munitor 0.3.11 render. The shared
|
||||
profile selects one workflow for the current branch and exposes it as `verify`:
|
||||
PR checks for feature/hotfix/automation branches, develop, staging, release
|
||||
candidate, or production for main. Tags and the RC bookkeeping branch do not
|
||||
run these jobs. Existing deployment dependencies and contexts are preserved.
|
||||
|
||||
The build job installs dependencies once, lints, builds, runs Chromium
|
||||
Playwright tests, crawls local links and runs Lighthouse. The link crawl waits
|
||||
at most 60 attempts for the app on port 3005, propagates failures, and stops its
|
||||
server on exit. Playwright and Lighthouse reports are retained as artifacts,
|
||||
including on failure. The old synthetic coverage job was removed because it
|
||||
fabricated 100% rather than measuring coverage; actual tests and scans remain.
|
||||
|
||||
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.
|
||||
|
||||
Consumers need only the QQQ caller and `.qqq-ci.yml`. Before tests, the shared
|
||||
profile writes minimal `.munitor.yml` worker input into the build workspace:
|
||||
`pipeline: node-webapp`, Node 22, and `docker.use_repo_dockerfile: true`.
|
||||
Munitor's Docker worker still requires this file; the orb owns its contents.
|
||||
This preserves the repository Dockerfile rather than generating a replacement.
|
||||
Container health remains `/` on port 3000, distinct from the local test server
|
||||
on port 3005. The repository Dockerfile remains responsible for the standalone
|
||||
runtime without npm or npx.
|
||||
|
||||
The duplicate consumer GitHub test workflow can be removed only after these
|
||||
central checks qualify. Application test settings and assertions remain in the
|
||||
application repository; orchestration belongs here.
|
||||
|
||||
`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,12 @@
|
||||
# Shared QBit source scanning
|
||||
|
||||
Generate the thin caller with `python3 src/scripts/generate_auxiliary_workflow.py qbit-codeql --ref <immutable-worker-sha>`.
|
||||
The reusable worker selects supported languages from tracked files in the actual checked-out branch. Historical Java branches therefore do not request an absent Actions database. Java, JavaScript/TypeScript, Python and Actions share one job; Kotlin selects an actual build instead of silently omitting Kotlin from no-build Java analysis.
|
||||
|
||||
The caller scans pull requests, main/develop/release/hotfix pushes and weekly, cancels superseded PR scans, and contains no scan implementation. Set `codeql_worker_sha` in the estate enforcement policy to require the exact canonical caller independently of other native worker pins. Existing default-setup repositories remain unchanged until migrated.
|
||||
|
||||
Roll out to both active default and maintained branches. Verify the worker on representative branch contents and preserve existing query coverage before replacing GitHub default setup; do not run duplicate default and advanced scanners permanently. Default setup cannot select languages independently for historical branches. A branch with no supported application or workflow source is a placeholder to classify, not a passing application scan.
|
||||
|
||||
Local tests execute the embedded language-selection step against real git indexes, including absent Actions, untracked generated files, mixed source, Kotlin and placeholders. Hosted CodeQL database creation and SARIF upload must also pass before claiming rollout completion.
|
||||
|
||||
References: [GitHub setup types](https://docs.github.com/en/code-security/concepts/code-scanning/setup-types) and [CodeQL build modes](https://docs.github.com/en/code-security/reference/code-scanning/codeql/build-options-for-compiled-languages).
|
||||
@@ -0,0 +1,63 @@
|
||||
# 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`, `non-release-no-hotfix`, `non-release-no-main-hotfix`, `feature-no-hotfix` | Selects an audited test branch exclusion. |
|
||||
| `publish.hotfix` | boolean, default false | Runs the existing Maven hotfix publisher for nonempty `hotfix/*` branch events only when explicitly enabled. |
|
||||
|
||||
`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.
|
||||
The three hotfix exclusions preserve the corresponding legacy policies while
|
||||
the single shared publisher handles hotfix events. Existing manifests do not
|
||||
enable hotfix publication implicitly; migration enables it only when the source
|
||||
configuration contains the recognized hotfix publisher and branch filter.
|
||||
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"], manifest["publish"].get("feature", False))`; the legacy one-argument
|
||||
form is only for manifests without an explicit policy.
|
||||
|
||||
`publish.feature` is false by default. Opting in enables the audited `publish*`
|
||||
tag contract, with the tag required to resolve to the checked-out commit. The
|
||||
canonical setup admits those tags alongside the declared release tag policy.
|
||||
Feature branch pushes remain test-only. Migration accepts Workflows' exact legacy
|
||||
literal `feature/.*` branch selector (not a regular expression); Git forbids `*`
|
||||
in branch names, so that selector cannot publish a branch. Unknown feature
|
||||
filters require a central profile change rather than silently broadening triggers.
|
||||
|
||||
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.
|
||||
Fifteen additional main-branch fixtures exercise 195 branch/tag cases,
|
||||
checking both test and publication selection. Source and packed generator tests
|
||||
also verify hotfix opt-in, its boolean validation, and unchanged main behavior.
|
||||
CMS's original YAML is retained with its immutable source SHA: its unquoted
|
||||
stable-tag regex is invalid YAML. The fixture repairs only that quoting. Both
|
||||
audited spellings of the stable regex map to the same ASCII-digit tag policy;
|
||||
arbitrary regexes remain rejected.
|
||||
|
||||
CI-only commits on publishing branches retain Maven verification without publishing when their changes are limited to the manifest, CircleCI caller, shared scanner caller, RC caller, or schema-drift caller. The commit must have one parent and a conventional ci title. Tags, application POMs, schema resources, tests, and other application inputs retain normal publication behavior. Canonical caller enforcement separately verifies the shared workflow definition and immutable worker pin.
|
||||
@@ -0,0 +1,16 @@
|
||||
# Application-free branch verification
|
||||
|
||||
Use `profile: repository-policy` only on a branch containing repository policies,
|
||||
documentation, workflow configuration and optional unused Maven wrappers. It uses
|
||||
the same canonical setup caller as other profiles and one small Python verification
|
||||
job. It checks tracked YAML/JSON syntax and rejects application manifests, source
|
||||
files, unknown file types and symlinks. It never builds or publishes an application.
|
||||
|
||||
The manifest accepts only `profile`, `orb_version` and `default_branch`. The latter
|
||||
remains the repository's actual default branch. A future application promotion must
|
||||
select its real build profile in the same change; adding source without doing so fails.
|
||||
|
||||
Estate policy can set `branch_profiles: {main: repository-policy}` without changing
|
||||
the default branch's application profile. Require the CircleCI `setup` and `verify`
|
||||
checks on the policy branch. This profile does not establish application release
|
||||
readiness or replace the build/release checks on source-bearing 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,66 @@
|
||||
# Shared orb check enforcement
|
||||
|
||||
`tools/enforce_orb_checks.py` replaces repository-specific scripts for the shared
|
||||
CircleCI `setup` and `verify` branch gates. One invocation processes an explicit
|
||||
batch of current `main` and `develop` branches using existing `gh` authentication.
|
||||
|
||||
Create a targets file:
|
||||
|
||||
```json
|
||||
[
|
||||
{"repository": "QRun-IO/qbit-example", "branch": "main"},
|
||||
{"repository": "QRun-IO/qbit-example", "branch": "develop"}
|
||||
]
|
||||
```
|
||||
|
||||
Preview, then apply the same batch:
|
||||
|
||||
```sh
|
||||
python tools/enforce_orb_checks.py --targets targets.json --orb-version 0.8 --output enforcement-plan.json
|
||||
python tools/enforce_orb_checks.py --targets targets.json --orb-version 0.8 --output enforcement-result.json --apply
|
||||
```
|
||||
|
||||
Every branch must already contain the exact canonical caller for its manifest and
|
||||
have successful `setup` and `verify` checks from CircleCI app 18001 at its current
|
||||
commit. Supported profiles are QBit, Core, frontend-core, frontend-material and repository-policy.
|
||||
The complete batch is inspected before any mutation. Source/head/protection drift,
|
||||
unavailable APIs and unknown profiles fail closed. Existing repository rulesets are verified as described below.
|
||||
|
||||
The tool appends the app-bound checks, enables strict checks and administrator
|
||||
enforcement, and reads the result back. Existing required checks remain required.
|
||||
For protected branches it uses the narrow status-check/admin endpoints, preserving
|
||||
reviews, signatures, linear history, restrictions and other settings. For a
|
||||
previously unprotected branch it creates protection without adding human reviews.
|
||||
It never changes scanner configuration, repository visibility, billing, or source.
|
||||
|
||||
Output records the planned head and original protection, then verification as each
|
||||
branch completes. A batch is not transactional: if an API call fails, inspect the
|
||||
output and rerun; successful protections are retained rather than rolled back.
|
||||
An already-correct branch needs no mutation.
|
||||
|
||||
This command covers the shared orb gate pair only. Continue to run the estate
|
||||
audit for scanner/native-worker requirements and other policy. Automatic repository
|
||||
discovery, source enrollment and scheduled reconciliation remain separate work.
|
||||
|
||||
GitHub API reference: [protected branches](https://docs.github.com/en/rest/branches/branch-protection).
|
||||
|
||||
```sh
|
||||
python -m unittest discover -s tests -p test_enforce_orb_checks.py -v
|
||||
```
|
||||
|
||||
## Existing rulesets
|
||||
|
||||
When effective branch rules come from repository rulesets, the tool can verify
|
||||
existing enforcement without adding classic protection. Each contributing ruleset
|
||||
must be active for branches, have no bypass actors and require both setup and
|
||||
verify from CircleCI app18001. The current branch must also have successful gate
|
||||
runs. The tool rechecks the branch, effective rules and full ruleset records before
|
||||
reporting verified. Rule drift or an unbound/missing gate stops verification.
|
||||
|
||||
This path writes nothing. It preserves scanner requirements, conditions and the
|
||||
existing up-to-date-branch policy, including a false strict setting that avoids
|
||||
unnecessary rebuilds. Reports identify protection_mode=rulesets and the observed
|
||||
strict value. Unsupported organization-level rulesets, bypass actors and missing
|
||||
gates remain unresolved rather than being rewritten or ignored.
|
||||
|
||||
For classic protection with an empty push allowlist and admin enforcement disabled, the tool leaves the entire classic policy unchanged. After current-head gates pass, it creates a narrowly scoped active repository ruleset requiring app-bound setup and verify with no bypass actors. This enforces CI even for administrators without changing their existing branch access or locking all actors out. The ruleset retains the fleet freshness policy (strict=false); it does not weaken any existing classic policy. A same-named ruleset causes rejection rather than overwrite or duplication. Readback verifies the effective gates and unchanged classic protection; subsequent runs recognize the existing ruleset without writes.
|
||||
@@ -0,0 +1,152 @@
|
||||
# Batch consumer enrollment
|
||||
|
||||
Use one target file for canonical consumers of every supported Circle profile and
|
||||
legacy QBits whose jobs and publication filters the shared converter recognizes:
|
||||
|
||||
```json
|
||||
[
|
||||
{"checkout": "/work/qbit-example", "default_branch": "main"},
|
||||
{"checkout": "/work/qqq", "default_branch": "develop"}
|
||||
]
|
||||
```
|
||||
|
||||
The branch values must come from repository inventory. Run on clean isolated
|
||||
checkouts of the branches being migrated.
|
||||
|
||||
```sh
|
||||
python tools/enroll_consumers.py targets.json --orb-version 0.8
|
||||
python tools/enroll_consumers.py targets.json --orb-version 0.8 --write
|
||||
```
|
||||
|
||||
The command validates the entire batch before writing. Existing manifests keep
|
||||
all publication and profile options; only the managed orb version changes.
|
||||
Recognized legacy QBits receive the canonical caller and inferred publication
|
||||
policy. An unknown job, filter, profile option, duplicate target, symlink, or
|
||||
concurrent declaration edit rejects the batch. Repeating a completed enrollment
|
||||
makes no changes. Filesystem errors during the write phase can leave a partial
|
||||
batch; rerun after correcting the error. This is not a filesystem transaction.
|
||||
|
||||
Only `.circleci/config.yml` and `.qqq-ci.yml` are changed. The tool does not delete
|
||||
other workflows, infer publication from repository names, or enroll unknown
|
||||
custom pipelines. Their behavior must first be represented by a central profile.
|
||||
After committing and qualifying the exact source, apply the shared
|
||||
[branch enforcement tool](branch-enforcement.md) to supported gate profiles.
|
||||
|
||||
This command provides batch source conversion. Use the coordinator below for remote signed submissions. Local conversion alone does not prove fleet deployment or release success.
|
||||
|
||||
## Remote signed submissions
|
||||
|
||||
Supply observed current branches, without cloning each repository yourself:
|
||||
|
||||
```json
|
||||
[
|
||||
{"repository": "QRun-IO/qbit-example", "branch": "main"},
|
||||
{"repository": "QRun-IO/qqq", "branch": "develop"}
|
||||
]
|
||||
```
|
||||
|
||||
```sh
|
||||
python tools/reconcile_enrollment.py --targets remote-targets.json --orb-version 0.8 --output plan.json
|
||||
python tools/reconcile_enrollment.py --targets remote-targets.json --orb-version 0.8 --output result.json --apply
|
||||
```
|
||||
|
||||
Use existing `gh` authentication with repository write access. The coordinator
|
||||
never installs credentials or changes authentication. Every target is inspected
|
||||
at an immutable head and validated before any remote mutation. No repository
|
||||
clone, SSH key or local signing key is required. A moved target stops submission;
|
||||
refresh the plan instead of overwriting it.
|
||||
|
||||
An automation branch derives from the source commit and proposed declarations.
|
||||
The coordinator creates the branch at the observed base and uses GitHub's
|
||||
`createCommitOnBranch` API with `expectedHeadOid` for an atomic append. GitHub
|
||||
signs the commit when supported by the authenticated identity; the coordinator
|
||||
requires remote signature verification, exact parent, changed paths and
|
||||
declaration bytes before opening a PR. It never force-updates a branch.
|
||||
An interrupted branch creation, commit or PR creation can be resumed:
|
||||
an existing branch still at the planned base receives the missing commit;
|
||||
matching signed branches and PRs are reused. A mismatched branch is rejected.
|
||||
Closed existing PRs are reported as existing; they are not silently reopened.
|
||||
Reports include repository, branch, immutable head and submission URL, without
|
||||
embedding declaration contents or credentials. Keep the report if a later target
|
||||
fails; earlier valid submissions remain intact.
|
||||
|
||||
API permission, signature or commit-conflict failures stop the run. A timeout
|
||||
can occur after GitHub accepted a mutation, so inspect remote state or repeat
|
||||
the same invocation; do not create a different automation branch to retry.
|
||||
See [GitHub commit API documentation](https://docs.github.com/en/graphql/reference/commits#createcommitonbranch).
|
||||
|
||||
This handles remote target lists and signed submissions. Organization discovery is described below. Qualification-aware merging and classic branch enforcement are described below; scheduling and ruleset reconciliation remain separate work. A submitted PR is not a completed migration. Unknown profiles and
|
||||
native workflows require their own central conversion, not deletion by this tool.
|
||||
|
||||
## Organization discovery
|
||||
|
||||
The coordinator can select observed current branches directly from GitHub:
|
||||
|
||||
```sh
|
||||
python tools/reconcile_enrollment.py --organization QRun-IO --orb-version 0.8 --output organization-plan.json
|
||||
python tools/reconcile_enrollment.py --organization QRun-IO --orb-version 0.8 --output organization-result.json --apply
|
||||
```
|
||||
|
||||
Repository and branch inventories are paginated. Only existing main/develop
|
||||
branches are considered; historical release branches are excluded. Archived
|
||||
repositories and the orb's own bootstrap repository are reported separately.
|
||||
Each supported branch receives the same immutable preflight as explicit targets.
|
||||
Unknown workflows, missing entrypoints, unsupported branch layouts and unavailable
|
||||
APIs stay `unresolved` in the output. They are never counted as conforming or
|
||||
silently converted. No-CI and native-only repositories may therefore appear as
|
||||
unresolved here; use the estate auditor for their separate policy classification.
|
||||
|
||||
Discovery finishes before any submission. `--apply` processes qualified plans
|
||||
and retains unresolved entries for follow-up; one unsupported repository does
|
||||
not prevent independent valid submissions. An explicit `--targets` batch keeps
|
||||
its stricter behavior: any preflight failure stops the whole batch. By default neither mode merges PRs or changes branch protections. Use the explicit completion flags below.
|
||||
|
||||
## Qualification and enforcement
|
||||
|
||||
```sh
|
||||
python tools/reconcile_enrollment.py --targets remote-targets.json --orb-version 0.8 --output result.json --apply --merge-ready --enforce
|
||||
```
|
||||
|
||||
Both flags require `--apply` and are optional. `--merge-ready` revalidates the
|
||||
signed submission, exact parent/files/content and current base, requires successful
|
||||
CircleCI-app `setup` and `verify` checks and every advertised latest check/status,
|
||||
then requests a normal exact-head squash merge. It never uses admin override or
|
||||
force pushes. The resulting signed merge must have the qualified source tree.
|
||||
Pending/failed checks and changed bases are reported without merging. Repeated
|
||||
runs can advance the same PR once checks complete; there is no polling loop that
|
||||
holds a CI executor open.
|
||||
|
||||
`--enforce` independently checks the actual current target branch, which must
|
||||
pass its own orb gates before shared classic protection enforcement. Existing
|
||||
protections and other required checks are preserved. Supported gate profiles are
|
||||
QBit, Core, frontend-core, frontend-material and repository-policy. Other profiles
|
||||
remain explicitly unsupported for completion even when source enrollment works.
|
||||
Existing active repository rulesets with app-bound gates and no bypass actors are verified without writes. Unsupported or incomplete rulesets remain unresolved; none are rewritten or layered with classic protection. API/plan restrictions remain visible.
|
||||
|
||||
A merged source update and an enforced branch are separate reported outcomes.
|
||||
Neither proves artifact publication or deployment. Scheduling and ruleset
|
||||
reconciliation remain outstanding.
|
||||
|
||||
## Central hosted pass
|
||||
|
||||
The orb owner's CircleCI config accepts `run_enrollment_reconcile: true` on
|
||||
`main`. This selects one small Python container instead of the normal orb
|
||||
build/publication workflow. It uses the existing
|
||||
`qqq-maven-registry-credentials` context's GitHub token through `gh`.
|
||||
No consumer-specific runner configuration or local signing key is needed.
|
||||
|
||||
`tools/run_enrollment.py` verifies the owner repository and main branch, runs
|
||||
organization discovery, signed enrollment, qualified merging and enforcement,
|
||||
then exits. The pass has a 20-minute execution limit. Pending checks are reported
|
||||
for the next pass rather than polled while a paid executor waits. Incremental
|
||||
results and execution status are retained under `artifacts/enrollment`, including
|
||||
when execution fails or times out. A completed pass does not mean every repository
|
||||
conforms: unresolved and waiting entries remain explicit follow-up work.
|
||||
|
||||
Create a single daily CircleCI schedule for the owner project only after a manual
|
||||
main-branch pass verifies its hosted credentials and results. Set `branch: main`
|
||||
and `run_enrollment_reconcile: true` in the schedule parameters. Scheduling is
|
||||
an external project setting; merging this config does not itself enable a schedule.
|
||||
Keep the existing RC-finalization parameter false for these runs. A timed-out
|
||||
GitHub request may already have succeeded remotely; the next pass resumes from
|
||||
the deterministic branch and verified source rather than forcing updates.
|
||||
@@ -0,0 +1,70 @@
|
||||
# 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.
|
||||
|
||||
The shared registry includes marketing-website-cd and voyage-cd. Daily enrollment recognizes their canonical main-branch caller without creating Circle configuration. Recognition requires a signed immutable worker pin matching the supported worker, a complete source tree, and no additional Circle or GitHub workflows. Enforcement requires the GitHub Actions app-bound gitops / validate gate and preserves existing branch rules. Unavailable private-repository protections remain an explicit enforcement failure; recognition alone is not enforcement.
|
||||
|
||||
|
||||
### Documentation repositories with shell automation
|
||||
|
||||
Use the canonical `repository-policy` manifest with `shell_checks: true` for
|
||||
repositories containing documentation, YAML/JSON, Mermaid source, and shell tools.
|
||||
The shared job remains one small executor with no publication or deployment.
|
||||
It installs ShellCheck only for this opt-in and checks every tracked `.sh` file
|
||||
with `bash -n` and ShellCheck at warning severity; scripts are never executed.
|
||||
Mermaid files are treated as UTF-8 documentation, not rendered or syntax-validated.
|
||||
Application manifests and other executable languages still require a build profile.
|
||||
|
||||
|
||||
### Homebrew distribution taps
|
||||
|
||||
The `homebrew-tap` profile takes only `tap` (lowercase owner/name) and `formula`.
|
||||
One small job in a digest-pinned Homebrew container validates the exact checkout,
|
||||
reads all OS/architecture variants, fetches their binaries with checksum verification,
|
||||
then installs and tests the Linux formula. It does not publish or update formulae.
|
||||
macOS downloads are verified, but this Linux job does not execute macOS binaries.
|
||||
|
||||
|
||||
### Application template acceptance
|
||||
|
||||
The `application-template` profile renders the checked-out template through pinned
|
||||
qctl code and a checksum-verified catalog. It runs transforms but never post-generation
|
||||
hooks, then performs Maven verify on the generated application with all its tests.
|
||||
The renderer and Maven dependencies are cached; test reports and the generated JAR
|
||||
are retained. This is acceptance of a generated consumer, not Maven publication.
|
||||
Only the standard profile, orb version, and default branch are consumer settings.
|
||||
|
||||
The coordinator also recognizes qctl on main/develop and the approved .github,
|
||||
business-platform, MCP-RAG and IntelliJ callers on main. It verifies each complete
|
||||
workflow inventory, canonical caller, signed immutable orb pin and matching shared
|
||||
worker source before recognizing the repository. Native verification gates bind to
|
||||
the GitHub Actions app; release-only jobs are not merge requirements. No CircleCI
|
||||
caller is added to these native consumers. qctl requires its shared tests; the native binary job is push-only, and
|
||||
full platform release builds retain their existing shared-worker policy.
|
||||
|
||||
Existing classic branch protections without a required-status-check section gain
|
||||
an additive shared ruleset. Signing, reviews, history and access restrictions remain
|
||||
unchanged, and a subsequent reconciliation verifies the effective ruleset.
|
||||
|
||||
The same daily pass manages CircleCI's native `autocancel-builds` setting for
|
||||
canonical `repository-policy`, `homebrew-tap`, `application-template`, and
|
||||
`marketing` consumers. Marketing must retain `main` as its default branch;
|
||||
environment deployment remains main-only. CircleCI excludes default-branch,
|
||||
scheduled and rerun workflows from automatic cancellation. This avoids a custom
|
||||
cancellation job and does not add executions to consumer pipelines.
|
||||
|
||||
The pass uses the existing orb-publishing context on the trusted orb main branch.
|
||||
It changes only the cancellation flag, checks for source movement before writing,
|
||||
and verifies preservation of all other flags. Its separate
|
||||
`result.circle-settings.json` artifact records missing credentials/API access,
|
||||
unconverted sources and profiles needing cancellation-policy review explicitly.
|
||||
Publication-heavy profiles are not changed until their non-default release
|
||||
semantics are reviewed; a successful reconciliation pass does not certify them.
|
||||
|
||||
Because cancellation is project-wide, eligibility requires every discovered current main/develop branch to be canonical and use a reviewed profile. An unresolved branch or an unreviewed publishing profile prevents enabling the flag, regardless of branch order. The report lists all observed profiles.
|
||||
@@ -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,37 @@
|
||||
# Managed patch updates
|
||||
|
||||
The canonical caller and manifest accept either an exact stable version such as
|
||||
`0.8.0` or a quoted minor track such as `"0.8"`. CircleCI resolves a minor track
|
||||
to its latest published patch. A major-only version, `latest`, `volatile`, and
|
||||
wildcards are rejected. The caller import, setup parameter, and manifest must
|
||||
still agree exactly.
|
||||
|
||||
Use a minor track after qualifying that release line. Future patch fixes then
|
||||
arrive on the repository's next pipeline without a version-bump PR or an extra
|
||||
fleet-wide build. Existing exact pins remain supported and are not changed by
|
||||
publishing this capability. YAML minor versions must be quoted to remain strings.
|
||||
|
||||
The central batch tool applies the same update to all supplied checkouts:
|
||||
|
||||
```sh
|
||||
python3 tools/rollout_version.py --orb-version 0.8 --write /path/to/repo1 /path/to/repo2
|
||||
```
|
||||
|
||||
This changes only the two canonical CI declarations. Publication policies,
|
||||
contexts, branch/tag filters, and profile options stay unchanged. Normal source
|
||||
and publication checks still run when a pipeline is triggered; this setting does
|
||||
not skip tests. GitHub reusable-worker commit pins are separate and unchanged.
|
||||
|
||||
Automatic patch adoption trades exact-version reproducibility for centrally
|
||||
managed fixes. Keep patch releases backward compatible, qualify central changes
|
||||
before production publication, and use an exact stable pin for a canary or
|
||||
rollback. For example, the same tool can move a consumer from `0.8` back to
|
||||
`0.8.0`. Historical pipeline reruns can resolve a newer patch; choose an exact
|
||||
pin when reproducing an earlier run. Setup and continuation each resolve their
|
||||
orb imports, so patch compatibility also matters when publication overlaps a run.
|
||||
|
||||
Changing minor tracks is an explicit migration. Do not use this feature to push
|
||||
breaking changes into a patch release or to bypass repository checks.
|
||||
|
||||
Reference: [CircleCI orb semantic versioning](https://circleci.com/docs/orbs/use/orb-concepts/).
|
||||
|
||||
@@ -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,120 @@
|
||||
# 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 `verify` (or legacy
|
||||
`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/
|
||||
|
||||
### Auditing independent worker revisions
|
||||
|
||||
The estate audit accepts `rc_worker_sha` in a profile or repository policy. For
|
||||
example, set `profiles.qbit.rc_worker_sha` to the approved immutable RC worker
|
||||
commit and keep `--worker-sha` at the approved revision for unchanged native
|
||||
workers. The audit still compares every caller to its exact canonical template
|
||||
and rejects mutable or mismatched pins. This avoids a fleet-wide native caller
|
||||
update when only RC release behavior changes. Required-check policy is separate;
|
||||
omitting it continues to report enforcement as unknown.
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/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"), ("REPOSITORY_POLICY_TEMPLATE", "repository-policy"), ("MARKETING_TEMPLATE", "marketing"), ("HOMEBREW_TEMPLATE", "homebrew-tap"), ("APPLICATION_TEMPLATE", "application-template")):
|
||||
resource = (source.parent / "templates" / (name + ".json")).read_text(encoding="utf-8").encode("utf-8")
|
||||
payload = base64.b64encode(zlib.compress(resource, 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")
|
||||
@@ -10,6 +10,11 @@ description: >
|
||||
- Collects JUnit XML test results
|
||||
- Stores test results and screenshots
|
||||
- Saves Maven cache for future builds
|
||||
parameters:
|
||||
build_before_test:
|
||||
type: boolean
|
||||
default: true
|
||||
description: "Build the React app first; combined jobs already build it with frontend_build"
|
||||
steps:
|
||||
# Ensure no stale Chrome/Driver is shadowing the PATH (your base image had Chrome 109)
|
||||
- run:
|
||||
@@ -17,7 +22,7 @@ steps:
|
||||
command: <<include(scripts/frontend_test_cleanup.sh)>>
|
||||
|
||||
# Install current Chrome; DO NOT install chromedriver (let Selenium 4 auto-manage it)
|
||||
- browser-tools/install-chrome
|
||||
- install_chrome
|
||||
|
||||
# System libs Chrome needs in headless CI
|
||||
- run:
|
||||
@@ -52,6 +57,8 @@ steps:
|
||||
# GPG signing will happen later in mvn_jar_deploy when deploying to Maven Central.
|
||||
- run:
|
||||
name: Build app, start server, run tests
|
||||
environment:
|
||||
PARAM_BUILD_BEFORE_TEST: << parameters.build_before_test >>
|
||||
command: <<include(scripts/frontend_test_run.sh)>>
|
||||
|
||||
# Always collect and publish test results & screenshots
|
||||
|
||||
@@ -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)>>
|
||||
@@ -5,6 +5,10 @@ description: >
|
||||
- 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"
|
||||
@@ -19,4 +23,5 @@ steps:
|
||||
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,5 @@
|
||||
description: Install stable Chrome using only its signed repository and existing Ubuntu dependency indexes.
|
||||
steps:
|
||||
- run:
|
||||
name: Install Google Chrome
|
||||
command: <<include(scripts/install_chrome.sh)>>
|
||||
@@ -1,6 +1,7 @@
|
||||
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).
|
||||
|
||||
|
||||
+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:
|
||||
- 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,11 +1,16 @@
|
||||
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
|
||||
|
||||
parameters:
|
||||
skip_verified_analysis:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Skip repeated SpotBugs and PMD only after this job has completed mvn_verify"
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Setup Maven Settings
|
||||
@@ -15,6 +20,11 @@ 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
|
||||
environment:
|
||||
QQQ_SKIP_VERIFIED_ANALYSIS: << parameters.skip_verified_analysis >>
|
||||
command: <<include(scripts/mvn_jar_deploy.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
|
||||
@@ -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)>>
|
||||
|
||||
@@ -3,7 +3,7 @@ description: >
|
||||
- Adds SSH keys for Git operations
|
||||
- Sets up Git identity for version commits
|
||||
- Synchronizes NPM version
|
||||
- Commits version changes if modified (skipped for feature branches)
|
||||
- Commits version changes if modified (skipped for feature and snapshot builds)
|
||||
|
||||
parameters:
|
||||
branch_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,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)>>
|
||||
@@ -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 >>
|
||||
@@ -27,7 +27,8 @@ steps:
|
||||
- git_full_checkout
|
||||
- mvn_manage_version
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
- frontend_test:
|
||||
build_before_test: false
|
||||
- frontend_package
|
||||
- mvn_jar_deploy
|
||||
- git_operations:
|
||||
|
||||
@@ -23,4 +23,5 @@ steps:
|
||||
node_version: << parameters.node_version >>
|
||||
- git_full_checkout
|
||||
- frontend_build
|
||||
- frontend_test
|
||||
- frontend_test:
|
||||
build_before_test: false
|
||||
@@ -6,6 +6,18 @@ description: >
|
||||
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"
|
||||
@@ -29,7 +41,9 @@ steps:
|
||||
|
||||
- git_full_checkout
|
||||
|
||||
- mvn_build
|
||||
- mvn_build:
|
||||
install_browsers: << parameters.install_browsers >>
|
||||
compile_before_verify: << parameters.compile_before_verify >>
|
||||
|
||||
- mvn_manage_version
|
||||
|
||||
@@ -43,7 +57,8 @@ steps:
|
||||
steps:
|
||||
- check_middleware_api_versions
|
||||
|
||||
- mvn_jar_deploy
|
||||
- mvn_jar_deploy:
|
||||
skip_verified_analysis: true
|
||||
|
||||
- when:
|
||||
condition:
|
||||
@@ -52,6 +67,17 @@ steps:
|
||||
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 >>
|
||||
|
||||
@@ -7,6 +7,14 @@ description: >
|
||||
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"
|
||||
@@ -20,7 +28,9 @@ steps:
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
- git_full_checkout
|
||||
- mvn_build
|
||||
- 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,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 >>
|
||||
@@ -161,7 +161,7 @@ set_version() {
|
||||
##############################################
|
||||
## Use Maven versions plugin to set version ##
|
||||
##############################################
|
||||
mvn versions:set-property -Dproperty=revision -DnewVersion="$new_version" -DgenerateBackupPoms=false
|
||||
mvn -f "$POM_FILE" versions:set-property -Dproperty=revision -DnewVersion="$new_version" -DgenerateBackupPoms=false
|
||||
|
||||
#######################
|
||||
## Verify the change ##
|
||||
@@ -175,6 +175,26 @@ set_version() {
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_project_version() {
|
||||
local expected=$1 actual
|
||||
# A revision property can exist without being used by project.version.
|
||||
# Ask Maven for the effective coordinate, including inherited configuration.
|
||||
actual=$(mvn -f "$POM_FILE" -q -Dstyle.color=never \
|
||||
org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
|
||||
-Dexpression=project.version -DforceStdout)
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
mvn -f "$POM_FILE" -B versions:set -DnewVersion="$expected" -DgenerateBackupPoms=false
|
||||
actual=$(mvn -f "$POM_FILE" -q -Dstyle.color=never \
|
||||
org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
|
||||
-Dexpression=project.version -DforceStdout)
|
||||
fi
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
echo "ERROR: Effective project version is $actual; expected $expected" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Verified effective project version: $actual"
|
||||
}
|
||||
|
||||
#############################################
|
||||
## Branch Detection and Routing Functions ##
|
||||
#############################################
|
||||
@@ -434,6 +454,9 @@ main() {
|
||||
fi
|
||||
|
||||
echo ""
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
ensure_project_version "$NEW_VERSION"
|
||||
fi
|
||||
echo "=== Version calculation complete ==="
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Validate tag and fixed package destinations before asking for credentials.
|
||||
node --input-type=commonjs - <<'NODE'
|
||||
const fs = require('node:fs');
|
||||
const packages = [
|
||||
['packages/ui-api-client/package.json', '@qrun-io/qqq-ui-api-client'],
|
||||
['packages/conformance/package.json', '@qrun-io/qqq-ui-api-conformance'],
|
||||
['packages/cli/package.json', '@qrun-io/qqq-cli'],
|
||||
];
|
||||
for (const [path, expectedName] of packages) {
|
||||
const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
|
||||
if (pkg.name !== expectedName || pkg.publishConfig?.registry !== 'https://npm.pkg.github.com') {
|
||||
throw new Error('Unexpected GitHub Packages destination: ' + path);
|
||||
}
|
||||
}
|
||||
const client = JSON.parse(fs.readFileSync(packages[0][0], 'utf8'));
|
||||
if (!process.env.CIRCLE_TAG || process.env.CIRCLE_TAG !== 'v' + client.version) {
|
||||
throw new Error('Version tag must match the client package version');
|
||||
}
|
||||
NODE
|
||||
: "${GITHUB_TOKEN:?GitHub Packages write credential GITHUB_TOKEN is required}"
|
||||
export NODE_AUTH_TOKEN="$GITHUB_TOKEN"
|
||||
# Store only an environment substitution, never the token itself.
|
||||
npm_config=$(mktemp)
|
||||
chmod 600 "$npm_config"
|
||||
trap 'rm -f "$npm_config"' EXIT
|
||||
cat > "$npm_config" <<'NPMRC'
|
||||
@qrun-io:registry=https://npm.pkg.github.com
|
||||
//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}
|
||||
NPMRC
|
||||
export NPM_CONFIG_USERCONFIG="$npm_config"
|
||||
# Fail closed if the Circle context token cannot authenticate to this registry.
|
||||
# Authentication alone is not proof of package write permission; hosted publish
|
||||
# migration remains gated on verifying the actual context's package access.
|
||||
npm whoami --registry https://npm.pkg.github.com >/dev/null
|
||||
npm publish -w @qrun-io/qqq-ui-api-client --registry https://npm.pkg.github.com --tag rc
|
||||
npm publish -w @qrun-io/qqq-ui-api-conformance --registry https://npm.pkg.github.com --tag rc
|
||||
npm publish -w @qrun-io/qqq-cli --registry https://npm.pkg.github.com --tag rc
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
npm run generate
|
||||
git diff --exit-code -- packages/ui-api-client/src/schema.ts
|
||||
npm run build
|
||||
npm test
|
||||
|
||||
# Use the locked local executable; never download an unpinned npx fallback.
|
||||
./node_modules/.bin/prism mock --port 4010 packages/ui-api-client/openapi/qqq-v1.json > prism.log 2>&1 &
|
||||
prism_pid=$!
|
||||
cleanup() {
|
||||
kill "$prism_pid" 2>/dev/null || true
|
||||
wait "$prism_pid" 2>/dev/null || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
ready=false
|
||||
for ((attempt = 0; attempt < 30; attempt++)); do
|
||||
if ! kill -0 "$prism_pid" 2>/dev/null; then
|
||||
echo "Prism exited before readiness; see prism.log" >&2
|
||||
exit 1
|
||||
fi
|
||||
if curl --connect-timeout 2 --max-time 3 -fsS http://127.0.0.1:4010/qqq/v1/version >/dev/null; then
|
||||
ready=true
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
if [[ "$ready" != true ]]; then
|
||||
echo "Prism readiness timed out; see prism.log" >&2
|
||||
exit 1
|
||||
fi
|
||||
curl --connect-timeout 2 --max-time 3 -fsS http://127.0.0.1:4010/qqq/v1/metaData/authentication >/dev/null
|
||||
@@ -208,50 +208,73 @@ REQUEST_BODY=$(jq -n \
|
||||
generate_release_notes: true
|
||||
}')
|
||||
|
||||
# Create the release with retry logic
|
||||
MAX_RETRIES=2
|
||||
RETRY_COUNT=0
|
||||
|
||||
while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do
|
||||
HTTP_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$REQUEST_BODY" \
|
||||
"$API_URL")
|
||||
|
||||
HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed '$d')
|
||||
HTTP_CODE=$(echo "$HTTP_RESPONSE" | tail -n1)
|
||||
|
||||
if [[ "$HTTP_CODE" -ge 200 ]] && [[ "$HTTP_CODE" -lt 300 ]]; then
|
||||
RELEASE_URL=$(echo "$HTTP_BODY" | jq -r '.html_url')
|
||||
echo "GitHub release created successfully: $RELEASE_URL"
|
||||
exit 0
|
||||
elif [[ "$HTTP_CODE" -ge 500 ]]; then
|
||||
echo "Server error (HTTP $HTTP_CODE), retrying..."
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
sleep 2
|
||||
elif [[ "$HTTP_CODE" == "422" ]]; then
|
||||
# Check if release already exists
|
||||
if echo "$HTTP_BODY" | grep -q "already_exists"; then
|
||||
echo "Release for $TAG_NAME already exists, skipping"
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR: GitHub API returned HTTP $HTTP_CODE"
|
||||
echo "$HTTP_BODY"
|
||||
# Don't fail the build - artifacts are already published
|
||||
echo "WARNING: GitHub release creation failed, but artifacts are published"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "ERROR: GitHub API returned HTTP $HTTP_CODE"
|
||||
echo "$HTTP_BODY"
|
||||
# Don't fail the build - artifacts are already published
|
||||
echo "WARNING: GitHub release creation failed, but artifacts are published"
|
||||
exit 0
|
||||
# Keep response bodies private: errors can contain repository details or echoed input.
|
||||
request_release() {
|
||||
local method="$1" url="$2"
|
||||
local args=(-s --connect-timeout 10 --max-time 60 -w "\n%{http_code}" -X "$method"
|
||||
-H "Accept: application/vnd.github.v3+json"
|
||||
-H "Authorization: token $GITHUB_TOKEN")
|
||||
if [[ "$method" == POST ]]; then
|
||||
args+=(-H "Content-Type: application/json" -d "$REQUEST_BODY")
|
||||
fi
|
||||
done
|
||||
if ! HTTP_RESPONSE=$(curl "${args[@]}" "$url"); then
|
||||
echo "ERROR: GitHub release request failed at the transport layer"
|
||||
return 1
|
||||
fi
|
||||
HTTP_BODY=$(printf '%s\n' "$HTTP_RESPONSE" | sed '$d')
|
||||
HTTP_CODE=$(printf '%s\n' "$HTTP_RESPONSE" | tail -n1)
|
||||
if [[ ! "$HTTP_CODE" =~ ^[0-9]{3}$ ]]; then
|
||||
echo "ERROR: GitHub release request returned an invalid HTTP status"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "WARNING: GitHub release creation failed after $MAX_RETRIES retries"
|
||||
echo "Artifacts are published, continuing..."
|
||||
exit 0
|
||||
same_published_tag() {
|
||||
jq -e --arg tag "$TAG_NAME" '.tag_name == $tag and .draft == false' \
|
||||
<<< "$HTTP_BODY" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
MAX_ATTEMPTS=2
|
||||
for ((attempt=1; attempt<=MAX_ATTEMPTS; attempt++)); do
|
||||
request_release POST "$API_URL"
|
||||
case "$HTTP_CODE" in
|
||||
2??)
|
||||
if ! same_published_tag; then
|
||||
echo "ERROR: GitHub release response did not confirm the requested published tag"
|
||||
exit 1
|
||||
fi
|
||||
echo "GitHub release created successfully for $TAG_NAME"
|
||||
exit 0
|
||||
;;
|
||||
5??)
|
||||
if [[ "$attempt" -lt "$MAX_ATTEMPTS" ]]; then
|
||||
echo "GitHub server error (HTTP $HTTP_CODE); retrying release creation"
|
||||
sleep 2
|
||||
else
|
||||
echo "ERROR: GitHub release creation failed after $MAX_ATTEMPTS attempts (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
422)
|
||||
# A validation failure is not proof that this release already exists.
|
||||
if ! jq -e 'any(.errors[]?; .resource == "Release" and .field == "tag_name" and .code == "already_exists")' \
|
||||
<<< "$HTTP_BODY" >/dev/null 2>&1; then
|
||||
echo "ERROR: GitHub release creation rejected (HTTP 422)"
|
||||
exit 1
|
||||
fi
|
||||
ENCODED_TAG=$(jq -nr --arg tag "$TAG_NAME" '$tag | @uri')
|
||||
request_release GET "$API_URL/tags/$ENCODED_TAG"
|
||||
if [[ "$HTTP_CODE" != 200 ]] || ! same_published_tag; then
|
||||
echo "ERROR: Existing GitHub release could not be verified for the requested published tag (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
fi
|
||||
echo "Published GitHub release for $TAG_NAME already exists; verified"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: GitHub release creation failed (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
exit 1
|
||||
@@ -11,10 +11,20 @@
|
||||
## Output: Installs required system libraries
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
set -euo pipefail
|
||||
|
||||
echo "Installing browser dependencies"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo apt-get update
|
||||
ubuntu_sources=/etc/apt/sources.list
|
||||
if [[ ! -s "$ubuntu_sources" ]]; then
|
||||
ubuntu_sources=/etc/apt/sources.list.d/ubuntu.sources
|
||||
fi
|
||||
if [[ ! -s "$ubuntu_sources" ]]; then
|
||||
echo 'Cannot locate Ubuntu package sources' >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get update \
|
||||
-o "Dir::Etc::sourcelist=$ubuntu_sources" \
|
||||
-o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev
|
||||
@@ -15,7 +15,9 @@ set -e
|
||||
|
||||
echo "Building app, starting server, running tests"
|
||||
echo "HTTPS=true" >> ./.env
|
||||
npm run build
|
||||
if [[ "${PARAM_BUILD_BEFORE_TEST:-true}" == true ]]; then
|
||||
npm run build
|
||||
fi
|
||||
export REACT_APP_PROXY_LOCALHOST_PORT=8001
|
||||
export PORT=3001
|
||||
npm run start &
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Emit/check approved native maintenance bridges; orchestration lives in the orb."""
|
||||
import argparse
|
||||
import copy
|
||||
import json
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
import yaml
|
||||
|
||||
BRIDGES = json.loads((Path(__file__).with_name('templates') / 'auxiliary-bridges.json').read_text(encoding='utf-8'))
|
||||
|
||||
|
||||
def canonical(kind, worker_sha):
|
||||
if kind not in BRIDGES or not re.fullmatch(r'[0-9a-f]{40}', worker_sha or ''):
|
||||
raise ValueError('Choose an approved bridge and immutable orb commit SHA')
|
||||
result = copy.deepcopy(BRIDGES[kind]['caller'])
|
||||
for job in result['jobs'].values():
|
||||
job['uses'] = job['uses'].replace('WORKER_SHA', worker_sha)
|
||||
return result
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('kind', choices=sorted(BRIDGES))
|
||||
parser.add_argument('--ref', required=True)
|
||||
parser.add_argument('--check', type=Path)
|
||||
args = parser.parse_args()
|
||||
expected = canonical(args.kind, args.ref)
|
||||
if args.check:
|
||||
# Compare exact canonical output: local custom keys or duplicate mappings cannot hide.
|
||||
if args.check.read_text(encoding='utf-8') != yaml.safe_dump(expected, sort_keys=False):
|
||||
raise ValueError('Native maintenance caller differs from canonical orb definition')
|
||||
print('Canonical native maintenance caller verified')
|
||||
else:
|
||||
print(yaml.safe_dump(expected, sort_keys=False), end='')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except (ValueError, OSError):
|
||||
sys.exit('Invalid native maintenance bridge, pin, or caller')
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Emit/check the small pinned native bridge; all worker policy belongs to the orb."""
|
||||
import argparse
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
def canonical_next(shared_ref):
|
||||
if not re.fullmatch(r"[0-9a-f]{40}", shared_ref or ""):
|
||||
raise ValueError("Next workers require an immutable orb repository commit")
|
||||
worker = "QRun-IO/qqq-orb/.github/workflows/"
|
||||
non_label = "!contains(fromJSON('[\"labeled\",\"unlabeled\"]'), github.event.action)"
|
||||
return {
|
||||
"name": "Next centralized CI",
|
||||
"on": {
|
||||
"pull_request": {"types": ["opened", "synchronize", "reopened", "labeled", "unlabeled"]},
|
||||
"push": {"branches": ["main"], "tags": ["v*"]},
|
||||
"workflow_dispatch": {"inputs": {"qqq_ref": {"description": "QQQ source ref for acceptance", "type": "string", "required": False}}},
|
||||
},
|
||||
"permissions": {"contents": "read"},
|
||||
"jobs": {
|
||||
"ci": {
|
||||
"if": "(github.event_name == 'pull_request' && " + non_label + ") || (github.event_name == 'push' && github.ref == 'refs/heads/main')",
|
||||
"uses": worker + "next-ci.yml@" + shared_ref,
|
||||
},
|
||||
"acceptance": {
|
||||
"if": "github.event_name != 'pull_request' || " + non_label + " || github.event.label.name == 'full-acceptance'",
|
||||
"uses": worker + "next-acceptance.yml@" + shared_ref,
|
||||
"with": {"qqq_ref": "${{ inputs.qqq_ref || '' }}"},
|
||||
},
|
||||
"dashboard-image": {
|
||||
"if": "(github.event_name == 'pull_request' && " + non_label + ") || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))",
|
||||
"permissions": {"contents": "read", "packages": "write"},
|
||||
"uses": worker + "next-dashboard-image.yml@" + shared_ref,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--ref", default=os.environ.get("QQQ_NEXT_SHARED_REF"))
|
||||
parser.add_argument("--check", type=Path)
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
expected = canonical_next(args.ref)
|
||||
if args.check:
|
||||
if yaml.safe_load(args.check.read_text(encoding="utf-8")) != expected:
|
||||
raise ValueError("Next native caller differs from the canonical bridge")
|
||||
else:
|
||||
print(yaml.safe_dump(expected, sort_keys=False), end="")
|
||||
except (ValueError, OSError, yaml.YAMLError):
|
||||
sys.exit("Next caller requires a valid immutable worker pin and canonical configuration")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -0,0 +1,629 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Strict QQQ pipeline manifest and native CircleCI continuation entry point."""
|
||||
import json
|
||||
import copy
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
# BEGIN PROFILE RESOURCES
|
||||
_TEMPLATE_DIR = Path(__file__).with_name("templates")
|
||||
CORE_TEMPLATE = json.loads((_TEMPLATE_DIR / "core.json").read_text(encoding="utf-8"))
|
||||
MATERIAL_TEMPLATE = json.loads((_TEMPLATE_DIR / "frontend-material.json").read_text(encoding="utf-8"))
|
||||
VOYAGE_TEMPLATE = json.loads((_TEMPLATE_DIR / "voyage.json").read_text(encoding="utf-8"))
|
||||
NEXT_TEMPLATE = json.loads((_TEMPLATE_DIR / "frontend-next.json").read_text(encoding="utf-8"))
|
||||
ALL_TEMPLATE = json.loads((_TEMPLATE_DIR / "all.json").read_text(encoding="utf-8"))
|
||||
STARTER_TEMPLATE = json.loads((_TEMPLATE_DIR / "app-starter.json").read_text(encoding="utf-8"))
|
||||
ANDROID_TEMPLATE = json.loads((_TEMPLATE_DIR / "android.json").read_text(encoding="utf-8"))
|
||||
POLICY_TEMPLATE = json.loads((_TEMPLATE_DIR / "mcp-policy.json").read_text(encoding="utf-8"))
|
||||
REPOSITORY_POLICY_TEMPLATE = json.loads((_TEMPLATE_DIR / "repository-policy.json").read_text(encoding="utf-8"))
|
||||
MARKETING_TEMPLATE = json.loads((_TEMPLATE_DIR / "marketing.json").read_text(encoding="utf-8"))
|
||||
HOMEBREW_TEMPLATE = json.loads((_TEMPLATE_DIR / "homebrew-tap.json").read_text(encoding="utf-8"))
|
||||
APPLICATION_TEMPLATE = json.loads((_TEMPLATE_DIR / "application-template.json").read_text(encoding="utf-8"))
|
||||
# END PROFILE RESOURCES
|
||||
|
||||
|
||||
class ManifestError(ValueError):
|
||||
"""A manifest must fail closed rather than silently ignore configuration."""
|
||||
|
||||
|
||||
class UniqueLoader(yaml.SafeLoader):
|
||||
"""Reject duplicate mapping keys, including YAML merge overrides."""
|
||||
|
||||
|
||||
def unique_mapping(loader, node, deep=False):
|
||||
result = {}
|
||||
for key_node, value_node in node.value:
|
||||
key = loader.construct_object(key_node, deep=deep)
|
||||
if not isinstance(key, str) or key in result:
|
||||
raise ManifestError("Manifest keys must be unique strings")
|
||||
result[key] = loader.construct_object(value_node, deep=deep)
|
||||
return result
|
||||
|
||||
|
||||
UniqueLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, unique_mapping)
|
||||
|
||||
|
||||
def mapping(value, allowed, name):
|
||||
if not isinstance(value, dict) or set(value) - set(allowed):
|
||||
raise ManifestError(f"Invalid keys or mapping in {name}")
|
||||
return value
|
||||
|
||||
|
||||
def boolean(data, key, default):
|
||||
value = data.get(key, default)
|
||||
if type(value) is not bool:
|
||||
raise ManifestError(f"{key} must be a boolean")
|
||||
return value
|
||||
|
||||
|
||||
def load_manifest(path, setup_version):
|
||||
raw = Path(path).read_text(encoding="utf-8")
|
||||
if len(raw) > 65536:
|
||||
raise ManifestError("Manifest exceeds 64 KiB")
|
||||
data = yaml.load(raw, Loader=UniqueLoader)
|
||||
if not isinstance(data, dict):
|
||||
raise ManifestError("Manifest must be a mapping")
|
||||
profile = data.get("profile")
|
||||
if profile not in ("qbit", "core", "frontend-material", "frontend-core", "cli", "voyage", "frontend-next", "all", "app-starter", "android", "mcp-policy", "repository-policy", "marketing", "node-artifact", "homebrew-tap", "application-template"):
|
||||
raise ManifestError("Unsupported profile")
|
||||
allowed = ("profile", "orb_version", "default_branch", "docs_only", "publish")
|
||||
if profile == "homebrew-tap":
|
||||
allowed = ("profile", "orb_version", "default_branch", "tap", "formula")
|
||||
elif profile == "node-artifact":
|
||||
allowed = ("profile", "orb_version", "default_branch", "node_version", "context", "npm_scopes", "artifact_path", "build_branches")
|
||||
elif profile in ("qbit", "core"):
|
||||
allowed += ("java_version", "browsers", "api_checks")
|
||||
if profile == "qbit":
|
||||
allowed += ("release_completion", "release_on_main", "release_tag_policy", "test_branch_policy")
|
||||
elif profile == "cli":
|
||||
allowed += ("publish_context",)
|
||||
elif profile in ("voyage", "frontend-next", "app-starter", "android", "mcp-policy", "repository-policy", "marketing", "application-template"):
|
||||
allowed = ("profile", "orb_version", "default_branch")
|
||||
elif profile == "all":
|
||||
allowed = ("profile", "orb_version", "default_branch", "publish", "publish_context")
|
||||
else:
|
||||
allowed += ("node_version",)
|
||||
if profile == "frontend-material":
|
||||
allowed += ("java_version",)
|
||||
if profile == "repository-policy":
|
||||
allowed += ("shell_checks",)
|
||||
mapping(data, allowed, "manifest")
|
||||
version = data.get("orb_version")
|
||||
if not isinstance(version, str) or not re.fullmatch(r"(?:\d+\.\d+(?:\.\d+)?|dev:[A-Za-z0-9_-]+)", version):
|
||||
raise ManifestError("orb_version must be a quoted minor track, exact stable pin, or development version")
|
||||
if version != setup_version:
|
||||
raise ManifestError("Manifest orb_version must match the setup job orb_version")
|
||||
default_branch = data.get("default_branch")
|
||||
if default_branch not in ("main", "develop"):
|
||||
raise ManifestError("default_branch must be main or develop")
|
||||
if profile == "marketing" and default_branch != "main":
|
||||
raise ManifestError("Marketing requires the audited main production branch")
|
||||
if profile == "homebrew-tap":
|
||||
tap, formula = data.get("tap"), data.get("formula")
|
||||
if not isinstance(tap, str) or not re.fullmatch(r"[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9-]*", tap):
|
||||
raise ManifestError("Homebrew requires an explicit lowercase owner/tap")
|
||||
if not isinstance(formula, str) or not re.fullmatch(r"[a-z0-9][a-z0-9+@._-]*", formula):
|
||||
raise ManifestError("Homebrew requires a literal formula name")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"tap": tap, "formula": formula}
|
||||
java = data.get("java_version", "21")
|
||||
if java not in ("17", "21"):
|
||||
raise ManifestError("java_version must be the string 17 or 21")
|
||||
node = data.get("node_version", "24.21" if profile == "frontend-core" else "20")
|
||||
if not isinstance(node, str) or not re.fullmatch(r"\d+(?:\.\d+){0,2}", node):
|
||||
raise ManifestError("node_version must be an explicit numeric version string")
|
||||
if profile == "node-artifact":
|
||||
if "node_version" not in data or not re.fullmatch(r"\d+\.\d+(?:\.\d+)?", node):
|
||||
raise ManifestError("Node artifact requires an explicit minor or patch image version")
|
||||
context = data.get("context", "")
|
||||
scopes = data.get("npm_scopes", [])
|
||||
artifact = data.get("artifact_path")
|
||||
branches = data.get("build_branches")
|
||||
if not isinstance(context, str) or not re.fullmatch(r"[A-Za-z0-9_-]+", context):
|
||||
raise ManifestError("Node artifact requires an explicit context")
|
||||
if not isinstance(scopes, list) or any(not isinstance(x, str) or not re.fullmatch(r"@[a-z0-9][a-z0-9-]*", x) for x in scopes) or len(scopes) != len(set(scopes)):
|
||||
raise ManifestError("Invalid npm registry scopes")
|
||||
if not isinstance(artifact, str) or not re.fullmatch(r"[A-Za-z0-9_-]+(?:/[A-Za-z0-9_.-]+)+", artifact) or any(x in (".", "..") for x in artifact.split("/")):
|
||||
raise ManifestError("Artifact must be a relative file path")
|
||||
if not isinstance(branches, list) or not branches or any(not isinstance(x, str) or not re.fullmatch(r"[A-Za-z0-9_-]+(?:/[A-Za-z0-9_.-]+)*", x) for x in branches) or len(branches) != len(set(branches)):
|
||||
raise ManifestError("Build branches must be distinct literal branch names")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"node_version": node, "context": context, "npm_scopes": scopes,
|
||||
"artifact_path": artifact, "build_branches": branches}
|
||||
publish_keys = ("snapshot", "release_candidate", "release")
|
||||
if profile == "all":
|
||||
publish_keys = ("snapshot",)
|
||||
if profile == "cli":
|
||||
publish_keys = ("release",)
|
||||
if profile in ("qbit", "core"):
|
||||
publish_keys += ("asciidoc",)
|
||||
if profile == "qbit":
|
||||
publish_keys += ("hotfix", "feature")
|
||||
if profile not in ("qbit", "cli", "all", "app-starter", "voyage", "frontend-next"):
|
||||
publish_keys += ("feature", "hotfix")
|
||||
publishing = mapping(data.get("publish", {}), publish_keys, "publish")
|
||||
publish_context = data.get("publish_context", "")
|
||||
if not isinstance(publish_context, str) or (publish_context and not re.fullmatch(r"[A-Za-z0-9_-]+", publish_context)):
|
||||
raise ManifestError("publish_context must be a CircleCI context name")
|
||||
if profile == "all" and boolean(publishing, "snapshot", False) and not publish_context:
|
||||
raise ManifestError("All image publication requires an explicitly verified context")
|
||||
if profile == "cli" and boolean(publishing, "release", False) and not publish_context:
|
||||
raise ManifestError("CLI publication requires an explicitly verified context")
|
||||
if profile == "cli" and boolean(data, "docs_only", False):
|
||||
raise ManifestError("CLI currently requires full generated-client verification")
|
||||
tag_policy = data.get("release_tag_policy", "stable")
|
||||
if tag_policy not in ("stable", "v-prefix", "none"):
|
||||
raise ManifestError("Unsupported QBit release tag policy")
|
||||
test_policy = data.get("test_branch_policy", "all")
|
||||
if test_policy not in ("all", "non-release", "non-release-no-integration", "feature", "non-release-no-main",
|
||||
"non-release-no-hotfix", "non-release-no-hotfix-integration", "non-release-no-main-hotfix", "feature-no-hotfix"):
|
||||
raise ManifestError("Unsupported QBit test branch policy")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"java_version": java, "node_version": node, "browsers": boolean(data, "browsers", True),
|
||||
"api_checks": boolean(data, "api_checks", False),
|
||||
"shell_checks": boolean(data, "shell_checks", False),
|
||||
"release_completion": boolean(data, "release_completion", False),
|
||||
"release_on_main": boolean(data, "release_on_main", False),
|
||||
"release_tag_policy": tag_policy, "test_branch_policy": test_policy,
|
||||
"docs_only": boolean(data, "docs_only", False),
|
||||
"publish_context": publish_context,
|
||||
"publish": {key: boolean(publishing, key, key != "asciidoc" and profile not in ("cli", "all", "repository-policy", "application-template")
|
||||
and not (profile == "qbit" and key in ("hotfix", "feature")))
|
||||
for key in publish_keys}}
|
||||
|
||||
|
||||
def git(*args):
|
||||
try:
|
||||
return subprocess.run(["git", *args], check=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL, timeout=60).stdout
|
||||
except (subprocess.SubprocessError, OSError):
|
||||
return None
|
||||
|
||||
|
||||
def proven_docs_only(config, branch, tag):
|
||||
if not config["docs_only"] or tag or not (branch == "main" or branch.startswith(("feature/", "hotfix/"))):
|
||||
return False
|
||||
if git("rev-parse", "--is-shallow-repository") != b"false\n":
|
||||
return False
|
||||
if branch == "main":
|
||||
base = git("rev-parse", "--verify", "HEAD^1")
|
||||
else:
|
||||
default = config["default_branch"]
|
||||
if git("fetch", "--no-tags", "origin", f"+refs/heads/{default}:refs/remotes/origin/{default}") is None:
|
||||
return False
|
||||
base = git("merge-base", "HEAD", f"refs/remotes/origin/{default}")
|
||||
if not base:
|
||||
return False
|
||||
changed = git("diff", "--no-ext-diff", "--no-renames", "--name-only", "-z", base.decode().strip(), "HEAD")
|
||||
if not changed:
|
||||
return False
|
||||
paths = changed.rstrip(b"\0").split(b"\0")
|
||||
eligible = all(path in (b"README.md", b"CHANGELOG.md", b"CONTRIBUTING.md") or
|
||||
(path.startswith(b"docs/") and path.endswith(b".md")) for path in paths)
|
||||
return base.decode().strip() if eligible else False
|
||||
|
||||
|
||||
def proven_ci_maintenance(branch, tag):
|
||||
"""Keep application tests, but do not publish for isolated CI declarations."""
|
||||
if tag or not (branch == "main" or branch == "develop" or branch.startswith(("release/", "hotfix/"))):
|
||||
return False
|
||||
subject = git("log", "-1", "--format=%s")
|
||||
if not subject or not re.match(rb"ci(?:\([^\r\n()]+\))?: ", subject):
|
||||
return False
|
||||
parents = git("rev-list", "--parents", "-n", "1", "HEAD")
|
||||
if not parents or not re.fullmatch(rb"[0-9a-f]{40} [0-9a-f]{40}\n", parents):
|
||||
return False
|
||||
base = parents.split()[1].decode("ascii")
|
||||
changed = git("diff", "--no-ext-diff", "--no-renames", "--name-only", "-z", base, "HEAD")
|
||||
if not changed:
|
||||
return False
|
||||
allowed = {b".qqq-ci.yml", b".circleci/config.yml", b".github/workflows/codeql.yml",
|
||||
b".github/workflows/release-rc.yml", b".github/workflows/schema-drift.yml"}
|
||||
return all(path in allowed for path in changed.rstrip(b"\0").split(b"\0"))
|
||||
|
||||
|
||||
def event_kind(branch, tag, release_on_main=False, release_tag_policy="stable"):
|
||||
if tag:
|
||||
if release_tag_policy == "none" or not re.fullmatch(r"v.*" if release_tag_policy == "v-prefix" else r"v\d+\.\d+\.\d+", tag, flags=re.ASCII):
|
||||
return "test"
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
return "release" if tagged and tagged == git("rev-parse", "HEAD") else "test"
|
||||
if branch == "main" and release_on_main:
|
||||
return "release"
|
||||
if branch == "develop":
|
||||
return "snapshot"
|
||||
if re.fullmatch(r"release/.+", branch):
|
||||
return "release_candidate"
|
||||
return "test"
|
||||
|
||||
|
||||
def qbit_template(config, branch, tag):
|
||||
"""Profile-owned template; add future profiles as reviewed renderers, not raw YAML."""
|
||||
kind = event_kind(branch, tag, config.get("release_on_main", False), config.get("release_tag_policy", "stable"))
|
||||
if tag.startswith("publish") and config["publish"].get("feature", False):
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if tagged and tagged == git("rev-parse", "HEAD"):
|
||||
kind = "feature"
|
||||
if not tag and re.fullmatch(r"hotfix/.+", branch) and config["publish"].get("hotfix", False):
|
||||
kind = "hotfix"
|
||||
if kind != "test" and not config["publish"][kind]:
|
||||
kind = "test"
|
||||
maintenance = proven_ci_maintenance(branch, tag)
|
||||
if maintenance:
|
||||
kind = "test"
|
||||
workflow = "test_only" if kind == "test" else "publish_" + kind
|
||||
result = {"version": 2.1, "orbs": {"qqq-orb": "kingsrook/qqq-orb@" + config["orb_version"]}}
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
if kind == "test" and not tag and not maintenance:
|
||||
ignores = {"all": None, "non-release": "/(develop|release/.*)/",
|
||||
"non-release-no-integration": "/(develop|release/.*|integration.*)/",
|
||||
"feature": "/(develop|main|release/.*|integration.*)/",
|
||||
"non-release-no-main": "/(develop|main|release/.*)/",
|
||||
"non-release-no-hotfix": "/(develop|release/.*|hotfix/.*)/",
|
||||
"non-release-no-hotfix-integration": "/(develop|release/.*|hotfix/.*|integration.*)/",
|
||||
"non-release-no-main-hotfix": "/(develop|main|release/.*|hotfix/.*)/",
|
||||
"feature-no-hotfix": "/(develop|main|release/.*|hotfix/.*|integration.*)/"}
|
||||
ignored = ignores[config.get("test_branch_policy", "all")]
|
||||
if ignored:
|
||||
filters["branches"]["ignore"] = ["automation/qbit-rc-pending", ignored]
|
||||
docs_base = proven_docs_only(config, branch, tag) if kind == "test" and not maintenance else False
|
||||
if docs_base:
|
||||
# Keep the existing workflow/result identity even when Maven is not needed.
|
||||
result["jobs"] = {"docs_only": {"resource_class": "small", "docker": [{"image": "cimg/base:2026.03"}],
|
||||
"steps": ["checkout", {"run": {"name": "Check documentation whitespace",
|
||||
"command": f"git fetch --no-tags origin {docs_base}\ngit diff --check {docs_base} HEAD"}}]}}
|
||||
invocation = {"docs_only": {"name": "qqq-orb/mvn_test_only", "filters": filters}}
|
||||
else:
|
||||
options = {"java_version": config["java_version"], "install_browsers": config["browsers"],
|
||||
"compile_before_verify": False, "check_middleware_api_versions": config["api_checks"],
|
||||
"context": ["qqq-maven-registry-credentials"], "filters": filters}
|
||||
job = "qqq-orb/mvn_test_only"
|
||||
if kind != "test":
|
||||
job = "qqq-orb/mvn_publish"
|
||||
options.update(branch_type=kind, publish_asciidoc=config["publish"]["asciidoc"])
|
||||
if kind == "release_candidate":
|
||||
options["notify_rc_published"] = config["release_completion"]
|
||||
invocation = {job: options}
|
||||
result["workflows"] = {workflow: {"jobs": [invocation]}}
|
||||
return result
|
||||
|
||||
|
||||
def core_template(config, branch, tag):
|
||||
"""Keep the core acceptance/release graph in the orb; scripts stay with core."""
|
||||
result = copy.deepcopy(CORE_TEMPLATE)
|
||||
result["orbs"]["qqq-orb"] = "kingsrook/qqq-orb@" + config["orb_version"]
|
||||
kind = event_kind(branch, tag)
|
||||
if tag.startswith("publish"):
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if tagged and tagged == git("rev-parse", "HEAD"):
|
||||
kind = "feature"
|
||||
elif not tag and branch.startswith("hotfix/"):
|
||||
kind = "hotfix"
|
||||
if kind != "test" and not config["publish"][kind]:
|
||||
kind = "test"
|
||||
if kind == "test" and proven_docs_only(config, branch, tag):
|
||||
return qbit_template(config, branch, tag)
|
||||
workflow = {"test": "test_only", "hotfix": "publish_hotfix_release"}.get(kind, "publish_" + kind)
|
||||
result["workflows"] = {workflow: result["workflows"][workflow]}
|
||||
# Shared install_java owns unattended installation and the signed archive mirror.
|
||||
del result["commands"]["configure-package-install"]
|
||||
def remove_package_steps(value):
|
||||
if isinstance(value, list):
|
||||
return [remove_package_steps(item) for item in value if item != "configure-package-install"]
|
||||
if isinstance(value, dict):
|
||||
return {key: remove_package_steps(item) for key, item in value.items()}
|
||||
return value
|
||||
result = remove_package_steps(result)
|
||||
for name, job in result["jobs"].items():
|
||||
steps = job["steps"]
|
||||
for index, step in enumerate(steps):
|
||||
if step == "qqq-orb/mvn_build":
|
||||
steps[index] = {"qqq-orb/mvn_build": {"install_browsers": config["browsers"], "compile_before_verify": False}}
|
||||
elif step == "qqq-orb/install_java":
|
||||
steps[index] = {"qqq-orb/install_java": {"java_version": config["java_version"]}}
|
||||
elif isinstance(step, dict) and "qqq-orb/install_java" in step:
|
||||
step["qqq-orb/install_java"]["java_version"] = config["java_version"]
|
||||
if name in ("esb_broker_conformance", "sample_acceptance", "sample_multinode_acceptance", "sample_consumer_acceptance"):
|
||||
# Only save after the last successful executable verification step.
|
||||
last_run = max(i for i, step in enumerate(steps) if isinstance(step, dict) and "run" in step)
|
||||
steps.insert(last_run + 1, "qqq-orb/mvn_cache_save")
|
||||
# Keep the copied Lambda reports for the coverage workspace, but do not upload
|
||||
# them twice: their original directories are already uploaded by sample_acceptance.
|
||||
collect = result["commands"]["store-sample-results"]["steps"][0]["run"]
|
||||
collect["command"] = collect["command"].replace(
|
||||
' if [ -f "$report" ]; then',
|
||||
' case "${report##*/}" in\n'
|
||||
' TEST-com.kingsrook.sampleapp.SampleLambdaDispatchAcceptanceTest.xml|TEST-com.kingsrook.sampleapp.SampleSqsUtilityAcceptanceTest.xml) continue ;;\n'
|
||||
' esac\n if [ -f "$report" ]; then')
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
for invocation in result["workflows"][workflow]["jobs"]:
|
||||
job, options = next(iter(invocation.items()))
|
||||
options["filters"] = copy.deepcopy(filters)
|
||||
if job in ("qqq-orb/mvn_test_only", "qqq-orb/mvn_publish"):
|
||||
options.update(java_version=config["java_version"], install_browsers=config["browsers"],
|
||||
compile_before_verify=False, check_middleware_api_versions=config["api_checks"])
|
||||
if job == "qqq-orb/mvn_publish":
|
||||
options["publish_asciidoc"] = config["publish"]["asciidoc"]
|
||||
return result
|
||||
|
||||
|
||||
def frontend_template(config, branch, tag):
|
||||
material = config["profile"] == "frontend-material"
|
||||
kind = event_kind(branch, tag)
|
||||
if tag.startswith("publish") or (not material and tag.startswith("v")):
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if tagged and tagged == git("rev-parse", "HEAD"):
|
||||
kind = "feature" if tag.startswith("publish") else "release"
|
||||
elif not tag and branch.startswith("hotfix/"):
|
||||
kind = "hotfix"
|
||||
elif not tag and branch == "main" and not material:
|
||||
kind = "release"
|
||||
if kind != "test" and not config["publish"][kind]:
|
||||
kind = "test"
|
||||
maintenance = proven_ci_maintenance(branch, tag)
|
||||
if maintenance:
|
||||
kind = "test"
|
||||
if kind == "test" and not maintenance and proven_docs_only(config, branch, tag):
|
||||
result = qbit_template(config, branch, tag)
|
||||
result["workflows"]["test_only"]["jobs"][0]["docs_only"]["name"] = (
|
||||
"qqq-orb/mvn_frontend_test_only" if material else "qqq-orb/node_test_only")
|
||||
return result
|
||||
workflow = {"test": "test_only", "hotfix": "publish_hotfix_release"}.get(kind, "publish_" + kind)
|
||||
playwright = material and runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT") and kind in ("test", "snapshot")
|
||||
if playwright:
|
||||
workflow += "_with_playwright"
|
||||
result = {"version": 2.1, "orbs": {"qqq-orb": "kingsrook/qqq-orb@" + config["orb_version"]}}
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
job = "qqq-orb/" + ("mvn_frontend_" if material else "node_") + ("test_only" if kind == "test" else "publish")
|
||||
options = {"node_version": config["node_version"], "context": ["qqq-maven-registry-credentials"], "filters": filters}
|
||||
if material:
|
||||
options["java_version"] = config["java_version"]
|
||||
result["parameters"] = {"run_playwright": {"type": "boolean", "default": playwright}}
|
||||
else:
|
||||
options["context"].append("build-qqq-sample-app")
|
||||
if kind != "test":
|
||||
options["branch_type"] = kind
|
||||
if not material:
|
||||
options["npm_trusted_publishing"] = True
|
||||
jobs = []
|
||||
if playwright:
|
||||
result.update(copy.deepcopy(MATERIAL_TEMPLATE))
|
||||
steps = result["jobs"]["playwright_tests"]["steps"]
|
||||
for step in steps:
|
||||
if not isinstance(step, dict):
|
||||
continue
|
||||
if "restore_cache" in step:
|
||||
step["restore_cache"]["keys"] = ['material-npm-downloads-v1-{{ checksum "package-lock.json" }}', 'material-npm-downloads-v1-']
|
||||
if "save_cache" in step:
|
||||
step["save_cache"].update(key='material-npm-downloads-v1-{{ checksum "package-lock.json" }}', paths=["~/.npm"])
|
||||
if "run" in step and step["run"]["name"] == "Install dependencies":
|
||||
step["run"]["command"] = "npm ci --legacy-peer-deps --prefer-offline --cache ~/.npm"
|
||||
jobs.append({"playwright_tests": {"filters": copy.deepcopy(filters)}})
|
||||
options["requires"] = ["playwright_tests"]
|
||||
jobs.append({job: options})
|
||||
result["workflows"] = {workflow: {"jobs": jobs}}
|
||||
return result
|
||||
|
||||
|
||||
def cli_template(config, branch, tag):
|
||||
publish = False
|
||||
if tag.startswith("v") and config["publish"]["release"]:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
publish = bool(tagged and tagged == git("rev-parse", "HEAD"))
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
options = {"publish": publish, "filters": filters}
|
||||
if publish:
|
||||
options["context"] = [config["publish_context"]]
|
||||
# CLI docs are still verified until its generated-client inputs get a dedicated policy.
|
||||
return {"version": 2.1, "orbs": {"qqq-orb": "kingsrook/qqq-orb@" + config["orb_version"]},
|
||||
"workflows": {"publish_release" if publish else "test_only": {"jobs": [{"qqq-orb/cli_verify_publish": options}]}}}
|
||||
|
||||
|
||||
def marketing_template(config, branch, tag):
|
||||
del config
|
||||
# Select the existing branch policy once; automation PRs use normal PR checks.
|
||||
selected = {"main": "production", "develop": "develop", "staging": "staging"}.get(
|
||||
branch, "release-candidate" if branch.startswith("release/") else "pr-checks")
|
||||
result = copy.deepcopy(MARKETING_TEMPLATE)
|
||||
workflow = result["workflows"][selected]
|
||||
for job in workflow["jobs"]:
|
||||
next(iter(job.values()))["filters"] = {
|
||||
"branches": {"ignore": "/.*/" if tag else "automation/qbit-rc-pending"},
|
||||
"tags": {"ignore": "/.*/"}}
|
||||
result["workflows"] = {"verify": workflow}
|
||||
return result
|
||||
|
||||
|
||||
def android_template(config, branch, tag):
|
||||
del config, branch, tag
|
||||
return copy.deepcopy(ANDROID_TEMPLATE)
|
||||
|
||||
|
||||
def policy_template(config, branch, tag):
|
||||
del config, branch, tag
|
||||
return copy.deepcopy(POLICY_TEMPLATE)
|
||||
|
||||
|
||||
def all_template(config, branch, tag):
|
||||
result = json.loads(json.dumps(ALL_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
jobs = result["workflows"]["verify-and-smoke"]["jobs"]
|
||||
for entry in jobs:
|
||||
next(iter(entry.values()))["filters"] = {"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}}
|
||||
if branch == "develop" and not tag and config["publish"]["snapshot"]:
|
||||
jobs.append({"qqq-orb/all_develop_image": {"context": [config["publish_context"]], "requires": ["build-and-test", "core", "full"], "filters": {"branches": {"only": "develop"}, "tags": {"ignore": "/.*/"}}}})
|
||||
return result
|
||||
|
||||
|
||||
def starter_template(config, branch, tag):
|
||||
del branch, tag
|
||||
result = json.loads(json.dumps(STARTER_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
result["workflows"]["test_only"]["jobs"][0]["qqq-orb/mvn_test_only"]["filters"]["branches"] = {"ignore": "automation/qbit-rc-pending"}
|
||||
return result
|
||||
|
||||
|
||||
def next_template(config, branch, tag):
|
||||
del branch, tag # Tag-only filters preserve the existing release validation.
|
||||
return json.loads(json.dumps(NEXT_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
|
||||
|
||||
def voyage_template(config, branch, tag):
|
||||
del tag # Existing job filters retain tag exclusion and main-only release actions.
|
||||
selected = "develop" if branch == "develop" else (
|
||||
"release" if branch == "main" or branch.startswith("release/") else "pull-request")
|
||||
result = json.loads(json.dumps(VOYAGE_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
result["workflows"] = {"verify": result["workflows"][selected]}
|
||||
return result
|
||||
|
||||
|
||||
def repository_policy_template(config, branch, tag):
|
||||
del branch, tag
|
||||
result = copy.deepcopy(REPOSITORY_POLICY_TEMPLATE)
|
||||
if config.get("shell_checks", False):
|
||||
job = result["jobs"]["validate-policy"]
|
||||
job["environment"] = {"QQQ_POLICY_SHELL": "true"}
|
||||
job["steps"].insert(1, {"run": {
|
||||
"name": "Install static shell validation",
|
||||
"command": "sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends shellcheck"}})
|
||||
return result
|
||||
|
||||
|
||||
def homebrew_template(config, branch, tag):
|
||||
del branch, tag
|
||||
result = copy.deepcopy(HOMEBREW_TEMPLATE)
|
||||
result["jobs"]["validate-tap"]["environment"].update({
|
||||
"QQQ_HOMEBREW_TAP": config["tap"], "QQQ_HOMEBREW_FORMULA": config["formula"]})
|
||||
return result
|
||||
|
||||
|
||||
def application_template(config, branch, tag):
|
||||
del config, branch, tag
|
||||
return copy.deepcopy(APPLICATION_TEMPLATE)
|
||||
|
||||
|
||||
PROFILE_TEMPLATES = {"application-template": application_template, "homebrew-tap": homebrew_template, "qbit": qbit_template, "core": core_template,
|
||||
"repository-policy": repository_policy_template,
|
||||
"frontend-material": frontend_template, "frontend-core": frontend_template,
|
||||
"cli": cli_template, "voyage": voyage_template, "frontend-next": next_template, "all": all_template, "app-starter": starter_template, "android": android_template, "mcp-policy": policy_template, "marketing": marketing_template}
|
||||
|
||||
|
||||
def node_artifact_template(config, branch, tag):
|
||||
# One checkout/install is shared by tests and an optional artifact build.
|
||||
lines = ["registry=https://registry.npmjs.org/"]
|
||||
lines += [scope + ":registry=https://npm.pkg.github.com/" for scope in config["npm_scopes"]]
|
||||
if config["npm_scopes"]:
|
||||
lines.append("//npm.pkg.github.com/:_authToken=${NPM_TOKEN}")
|
||||
npmrc = "printf '%s\\n' " + " ".join("'" + line + "'" for line in lines) + " >> .npmrc"
|
||||
steps = ["checkout", {"run": {"name": "Configure npm registries", "command": npmrc}},
|
||||
{"restore_cache": {"keys": ['node-artifact-npm-v1-{{ checksum "package-lock.json" }}', 'node-artifact-npm-v1-']}},
|
||||
{"run": {"name": "Install locked dependencies", "command": "npm ci --prefer-offline --cache ~/.npm"}},
|
||||
{"save_cache": {"key": 'node-artifact-npm-v1-{{ checksum "package-lock.json" }}', "paths": ["~/.npm"]}},
|
||||
{"run": {"name": "Test project", "command": "npm test"}}]
|
||||
if not tag and branch in config["build_branches"]:
|
||||
steps += [{"run": {"name": "Build artifact", "command": "npm run build"}},
|
||||
{"store_artifacts": {"path": config["artifact_path"], "destination": config["artifact_path"].split("/")[-1]}}]
|
||||
return {"version": 2.1,
|
||||
"jobs": {"node_artifact": {"docker": [{"image": "cimg/node:" + config["node_version"]}], "steps": steps}},
|
||||
"workflows": {"verify": {"jobs": [{"node_artifact": {"context": [config["context"]],
|
||||
"filters": {"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}}}}]}}}
|
||||
|
||||
|
||||
PROFILE_TEMPLATES["node-artifact"] = node_artifact_template
|
||||
|
||||
|
||||
def runtime_boolean(name):
|
||||
value = os.environ.get(name, "false").lower()
|
||||
if value in ("true", "1"):
|
||||
return True
|
||||
if value in ("false", "0"):
|
||||
return False
|
||||
raise ManifestError("Runtime boolean parameter has an unsupported representation")
|
||||
|
||||
|
||||
def continuation_parameters(profile):
|
||||
runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT")
|
||||
if profile != "frontend-material" and runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT"):
|
||||
raise ManifestError("run_playwright requires frontend-material")
|
||||
values = {"mongo_bind_diagnostics": runtime_boolean("QQQ_CI_MONGO_DIAGNOSTICS")}
|
||||
for key in ("next_acceptance_bundle_url", "next_acceptance_bundle_sha256", "next_acceptance_receipt_sha256"):
|
||||
values[key] = os.environ.get("QQQ_CI_" + key.upper(), "")
|
||||
if profile != "core":
|
||||
if any(values.values()):
|
||||
raise ManifestError("Core pipeline parameters require the core profile")
|
||||
return {}
|
||||
return values
|
||||
|
||||
|
||||
def main():
|
||||
config = load_manifest(os.environ.get("QQQ_CI_MANIFEST", ".qqq-ci.yml"), os.environ.get("QQQ_CI_ORB_VERSION", ""))
|
||||
expected = os.environ.get("CIRCLE_SHA1")
|
||||
if expected and (not re.fullmatch(r"[0-9a-fA-F]{40}", expected) or git("rev-parse", "HEAD") != (expected + "\n").encode()):
|
||||
raise ManifestError("Checkout does not match the pipeline commit")
|
||||
output = PROFILE_TEMPLATES[config["profile"]](config, os.environ.get("CIRCLE_BRANCH", ""), os.environ.get("CIRCLE_TAG", ""))
|
||||
if config["profile"] in ("qbit", "core", "frontend-core", "frontend-material"):
|
||||
# One whole-workflow check follows the same commit from feature to release.
|
||||
# Keep every selected job, dependency and filter; add no runner or duplicate build.
|
||||
if len(output["workflows"]) != 1:
|
||||
raise ManifestError("Stable verification requires exactly one selected workflow")
|
||||
output["workflows"] = {"verify": next(iter(output["workflows"].values()))}
|
||||
parameters = continuation_parameters(config["profile"])
|
||||
if config["profile"] == "core":
|
||||
output["parameters"] = copy.deepcopy(CORE_TEMPLATE["parameters"])
|
||||
for name, value in parameters.items():
|
||||
output["parameters"][name]["default"] = value
|
||||
elif config["profile"] == "frontend-material":
|
||||
output["parameters"] = {"run_playwright": {"type": "boolean", "default": runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT")}}
|
||||
encoded = json.dumps(output, indent=2) + "\n"
|
||||
Path(os.environ.get("QQQ_CI_OUTPUT", "/tmp/qqq-generated-config.json")).write_text(encoded, encoding="utf-8")
|
||||
if os.environ.get("QQQ_CI_CONTINUE") == "true":
|
||||
key = os.environ.get("CIRCLE_CONTINUATION_KEY")
|
||||
if not key:
|
||||
raise ManifestError("CircleCI continuation key is unavailable")
|
||||
# Values are in the continued declarations, avoiding setup/API parameter conflicts.
|
||||
payload = json.dumps({"continuation-key": key, "configuration": encoded}).encode()
|
||||
request = urllib.request.Request("https://circleci.com/api/v2/pipeline/continue", data=payload,
|
||||
headers={"Content-Type": "application/json"}, method="POST")
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=60) as response:
|
||||
if response.status != 200:
|
||||
raise ManifestError("CircleCI continuation failed")
|
||||
except urllib.error.HTTPError as error:
|
||||
raise ManifestError(f"CircleCI continuation failed (HTTP {error.code})") from error
|
||||
except (urllib.error.URLError, TimeoutError) as error:
|
||||
raise ManifestError("CircleCI continuation failed; inspect pipeline status") from error
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except ManifestError as error:
|
||||
# ManifestError messages are authored above; never include raw input or HTTP bodies.
|
||||
print(f"Pipeline generation failed: {error}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except yaml.YAMLError:
|
||||
print("Pipeline generation failed: invalid manifest YAML.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except OSError:
|
||||
print("Pipeline generation failed: manifest input or generated output is inaccessible.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -0,0 +1,53 @@
|
||||
"""Canonical native-platform exception: emit a tiny qctl reusable-workflow caller."""
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def generate(shared_ref):
|
||||
if not re.fullmatch(r'[0-9a-f]{40}', shared_ref):
|
||||
raise ValueError('shared_ref must be the reviewed immutable QRun-IO/qqq-orb commit SHA')
|
||||
return '''# Generated by qqq-orb generate_qctl_workflow; edit the central worker, not local jobs.
|
||||
# GitHub-native macOS/Windows runners are required for the release binaries.
|
||||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
tags: ['v*']
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
full_native:
|
||||
description: Qualify all five native platforms without publishing
|
||||
type: boolean
|
||||
default: false
|
||||
permissions:
|
||||
contents: write
|
||||
packages: write
|
||||
pull-requests: write
|
||||
jobs:
|
||||
native:
|
||||
uses: QRun-IO/qqq-orb/.github/workflows/qctl-native.yml@''' + shared_ref + '''
|
||||
with:
|
||||
full_native: ${{ github.event_name == 'workflow_dispatch' && inputs.full_native }}
|
||||
secrets: inherit
|
||||
'''
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--check', type=Path, help='Fail unless an existing caller is canonical')
|
||||
args = parser.parse_args()
|
||||
rendered = generate(os.environ['QCTL_SHARED_REF'])
|
||||
if args.check:
|
||||
if args.check.read_text() != rendered:
|
||||
raise ValueError('qctl caller differs from canonical orb-generated definition')
|
||||
print('qctl caller is canonical')
|
||||
else:
|
||||
print(rendered, end='')
|
||||
except (KeyError, ValueError) as error:
|
||||
sys.exit(str(error))
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Emit/check the canonical QBit RC bridge; release authority stays in the pinned worker."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import re
|
||||
import sys
|
||||
|
||||
import yaml
|
||||
|
||||
CALLER_PATH = ".github/workflows/release-rc.yml"
|
||||
|
||||
|
||||
def canonical(worker_sha):
|
||||
if not re.fullmatch(r"[0-9a-f]{40}", worker_sha or ""):
|
||||
raise ValueError("RC worker requires an immutable 40-character orb commit SHA")
|
||||
inputs = {
|
||||
"dry_run": {"description": "Plan a cut without changing release state", "type": "boolean", "default": False},
|
||||
"finalize": {"description": "Retry finalization of an existing cut; do not cut another RC", "type": "boolean", "default": False},
|
||||
}
|
||||
inputs['recover'] = {'description': 'Recover the same published RC after a deployment timeout; never reupload', 'type': 'boolean', 'default': False}
|
||||
inputs['circle_build'] = {'description': 'Original Circle publisher build number (recovery only)', 'type': 'string', 'default': ''}
|
||||
for field in ("merge_sha", "bump_sha", "branch", "version"):
|
||||
inputs[field] = {"description": "Existing cut " + field + " (finalize retry only)", "type": "string", "default": ""}
|
||||
forwarded = {
|
||||
"dry_run": "${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || false }}",
|
||||
"finalize": "${{ github.event_name == 'repository_dispatch' || (github.event_name == 'workflow_dispatch' && inputs.finalize) }}",
|
||||
}
|
||||
forwarded['recover'] = "${{ github.event_name == 'workflow_dispatch' && inputs.recover || false }}"
|
||||
forwarded['circle_build'] = "${{ github.event_name == 'workflow_dispatch' && inputs.circle_build || '' }}"
|
||||
for field in ("merge_sha", "bump_sha", "branch", "version"):
|
||||
forwarded[field] = "${{ github.event_name == 'repository_dispatch' && github.event.client_payload." + field + " || inputs." + field + " || '' }}"
|
||||
return {
|
||||
"name": "Release candidate",
|
||||
"on": {
|
||||
"workflow_dispatch": {"inputs": inputs},
|
||||
"pull_request": {"types": ["closed"], "branches": ["develop"]},
|
||||
"repository_dispatch": {"types": ["qbit-rc-published"]},
|
||||
},
|
||||
"permissions": {"contents": "write", "actions": "read", "checks": "read"},
|
||||
"jobs": {
|
||||
"release-rc": {
|
||||
"if": "github.event_name == 'workflow_dispatch' || github.event_name == 'repository_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' && contains(github.event.pull_request.labels.*.name, 'release:rc'))",
|
||||
"uses": "QRun-IO/qqq-orb/.github/workflows/qbit-release-rc.yml@" + worker_sha,
|
||||
"with": forwarded,
|
||||
"secrets": "inherit",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def generate(worker_sha):
|
||||
return yaml.safe_dump(canonical(worker_sha), sort_keys=False)
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--ref", required=True)
|
||||
parser.add_argument("--check", type=Path)
|
||||
args = parser.parse_args()
|
||||
expected = generate(args.ref)
|
||||
if args.check:
|
||||
# Exact canonical text rejects added steps, permissions and duplicate YAML keys.
|
||||
if args.check.read_text(encoding="utf-8") != expected:
|
||||
raise ValueError("RC caller differs from canonical bridge")
|
||||
print("Canonical RC caller verified")
|
||||
else:
|
||||
print(expected, end="")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except (ValueError, OSError):
|
||||
sys.exit("Invalid RC worker pin or noncanonical caller")
|
||||
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Machine executors are Ubuntu amd64. Preserve an existing browser for Maven
|
||||
# consumers; frontend_test deliberately removes its stale browser beforehand.
|
||||
if command -v google-chrome >/dev/null 2>&1; then
|
||||
google-chrome --version
|
||||
exit 0
|
||||
fi
|
||||
architecture=$(dpkg --print-architecture)
|
||||
if [[ "$architecture" != amd64 ]]; then
|
||||
echo "Google Chrome requires an amd64 machine executor" >&2
|
||||
exit 1
|
||||
fi
|
||||
curl --fail --silent --show-error --location https://dl.google.com/linux/linux_signing_key.pub \
|
||||
| sudo gpg --batch --yes --dearmor -o /usr/share/keyrings/qqq-google-chrome.gpg
|
||||
printf '%s\n' 'deb [arch=amd64 signed-by=/usr/share/keyrings/qqq-google-chrome.gpg] https://dl.google.com/linux/chrome/deb/ stable main' \
|
||||
| sudo tee /etc/apt/sources.list.d/qqq-google-chrome.list >/dev/null
|
||||
# Ubuntu dependency indexes were refreshed by install_java. Only the newly added
|
||||
# signed Google repository needs refreshing; image PPAs are unrelated to Chrome.
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get update \
|
||||
-o Dir::Etc::sourcelist=/etc/apt/sources.list.d/qqq-google-chrome.list \
|
||||
-o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y google-chrome-stable
|
||||
google-chrome --version
|
||||
@@ -11,9 +11,40 @@ NODE_VERSION="${PARAM_NODE_VERSION:-20}"
|
||||
|
||||
echo "Installing Java ${JAVA_VERSION} and Maven..."
|
||||
|
||||
# Add Eclipse Temurin repository
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq wget apt-transport-https gpg maven curl
|
||||
# Keep package installation unattended on disposable build machines.
|
||||
# Set this before either apt invocation, including NodeSource's child process.
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
export NEEDRESTART_MODE=l
|
||||
sudo install -d /etc/needrestart/conf.d
|
||||
# Keep Perl's variable literal in the needrestart configuration.
|
||||
# shellcheck disable=SC2016
|
||||
printf '%s\n' '$nrconf{restart} = "l";' | sudo tee /etc/needrestart/conf.d/99-qqq-ci.conf >/dev/null
|
||||
|
||||
# Retry transient repository downloads within APT, including NodeSource's child process.
|
||||
# Exhausted downloads retain APT's nonzero exit status and fail this build step.
|
||||
printf '%s\n' 'Acquire::Retries "3";' | sudo tee /etc/apt/apt.conf.d/80-qqq-download-retries >/dev/null
|
||||
|
||||
# Ubuntu archive carries the same signed security suite; avoid the flaky HTTP mirror.
|
||||
if [[ -f /etc/apt/sources.list ]]; then
|
||||
sudo sed -i 's|http://security.ubuntu.com/ubuntu|https://archive.ubuntu.com/ubuntu|g' /etc/apt/sources.list
|
||||
fi
|
||||
|
||||
# Base tools come from Ubuntu, not the unrelated PPAs bundled in machine images.
|
||||
# Support both the 22.04 list and the newer deb822 Ubuntu source file. Preserve
|
||||
# other indexes for later jobs without contacting their repositories here.
|
||||
ubuntu_sources=/etc/apt/sources.list
|
||||
if [[ ! -s "$ubuntu_sources" ]]; then
|
||||
ubuntu_sources=/etc/apt/sources.list.d/ubuntu.sources
|
||||
fi
|
||||
if [[ ! -s "$ubuntu_sources" ]]; then
|
||||
echo 'Cannot locate Ubuntu package sources' >&2
|
||||
exit 1
|
||||
fi
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get update -qq \
|
||||
-o "Dir::Etc::sourcelist=$ubuntu_sources" \
|
||||
-o Dir::Etc::sourceparts=- \
|
||||
-o APT::Get::List-Cleanup=0
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y -qq wget apt-transport-https gpg maven curl
|
||||
|
||||
# Add Temurin GPG key
|
||||
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo gpg --dearmor -o /usr/share/keyrings/adoptium.gpg
|
||||
@@ -21,9 +52,14 @@ wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo g
|
||||
# Add repository
|
||||
echo "deb [signed-by=/usr/share/keyrings/adoptium.gpg] https://packages.adoptium.net/artifactory/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
|
||||
|
||||
# Install Java
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq "temurin-${JAVA_VERSION}-jdk"
|
||||
# Refresh only the repository just added. Re-fetching unrelated image PPAs here
|
||||
# caused otherwise successful setup to fail on Launchpad 503 responses. Keep
|
||||
# Ubuntu indexes from the first refresh so Java dependencies remain resolvable.
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get update -qq \
|
||||
-o Dir::Etc::sourcelist=/etc/apt/sources.list.d/adoptium.list \
|
||||
-o Dir::Etc::sourceparts=- \
|
||||
-o APT::Get::List-Cleanup=0
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y -qq "temurin-${JAVA_VERSION}-jdk"
|
||||
|
||||
# Set JAVA_HOME
|
||||
JAVA_HOME="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64"
|
||||
@@ -35,7 +71,7 @@ if [ "${INSTALL_NODE}" = "true" ]; then
|
||||
echo ""
|
||||
echo "Installing Node.js ${NODE_VERSION}..."
|
||||
curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | sudo -E bash -
|
||||
sudo apt-get install -y -qq nodejs
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y -qq nodejs
|
||||
echo ""
|
||||
echo "Node.js version:"
|
||||
node --version
|
||||
@@ -43,6 +79,46 @@ if [ "${INSTALL_NODE}" = "true" ]; then
|
||||
npm --version
|
||||
fi
|
||||
|
||||
# Select the checked-out project's Maven wrapper at invocation time (checkout is later).
|
||||
# Keep the installed executable as fallback; all callers, including subprocesses,
|
||||
# see the same selector without changing lifecycle arguments.
|
||||
MAVEN_BIN_DIR="${QQQ_MAVEN_BIN_DIR:-/tmp/circleci/maven-bin}"
|
||||
mkdir -p "$MAVEN_BIN_DIR"
|
||||
NATIVE_MAVEN=$(command -v mvn)
|
||||
if [[ "$NATIVE_MAVEN" == "$MAVEN_BIN_DIR/mvn" ]]; then
|
||||
NATIVE_MAVEN="$MAVEN_BIN_DIR/mvn-native"
|
||||
fi
|
||||
if [[ "$NATIVE_MAVEN" != /* ]]; then
|
||||
echo "Native Maven must resolve to an absolute executable path" >&2
|
||||
exit 1
|
||||
fi
|
||||
NATIVE_MAVEN=$(readlink -f "$NATIVE_MAVEN")
|
||||
if [[ "$NATIVE_MAVEN" != /* || ! -f "$NATIVE_MAVEN" || ! -x "$NATIVE_MAVEN" || "$NATIVE_MAVEN" == "$MAVEN_BIN_DIR/mvn" ]]; then
|
||||
echo "Cannot locate a valid native Maven executable" >&2
|
||||
exit 1
|
||||
fi
|
||||
ln -sfn "$NATIVE_MAVEN" "$MAVEN_BIN_DIR/mvn-native"
|
||||
cat > "$MAVEN_BIN_DIR/mvn" <<'MAVEN_SELECTOR'
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
wrapper=./mvnw
|
||||
if [[ ! -f "$wrapper" ]]; then
|
||||
# A module invocation still uses its checkout's root wrapper. Never search
|
||||
# outside the repository into a user's unrelated home-directory scripts.
|
||||
root=$(git rev-parse --show-toplevel 2>/dev/null || true)
|
||||
if [[ -n "$root" ]]; then wrapper="$root/mvnw"; fi
|
||||
fi
|
||||
if [[ -f "$wrapper" ]]; then
|
||||
if [[ -x "$wrapper" ]]; then exec "$wrapper" "$@"; fi
|
||||
exec sh "$wrapper" "$@"
|
||||
fi
|
||||
exec "$(dirname "$0")/mvn-native" "$@"
|
||||
MAVEN_SELECTOR
|
||||
chmod +x "$MAVEN_BIN_DIR/mvn"
|
||||
# Expand PATH when the next Circle step sources BASH_ENV, not during installation.
|
||||
# shellcheck disable=SC2016
|
||||
printf 'export PATH=%q:$PATH\n' "$MAVEN_BIN_DIR" >> "${BASH_ENV}"
|
||||
|
||||
# Verify installation
|
||||
echo ""
|
||||
echo "Java version:"
|
||||
|
||||
@@ -20,6 +20,13 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Only the opt-in completion path requires a positively acknowledged push.
|
||||
PUSH_MARKER="${QQQ_PUSHED_VERSION_FILE:-/tmp/circleci/qqq-pushed-version}"
|
||||
if [[ "${REQUIRE_PUSHED_VERSION:-false}" == "true" ]]; then
|
||||
mkdir -p "$(dirname "$PUSH_MARKER")"
|
||||
rm -f "$PUSH_MARKER"
|
||||
fi
|
||||
|
||||
################################################################
|
||||
## Skip version commit for feature branches ##
|
||||
## Feature versions are ephemeral (include commit hash) and ##
|
||||
@@ -48,8 +55,15 @@ if [[ -n "$(git status --porcelain pom.xml)" ]]; then
|
||||
# Try to push, but don't fail the build if push fails
|
||||
# This can happen if another build pushed first (race condition)
|
||||
if git push origin "HEAD:${TARGET_BRANCH}"; then
|
||||
if [[ "${REQUIRE_PUSHED_VERSION:-false}" == "true" ]]; then
|
||||
git rev-parse HEAD > "$PUSH_MARKER"
|
||||
fi
|
||||
echo "Version updated to: $NEW_VERSION and pushed to ${TARGET_BRANCH}"
|
||||
else
|
||||
if [[ "${REQUIRE_PUSHED_VERSION:-false}" == "true" ]]; then
|
||||
echo "ERROR: Version push failed; release completion will not be dispatched" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "WARNING: Failed to push version commit to ${TARGET_BRANCH}"
|
||||
echo "This is not fatal - version will be updated on next build"
|
||||
echo "Common causes: concurrent builds, branch protection rules"
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Hash every tracked Maven descriptor, including modules and wrapper/config inputs.
|
||||
# Read working-tree contents so CI version changes are represented. Never print them.
|
||||
# No artifact filtering: repository caches retain snapshots, classifiers and metadata.
|
||||
python3 - <<'PYTHON'
|
||||
import hashlib
|
||||
import os
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
root = Path(subprocess.check_output(["git", "rev-parse", "--show-toplevel"], text=True).strip())
|
||||
tracked = subprocess.check_output(["git", "ls-files", "-z"], cwd=root).split(b"\0")
|
||||
inputs = []
|
||||
for raw in tracked:
|
||||
if not raw:
|
||||
continue
|
||||
name = os.fsdecode(raw)
|
||||
path = Path(name)
|
||||
if path.name == "pom.xml" or ".mvn" in path.parts or path.name in ("mvnw", "mvnw.cmd"):
|
||||
inputs.append((raw, root / path))
|
||||
if not any(path.name == "pom.xml" for _, path in inputs):
|
||||
raise SystemExit("No tracked Maven POM found; refusing an empty dependency fingerprint")
|
||||
digest = hashlib.sha256()
|
||||
for raw, path in sorted(inputs):
|
||||
content = path.read_bytes()
|
||||
# Length framing prevents ambiguous concatenations of paths and contents.
|
||||
for value in (raw, content):
|
||||
digest.update(len(value).to_bytes(8, "big"))
|
||||
digest.update(value)
|
||||
output = Path(os.environ.get("MAVEN_CACHE_FINGERPRINT_FILE", "/tmp/circleci/maven-cache-fingerprint"))
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(digest.hexdigest() + "\n", encoding="ascii")
|
||||
PYTHON
|
||||
@@ -22,7 +22,23 @@
|
||||
|
||||
set -e
|
||||
|
||||
# The shared publish job already ran these checks in its verify lifecycle.
|
||||
# Standalone command callers retain analysis unless explicitly opted in.
|
||||
analysis_args=()
|
||||
if [[ "${QQQ_SKIP_VERIFIED_ANALYSIS:-false}" == "true" || "${QQQ_SKIP_VERIFIED_ANALYSIS:-false}" == "1" ]]; then
|
||||
analysis_args=(-Dspotbugs.skip=true -Dpmd.skip=true)
|
||||
fi
|
||||
|
||||
##############################################
|
||||
## Deploy signed artifacts to Maven Central ##
|
||||
##############################################
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -P release -B -DskipTests -Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" deploy
|
||||
# Resolve CI-friendly coordinates without stripping parent/BOM configuration.
|
||||
# Flatten must share this Maven process so deploy uses the resolved project POMs.
|
||||
# Central 0.8.x: this completion flag overrides inherited literal waitUntil=uploaded.
|
||||
# Do not report a release as successful until Central confirms publication.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -P release -B -DskipTests \
|
||||
"${analysis_args[@]}" \
|
||||
-Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \
|
||||
-DwaitForPublishCompletion=true \
|
||||
-Dflatten.mode=resolveCiFriendliesOnly -DupdatePomFile=true \
|
||||
org.codehaus.mojo:flatten-maven-plugin:1.7.3:flatten deploy
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -eo pipefail
|
||||
|
||||
echo "Running PMD static analysis..."
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -eo pipefail
|
||||
|
||||
echo "Running SpotBugs static analysis..."
|
||||
|
||||
|
||||
@@ -1,26 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Collect unit and integration JUnit reports without losing same-named module suites.
|
||||
set -euo pipefail
|
||||
|
||||
############################################################################
|
||||
## mvn_verify_save_test_results.sh
|
||||
## Test Results Collection Script
|
||||
##
|
||||
## This script collects JUnit test results from Maven Surefire reports
|
||||
## and saves them to the CircleCI test results directory for reporting.
|
||||
## It finds all XML test result files and copies them to the standard location.
|
||||
##
|
||||
## Process:
|
||||
## 1. Creates test results directory structure
|
||||
## 2. Finds all Surefire XML report files
|
||||
## 3. Copies test results to CircleCI test results directory
|
||||
##
|
||||
## Usage: Called by CircleCI orb command mvn_verify
|
||||
## Output: Collects and saves JUnit test results for CircleCI reporting
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
#############################################################
|
||||
## Create test results directory and collect JUnit reports ##
|
||||
#############################################################
|
||||
mkdir -p ~/test-results/junit/
|
||||
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
|
||||
mkdir -p "$HOME/test-results/junit"
|
||||
while IFS= read -r -d '' report; do
|
||||
destination="$HOME/test-results/junit/${report#./}"
|
||||
mkdir -p "$(dirname "$destination")"
|
||||
cp "$report" "$destination"
|
||||
done < <(find . -type f \( -path '*/target/surefire-reports/TEST-*.xml' -o -path '*/target/failsafe-reports/TEST-*.xml' \) -print0)
|
||||
@@ -64,7 +64,7 @@ echo "Publishing version: $VERSION"
|
||||
if [[ "$VERSION" =~ -RC\.[0-9]+$ ]]; then
|
||||
NPM_TAG="rc"
|
||||
echo "Detected RC version - using tag: $NPM_TAG"
|
||||
elif [[ "$VERSION" =~ -SNAPSHOT$ ]]; then
|
||||
elif [[ "$VERSION" =~ -SNAPSHOT(\.[1-9][0-9]*)?$ ]]; then
|
||||
NPM_TAG="snapshot"
|
||||
echo "Detected SNAPSHOT version - using tag: $NPM_TAG"
|
||||
elif [[ "$VERSION" =~ -(alpha|beta) ]]; then
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
## It also pushes the changes back to the current branch.
|
||||
##
|
||||
## Process:
|
||||
## 1. Skips for feature branches (ephemeral versions)
|
||||
## 1. Skips for feature and snapshot builds (ephemeral versions)
|
||||
## 2. Checks if package.json has been modified
|
||||
## 3. Extracts the new version from package.json
|
||||
## 4. Commits the changes with skip ci flag
|
||||
@@ -22,12 +22,12 @@
|
||||
set -e
|
||||
|
||||
################################################################
|
||||
## Skip version commit for feature branches ##
|
||||
## Feature versions are ephemeral and don't need to be ##
|
||||
## Skip version commit for feature and snapshot builds ##
|
||||
## These versions are ephemeral and don't need to be ##
|
||||
## persisted back to the repository ##
|
||||
################################################################
|
||||
if [[ "$BRANCH_TYPE" == "feature" ]]; then
|
||||
echo "Skipping version commit for feature branch (ephemeral versions)"
|
||||
if [[ "$BRANCH_TYPE" == "feature" || "$BRANCH_TYPE" == "snapshot" ]]; then
|
||||
echo "Skipping version commit for $BRANCH_TYPE build (ephemeral version)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# Called only after deploy and git_operations succeeded. No credential in argv/logs.
|
||||
python3 - <<'PYTHON'
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
||||
def git(*args):
|
||||
return subprocess.check_output(["git", *args], text=True).strip()
|
||||
|
||||
|
||||
def require(condition, message):
|
||||
if not condition:
|
||||
raise SystemExit(message)
|
||||
|
||||
|
||||
branch = os.environ.get("CIRCLE_BRANCH", "")
|
||||
merge = os.environ.get("CIRCLE_SHA1", "")
|
||||
owner = os.environ.get("CIRCLE_PROJECT_USERNAME", "")
|
||||
repo = os.environ.get("CIRCLE_PROJECT_REPONAME", "")
|
||||
require(re.fullmatch(r"release/[A-Za-z0-9._/-]+", branch), "RC completion requires a release branch")
|
||||
require(re.fullmatch(r"[0-9a-f]{40}", merge), "RC completion requires the exact pipeline SHA")
|
||||
require(re.fullmatch(r"[A-Za-z0-9_.-]+", owner) and re.fullmatch(r"[A-Za-z0-9_.-]+", repo), "Invalid repository identity")
|
||||
bump = git("rev-parse", "HEAD")
|
||||
marker = Path(os.environ.get("QQQ_PUSHED_VERSION_FILE", "/tmp/circleci/qqq-pushed-version"))
|
||||
require(marker.is_file() and marker.read_text().strip() == bump, "No acknowledged push for this bump")
|
||||
require(git("show", "-s", "--format=%P", "HEAD") == merge, "Bump must have exactly the pipeline SHA as its parent")
|
||||
remote = git("ls-remote", "--exit-code", "origin", "refs/heads/" + branch).split()
|
||||
require(len(remote) == 2 and remote == [bump, "refs/heads/" + branch], "Remote release head no longer matches the pushed bump")
|
||||
root = ET.parse("pom.xml").getroot()
|
||||
ns = {"m": "http://maven.apache.org/POM/4.0.0"}
|
||||
revision = root.find("m:properties/m:revision", ns) if root.tag.startswith("{") else root.find("properties/revision")
|
||||
version = revision.text.strip() if revision is not None and revision.text else ""
|
||||
require(re.fullmatch(r"[0-9]+\.[0-9]+\.[0-9]+-RC\.[0-9]+", version), "Published version must be an RC revision")
|
||||
require(git("show", "-s", "--format=%s", "HEAD") == "Bump version to " + version + " [skip ci]", "Unexpected version commit")
|
||||
require(not git("status", "--porcelain", "pom.xml"), "Published POM differs from the bump commit")
|
||||
token = os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN")
|
||||
require(token, "GitHub write credential is required for RC completion")
|
||||
payload = {"event_type": "qbit-rc-published", "client_payload": {"merge_sha": merge, "bump_sha": bump, "branch": branch, "version": version}}
|
||||
request = urllib.request.Request(
|
||||
"https://api.github.com/repos/" + owner + "/" + repo + "/dispatches",
|
||||
data=json.dumps(payload).encode(), method="POST",
|
||||
headers={"Authorization": "Bearer " + token, "Accept": "application/vnd.github+json", "Content-Type": "application/json", "X-GitHub-Api-Version": "2022-11-28"},
|
||||
)
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
require(response.status == 204, "GitHub did not acknowledge RC completion")
|
||||
except urllib.error.HTTPError as error:
|
||||
raise SystemExit("RC completion dispatch failed (HTTP " + str(error.code) + ")") from None
|
||||
except urllib.error.URLError:
|
||||
raise SystemExit("RC completion dispatch failed (network error)") from None
|
||||
print("Dispatched RC completion for " + version + " at " + bump)
|
||||
PYTHON
|
||||
@@ -0,0 +1,629 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Strict QQQ pipeline manifest and native CircleCI continuation entry point."""
|
||||
import json
|
||||
import copy
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
import yaml
|
||||
|
||||
|
||||
# Generated by scripts/pack_pipeline.py; edit source/resources, then regenerate.
|
||||
import base64
|
||||
import zlib
|
||||
CORE_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtPdl22ziy7/0VuOrM2M6YpPclifvcxHbfeCar48z0nChXByJBiW1uJig7Ponn26cKACmKIilSluUlTr/IJFAo1F6FAvv7L4S0zlnEncBvPSNr+uoyPglpRD0Ww3N4+B2ewDMv8HtBp+v4VsdyaM8PeOyYw/cwIr4MGfzd6gaBy6jfWk5eWMymAzeGdzZ1OROPr+Tbls++xR1qmiyMqW+yTnfgWy7rDCK3CDSPI8fvFUFuteqA5X26trk1U8gRM5kTxtcC/YsC3wqibobkZ2dnGjzBgacAgUdBcGqoh/+7om/pu610phl4HvWtzGwe0yjWBNs0ZJsWR9RkWQR5zEKc8EU9QDB9Zp4GgzjFlqTDxfto4GcgqIc+CAsi+SFiIDmMBBc+s8hbXJnwwDxlMcmKzPLobIU5AnBswgdWQGgYaz2YNQgtGjOinZ2Rv/519JXjw/5cl2iX4jUXm4NRbR9gKpBEOyc+Zz4IMuE8BZFOhQEe2d7cJEbshYKwGWplME7AitlqJY0R8WMPBxMtmATDCCNmu06vH+tu0IO5A/acxH3mI+QQBCS2yQL7FgZRTD5+/Nh5+/7d/73vnBy/3D/sHH9+t/eXs3bbXyDt1pP9o+P9N4edf70//sfvb97/q/P39686RwftFvntN3z96uWn153Dd/9st9o+A21D+MzsB2RBMgSxBmEiKT5k4NNz6ri06wJKZuDHjj8AJkZOz/GpS97Sc+YTIRhcX2j7ttP2WxkWXqW/r6YRmvddzqJzWM93L4EgDid/Bt0FTgAf5rqpHNnOt3gQsTHp6VLztBcFAyFASNVy6YoZj4nmI5G+F5D4mXYFRPzxg7BvTkxW2r5gt6YBoQSGGvPP9yTx94+Wi7mwXACXhJdxP/DXiW46keky0zGE5GQERQ8vS2mqfn0dMUI8DsKGql2fI787vsP7DbX4AkQZJ1P3gl5W6fhUXIiDgdmfqGJIFTFViPt+MHAt4gcx4U5PCLLYihmAVJlxEAlZDiJC45h5IVoU8mSRszOyStZWlp4TK0DVEej+D9HsiauDmIBV1//kgY9IdCNGTxECdxkLyWrbtwKfqf2YfS8Aq3FM6N+iPyaan4ItefSUETRiw3EEzL1jUzPmBJa2UJ1xi2BTJckb7WBom0waN5lYbHQyWCp/STyHc7BDzxPZQnGLeN8JYYRHwUaDXQqjAGzPdEYHhCFinZQm4+Ie0riPAjlhc3lRtoCYYBdjGTG1SiY10GWwuLbTA9umhWDLaI9pykHNSp//gfKnYCfOT+CPlh+E37eYVaGwv5KTPlhA0h04IHweNfuOzzhBR2853KQRTCfURicLMoPWW2/7v5LPMOUzhF3xYAEHwyww8p4TRUG0TC76DugzBIOgCjSKHICHc1FRARhn5iBy4ktwuE7MdKUzHN5oDlngP/pxHD4zjGSYPhDL6ICzIX+KERyGqHULRvQWiMFi04B4wuDBIDIZ112Hx2qxTIwghvmMWSDlGFIZyDDdavuJ1/4LF6554Ykf4avvatwV2QMj57ZbzxfIDxk7xIyVgTN2dzUUQtPR8QH5zbDYueEPXLexZwBJ4tQLXaZJveSzEqR9aTrJ3z/7YJuFVYGIDyKW6b2Bd2o5EdFCgntXWIPW/wnLGEAdiPSMPwewWrIVabLlqmixy6dx0CjbiZAIAkXj5PDTifZU/+a5FbNsCIQ4tYtmJR4BDOoXtKbgwOQg8Fdfh/YSLGY48q7mzgycjGZOuolpjB1ypDPO85y9q4nPbSAgFIJFGg1D1zGFjdIEUjdk+ssx6UbBBUdM0kRv7iiAcQ1deqldOBb8yee+vlxXw4QgCtz5r28zihE/IHDOInSLmShj7shg1p8RBg0ktceqUCk0ziFWWnicrMHOHYv5o4F7QelF7qEPjjaHeb7CMLZ6SpCZmH2JNUmwJmiJ0WsnDCI9SNav7wlEPJajkPHiBRlSRhfEgHxXegOYJwL6S3QIebNP8hadlBoZMq70JKeEJKcUoz7BArtfLkJPUjwLHAakArXnNiDQtZyKktZOHHQuguiUh6M5ZiI6QRCnYXResJfH9WxUCtWLYuxbI8O+1lG0tB4GYWimFsZ4twPcPWVRB6OrIPJoTu9UXDuqdI4HYo2bk0Gjtra2svEMgs6I+alLGuoY2CcRSHZMl3JcvOUi91rLVfW20uB/SLqkDmioV50/6TnNvi8o2qVzvHO/IyL3qSp6/2SRY1+SA0zRIuJAIJ9UioT2S5KSLEnLFdxSQGDsDMtHxwOfvAR99hA53yLHtNt14rcfm+EGVCLaK6JxqVxpoQaea5zFMVZfReSohTJ6BIEiGvWIdgC/9MwiOj91wj1R5yYmlsHJuaDhLLfMzgZgDpIdqjwiu1MCud0bxx98q9hyUpXSSLv94sXCh39jlh0FHkEldZ0ucTwRZH+AP9UbIIDO4giSGPXu0GUeqMIJPGqDLUss7J6YtCgNGtCnLLhut5akBVc7AfMNkxQ3261lMIkJO2HoM2ksET1YIVnLIHa7JYJ02Juelsl1WFrPs+a7XOdqf/js6ATZirVSIgq8kG8C8My+dLBLnC3iqks6bALN3eKSHO7RGFQP9/vFpFyqhPgh/BCmrrbjW6CxsCsMjfEdbAS9Bf5EcPAG2YpP9zBdBCsf+D6Yev4SM+pXAuFjyeF266tcF6wLA+q7zF9UKIjZq8tIi2STz/LyIfI1VXVJNqwgKShfVr4KjAEplOKQWQJbTt6B96gB/IKCd00mtv0P/77pNKZCthrlzMJrdbrAWqzuhx1px7PugX1j5gCwS1ZG0zpihudp3BuEbjiZpBsjMNgHrqGhdBlEMsjAHpAaz/94DWNRFKEgt4akG8ZOoqg9aaIK8jtJDFlVCZ/uSAoAE8nPDB2EOQPbjIXfy+SEAyIANh0NSrZPNJknJOtrGsZRGOamNcd0pqZkbvZuQsUr40Qoi9JmWbwZ7i9NG2pXepJCSymxjAy1Rdk9E1WbYYN5dfDPzbmRNdJoXha80Z/gYSG4k/J1nuJ5YkFtCp4O8wxVk5LPGmHyPJM+3OXS27RVt+z+KjRcBnFaviZRqOSRVLxksMqb9ZS4N5uHlW68djJWKvO18rG7XaG8XlFwTD3uQ1GsKuTJlDfnEeyMUKMw8BkjSfLWDyymTvgn0fwG8+FX4gzMxkoFqiKxWIjHZ76JJ1hJPUzSdibZ5kEEkobB2d6KDv8lQpEpUGkHGHGfgF5x/B0GcXcAs0UWisSCh6FnZf6WSWnCm9mFGzLUBKoLGoSOL7oHKCQxDnWJRXm/G2AJs5wsPQeSWBcsMUmO7+BJf9AVx3YfIdHXjt4LHwjRm4/HlpqnwGspeB2BZEtR40PaPo7R9icMI4kUgUW3WAzBIVnd3tlgG2zHWts1N81dZu+YGyvM3LDXtky6aVr25k53dXd7rXEEy6RlkBHoGIVP2WWhnU5x9kNPO1/V6qKnff+u2nkGHvjMajIYiTa7gXkqI58Wubq6jiuooWGVIkRoD/sDYtktlCpjhWSZ1kSZ+JXsQwo08MDXivYJCVypCaDx4f1bcgHimAi4sCELPGk101wH5BaMNTjrGIyBPowmNJNUllZCeJFWTOAPWZBYaoOIf4vhDT5CjDr4N5YeAiAQ1gpeYI1DNW/+toH24YWRfYQ5uErwcSqo0cCPF2F2Ui1otz5IGg9J+/HjR6Lmg4xQvydTecThInJiJpEQ4CDUciESQYDLeWxKrFUevyXYDdAG5JeYDuiZy3rUvNRCxiLQuZDL7isb/gpsW1BY04SSkP8YOsxq+/tH0qohCNnmomGahfWMl66r6nAQkg38I/8V8AkZ/RbfCiZKzIAAwDhrYIqeCMHY59h+hH0ePRXWgcyE5IJGPtpm1aGS/q0LPORaiAisJsG0/TRF4pFp4CQjqRJzo0gM5VGAmGzo9SYZuKcTKa3wDjudBCVS33RJRiRZNNrBRoWAjzR1wD4auKYMKyu8Uw0H1gt7Gf+0oB0g+ntP0actjLqrxvUkSOwrrKrwxbdpROtG5FLab8zmYg1dHe5ZNKbL5PXJyQdRJFInYiQTJ9aoKL/CvlqM1KUcOlxEqyhU44Et6saCSAueQjK1kMryx1fgpLGmnyigEFvVBbqcEWcQ+mCkbzQwQQME05vJc7NQy87uBammnXWd2FD2Oy+2s0WjnubhqCRS0gsipYkQ7KJEONmg9iFzGo7848spFbJQsmcgM63sodC+oV7XSiSknpACtYnGBgGEFyHDksOMmaPOhzzHslwGDgJ0XiC5jE8HseM68aV6xHPEqVFOy1dWhMMoXK+6FjN6ViLXomGofxK/JFkPHB4KP5ruDkV/QhFnbLkUw9zer4PfpzP+WUK7Lm4T5bG4n25GNY7aTLvZU5SanJmqaFXR6pJrbFElCWB9xKaoZHiwTweLBPOuadzi6fwdqUakpL87xQgR0QDigJ1ATF25ki0CAl/5fPH1y6V6fmOWVGroWEm7jcVvFRcrEyg29w7AHaitnYjs5yDRWh1925H9LvgUApq2wyzBliQjOnBiPQPuLSKH0I5O4F1a3e5TN37v/w6QAGpBU8NsHXrS1hDEfRRlN7jEQ3jiAVqcQJDXh2gec6v5NjVIazja01DoX9JuBmkvl4nn+I4H2QG2NeCR+jSerpDNskKwTLaWluUxftE/WLH4RKV6xYwkJMusri4lzRflDRKKTIba/VivRARCs4fB+qLsjJC9D0K+sQ4AHMu/G7YgLI00KyCk3/YS6sq2BLnoFcgWvL0iUm3g5zLk8SD/mOJ/VxOucr0P+WVtKe0Sq709siJsRn4Uw3sMwzHLats1mx6Ko4oq92aq4tSjdxv1bgld+M9Wbk+spcqOe8wHk41yrtpbhdRmWlwzXk7UMYmL93HeXn76+CZPOj/oAEPDQdyJHY8hb2G99RWvWVaVSixagb0ni94pXrLine truncated
|
||||
MATERIAL_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNq1lMtugzAQRfd8heV1TNRKlar8QXdVt02EXDMhDthGfqRBiH/vQAmPvKRU6g7PjH3PXI+pI0IoHEEEb6yjK1JjAENlwatvK7OdH2IYTY3IwWLks4+QIdflpeIZYJoqYWMlhTXObH0sjFqOB64OT/HLa/zM9lypig77m/5rE51WzaKl25uvq2CJB+fdFO/UR0swaWBxyjsPpZvRU7EDkZswFp11ZFHDWEgEx8qJVp/OoZof2Md1qViKYqyuSSfhgiJrWnKRo0OsQB/jvTN6TUnTTLTPt9NZZjNZNaNvt9CDvgTWXHUX9Kad50VBUAV0ClpIcGccFK9NcZ225QhEhCSMFZBxUbESwHaE9CEkxw/3rOyV/uwcVvnd9fswKSTKpKEA92+efgRN3oexIwfpAi+IhQyHyEmjye/A3nP5SMa57cof9LebVW693HIxexsTg+avg1kojfXLc6wUxaXmHrmvbvgLWNtQgmaE4h5bW8X6quUNmctfRdREPykCLqM=")))
|
||||
VOYAGE_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtW+lz27gV/+6/AqNJuz1MUlJ8ZNVRJr5qu9nYruWk24m8HIiEJFgkQAOgLMXR/u194KWD1JVEW+f4YEsEHvAefngnQD1uIVTqEyEpZ6UaqpqVbd1yx1sSHh/hOzy1Quq5BmauoYhUWTv0+NjpUkYmmqCR+rijm0phK2QqNKrV8k7NCYUgTJUSstF2OoUgkofCIbbjYamZljwsYHxGQFifCs58PXqKz5uDdycX9uXVTUOPMn71B8DohZ9nIRUJ9Mzvx2OdLnF6PFQZGzQxM/Tf398bXLQsyqTCnmff4T6e4h5R6VZ7jF6pWilNEIyy76Mxl2xmv89sB+AjNiCguCDzRBEhy3Nm2I8gfkcEbQ8RDgKPOliBHNuIMkU6InpAesPkNroPsUcV0DEXORwkxp1JfjEk3PehX88KsiHHI5ihfjy/cYiMmx1kGGHgYkUMyXAgu1xJaGLcUAIz2SbCCATvwHLkp8AgcX8uBhFAtl6MRiv0lMxDEmDV1cIrrT7KkqEgbSqIIUjAhVou0ucybGPqSdz+LIZYKNrGzgrc+nwIe2jeYTG7jy4ITVm0/ZoeVCOi2qg0kiqyRI5EBSM3kqngWkIF2tBgQxS3H7joyQA7JC+Z4Fz7iZI5K48WedoLJB3JGiL/Q+TMsHG/VgZjGVFO6+YRzt0/tAjUcecddrjDTTIgTp7mmDs9ItrUKxgfcN8c+F6+Q4qCmUyHszbtFFBzhiN7vyOOMuETdkdRMqX1CN0Wb/DWZG+y3SVJHEGUNKSDJx1eyY0WM7VxU2qRhRuH+h2rhSWZDTYTHBeEHemDoy99TtBY6KnP40iCTqkCz9qTC9zvA2wwMu5RV6lA1iyrQ1U3bMFW+PprNHr8RRD4BJW0XP7API5dq//CrFbMakZix8+2R1k4sAd7OybokNn50GTwiYzBhzZaTup0fe6ivw8y0iZbz3oXgnMdslWAMbM1IZcoUDwIP/E2IhO+xrqKzJTIVNz3oB2cTYvLed6mWBkxGPsnayLocSiYAgMVgSWJDzExqHk4yp7W0kmfuDT0N6eUjVg21Dho3KCGXu588JN1II0KajabDI0hx6His22BpdOjfCt/wDIwFIc/wvLd4AZCEQWK0KUq6ydCcJE93YH7gQ9YdhAqlEhmJJHajHpjUhN9/IiUCEmTbVJ+E1Vf/rmCgBUhE+LoEGCqgRoLsaEwXITAknhcOGTT0qWArCxbNmC9QBJr0Kz9bqRaWW6iU6BhpUCKRQkMTtKX9bxrXEPEqXR+zh4ZFqY+cRYC+TvtD41+eX+vbKwUwD/J1zhpPUGJO1mxgC8PCHMJc2gusyoxbsdWbivqE+3nYKrKrr/QUUFcICFHAQ2Izsoh0AE8yJAol3w1md9zKUTBADVLz84u35xYZoShFWHSLKVDMqVKErsmi6MBgjWDdxB+6ij6eqKr/xxbOV41SyvkZIPgwGDOuFmGNSvlPD0kJzMQQgqcNmXUGBJwmDOhKZv7e2b5lezi6u5erbpT2XMr7f2d8s5ua3e/ur/jtiv4+U6ZELLX2q2UYS53/7mzt4f3HKf1wsXln6utSmWftPbdarWKNMe2zHylXieDbB31Q0+jI4ned6g/z85Pz7aPrs9vzo8OftFefUAhp+YuQZVssAc5vgGZkhH0Orq+bHPhY4WmXX4KhjWpO7Hjj1Be29NC8bnAeLRaFdjK4yMCMZwuGo1WrjZ+n9qsz7G2tYu0GY1a4oQzZMGRJiPX8sJRgfBEXPDSLGlDbvlrOUZq6M068njoogOGvSHU2UuOh4xDFO1wLfqfGu9x9GQmZeFrMqzfA1+Dcju2nhk6LjqY0Q+RyqWUMyRdLpUZCq+eFkNRs6NFNXPEivcIqz97bFxeHFzbN5evTy5GMyTp0YOZFNBQCl9H5nClDbY+UXonJbY1JpyZSjq+6VKJWx5x6wvTu0IDieOHER2ufscmslAvDzU4KD7OQOf+4lPLJCBHgCJDoVjlas8ej86vj345sRtnB5VaubY/QmYWvRXuLKBLeuLK7YsWvDfa+aMjDiU47LVYVnvdXJ+/+6/97uS6cX55UW+WyuYuVOrN0oIsxOpjYUGzFVOYEj5qRY2F+cGzxymWIxQp4DjApwE9jeXbOrKPi7WCsE47DLyTEUIVNYD8L26eC/0XBfsqlF0EBd4pVWdhC11hpwdcF3k44nS5Tq4eT8+OUkcCmdRHlMDt8Q5lqNN1hHZCRjimfds4ub44eHOiyQ0jAPMDg3ENqVzKVtS6ZForcYjWApDy88W6Om+OVJOTcYEGZn12i4alHGgbvY9QSWY5vD64ODrTqNSh2QX98XgAT7e6Nl5A6YN9aLJ/INUlTOvMF8EwZTKebyUsJoYlKqJ1C9R51YFgsW3aZOsNHu9Aab0QI1vc//SjVA75353bq1UrZvkPOEr9winNKQG/CsqIGoeXb9BfjoaQMzBy/OtflyQ2kJOYTkzsDmrZN8OHCoEZgReC5dd83CMHnY4gHeBwyDO3exyXJ/+MSpb6xDlU2nMB0tX1tqTthxs7E0pTGWC20nlQRreGgiWHzwCL/vh0VWMQK2rVslmpPKkze30sPbPEtY4dWDCYGY/is3wjac2iY5q5np7fnL09nEldjXgrjZbAzOnWtUvMunQtZ+j8+N8grHF+aU0n2ikjQw0DUo90OOsK4jho6NXW42GFImeP4umJu5KybiUKW9K5a9vjDxPvNgSh5wHX+3DmzYbkDYg52jv3jYikv009BfVcrkMPjVAhRX3aLKIsqeDcICkNKMtdxSXGHAXU4k7rtwTWZtMy/2aVcjS3My2jrXlPK/in4mu8H8AUXSn9QGXeYX3m8u9DKkjhSdqMEU6fpG1/fwgXnzIkcvz/XRtn3jA+V4wlevo+Z5MSb8AZbBbgJ22lm1x60Tl2lv0xRQaqaNnjY8rFS/6moZsuP5eDFifH3y9gc46EVwCu64gvBlv+Xa9J95rvzVxZ0cAJt/F0t2NRbft0IueaGci3kPV/DSvfXCR/4hv+NWQETxrC7yOzeNJb8C1nKE8Z+B+Zzje5rX7IqOLCin8mZDuurQ98/1ALm9KszaacEeiL0dsuvlhIfkbluNGBeO5SIYOt9Jq3bx4IU8ObB245XihBYgMg4kHu+nr6d3KlQHC3YOL4bTpN0IPJuE8/kAKq6HbGTqUtvp8sGJZdPRGGmZIJoZVyiu6azCHO/foEhCVG/vImr2ALLm1mEH4rib4xTt5bCMKWR6O7Vlg/tFOJ9M0NVcU2s/hW5310XT1xN6uvqn9Hv70vGz9jo337uFMePUO3t00WCMpUG6jJQL9ihK6uL/91cnSTvcjx05/kT82mvt+euP+euO1FL1/qnsODxpl9cvFu9vq3SONmn9d8gXfefd73ZrdrXStxMflr2eQaOzIxyjpScN6zksZXtn15fZjuv20n6pf6zWgMb1erVtLwqmw+Ty5FR1ujrf8BDqZ8bQ==")))
|
||||
NEXT_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrNVE1v2zAMvedXCFqAtlscb70tQLGtXTEUGFYgHXqJM0OxmUSJLCmS7DYr8t9HubaXOOnHYYfdLPLp6fGR9EOHEFqAsVxJOiCn/Q89H1FmYvH4gN94Wq1WAUYwQJdczqxRahlWwc9xfD08j28vhzdX1z/imOKVTcmxUNscOp8Ibudxyux8ophJ4wUzTRoBcA9J7pSP1Q+GC1Yw2qsR1oH2jKMqgKFkDslS5a4BkYZwW3nIpXVMiLgkHOxgEFVnpUoBs87k0NtF+Ez81yZ6ekq3AJvme/OEDpPL/Wcly/xz9BYMn66JmwPhWZY7NhFADAhgFkj9aEtQorKMydRfr5C1vLOIdh8uroYX3y/jn1++vSk2EY3k1CjpQKYNqnvsayKBJhEyrHJu4PioH2qWLNkM+gur5NFJv0JH9CSSGStAbt3PCkmCcxKsyByEHkDBRM4cUn6Fe23AljBt1AISVxNhcqpMAjcuxa4hqQPrUEG3rS+i5MzHW8X5UuorO3qewf/DTp3nXKRlo3BgHE8IVqqMe6Y5iTLgPSUgfVsjqaXOSDVwJAiw7t8gA6GS5ZQ3ebfWUI52dRZcujqF1VefE69m8CjhFWU2y4CN88sXp6CFWtf3xp365uP63imznAp1d2CHK5O3t7da9tHza1iuEdM6LqXv+4wWOGzcXgJTE8MkWnIo5zd4JtFob3jYfxvSFmDTa7M5NnuCSUmx3ilkKxcWB8hr5w653z69PH4v/SabCcM1uHcHhJZel6sRGJhx68w6SAykIB1nwu6qH/f+V/9p+KsYvQ8+jt9FUb/1cRwML5rDyafu/nuvacD+2Hc2nT/snNGl")))
|
||||
ALL_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNq1T7EOgjAU3PmKpjNIdHQyJg4ukmDiYkwDUkxt4UkLEkP4dwsSUojootu7u/fu7lUWQvhOpWKQ4iVazOZ2w4AMlYaVnjXKsszRjCYwZ+lFSQDuduSKEM9fk8PG32+9HSFYn9StRwmSxwJKw0gHsfjhBGnkqAQ47RWtXaGNPHYY9YpZwQ2EIC8X47bbSYOkccRhwUTUhuRU5dhYqvu5rfglZ1xxFHMGSbE91G4SYiYmZUmzgkk6/LPTplsjdPrXD3EhxIcf3sk//sEy1QbVVm09Ad15mhY=")))
|
||||
STARTER_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNp1UMGKwkAMvc9XlDmKtejR0yJ42MsKCl5EQnUzZbbTiZ0ZqiL9d1OpWqt7y3t5eS/JRUSRrNB5TVZOo8loPGwYcjvP8MI1o7IsY2aYkLm2mXdEedKSXwCL5QzW8+Xqe/EDIHmkvnkcyeXK0LFjFNAHIGvOD4rJP7plbVocPTrd7KSoLHwab2V7Kg7aIOxQkUPgi7RqZCo1Hod9rQ14Ci+ZnbQirdDGDjPtgzvHe4e/aINmI/ki3/ZslTaBH/m2W3N3mn3iuaMzy/s2n01Gg0T2BLX4Dz3re7UVd1SLWlwByepyJQ==")))
|
||||
ANDROID_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtWG1v2zYQ/p5fQWgF6rSW3CXYMDhJ13YNkm5rkrrugKEKDFqiZCYUyZBUbC/wfvuO1LvtpmmBAcUwIYAp3vHuuXcqdzsIebdEaSq4N0R7wfd9uyPUVMPrHazhDfNYCRrDhhdRFTES0UG592Iv+CF45vULxjSSfsRoh7Hce7Ef7AV7HvCtnIYr0daQc2p8Q7Spt2CTLEiUG6Fae7DLcUasghJABcTPcDSjnJRQHKvBqeWMSYJzZrySsKo4PG2ItCA+NkeiGYmuRW7aYipNCvAJRfxU4ZgRPwKFbXUNxvaZnDu7dMeIAh1s+5HIMuC1MINBIXiOLOU1meap1zqxqterLdg0vn0YMAC0CaXy6XuQ4rQjsBVcpltSCvc0cLPrmCrkS/T3wFlSnhhc2VgOQp5QHqMA+WYpCUoQ0FOyQKEXPBlMc8ri7qngySJjoYd8G3QUSXS32i4YheFByNdxzWeEu6Rgc7zUn3VbxyMuqBOralJZveEgic3Myu9C+ho9WBma4OjhSgq7P6GqXF3utBRXObFRTxIriLOBYu9WlF5CIWQ+zXBK1lB5NnoWkzaK8rTj9rquhl0R+qACsP/sIBUiZWC1pPpg8dOP3gb0phq/kXLfWsbaQNx8kuUMA0Iftv2vquxIcE4iQ2JX3i8L6WMbp7WEXouJd3iImvAFbSp6/vzL8vDb6QDgeJnDAdz44f+G8C80hAyCyv2YSCaW/5UBe28WX+RTRvUMzamZIT3DisTorXUCimBJuKGY3ZfZmhhIvFwgSSXYRlnIh5C4j+5O3oxPP7yajM9/Oz4b/nxCzWk+RRc4urZ9D80VNaSlAlENZXSTU9hZhV7Iv0MvczOzxAgD55QkYC40hUxSBu31ALil0BScsEQ4iojWVgR0DFhhtewjLgySSogEwZ8s9JZqC/4g5FBmFNr1cpJroo4e9eTSzATfhzo5PHx88ef49PzscchpJoUy6EoLXr8IXS9zxRidBhY9BCUEnohhgHMmRgSqHnpYr8sSnI7HFxXtFPzIiNodhty6FvIDLCtIk5K/pwlL+tY9fZTIPjghJn2U6bSPZgTH0OXAWjIHJZUU+yhMNUGjHDyYkWOlhOqFXhkG3LgWLrO1Qlgk4Ik49HatGeCYUp6QhBOFjtZsDVxvmhTUXmPvbmNLSkzP1mYHWXF6U9yotDf0ZsZIPRwMYBgGKWRmPg0g9ANock+RFddvpNmndMPRXejZrBGK/uUsCz2bi68IZLVC7rDQAeG3VAn+EbzRStHQu1wTWj8gFBJGmkIalpKVjhvc8riE99Rlh7fabWS4iip8E9ifXmlmH9mIQF0f7T/bRdjmvZaCazLs6lfE5Iq7tAuYwHGv4it12JwFH1oPh559gbAFxRsTKeUuipaRJq4YqKYchjOPSM9y9xFk/i4SyhGdsHJdyHD1NXgHCeS/OR/c3Nz4RW+saqbRJonKqLafRTr0+jB9akKuZ8C2kZR/YJbXKfnWHuUpquSW1Vmjl3CbMg4xbJCFDQQ6dj+gsBRdiH3vRv3xgpom0+uG02o1EebWzLJrQCWUDa9lGUqUyKCCOQl50QdC7tS7ij8fnUxORi9f/348uRid/3r8y3hSZMG7mxsnalRK+gCobaM9gobY6TW2w32psAtoKnOhYiusm7khb65NPtymuBaMHEmGKUey6O9Okuv1ReqOxclWJaO6q8JF4SFzs/5KBWjXCRPz1qeqG8X2Auj6RHuclp+0rWHXfNbef7+sr+qfvzR8YpZXU7GYNl0Y94DZBqNDvFwbkgllGx8QJWmqoAxnZBvN/keBs6W7NEL8vDXyqvO+2pjL3JCF2WbSZgH77QHfteShgd9Z7fwDUg7law==")))
|
||||
POLICY_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNqdVU1v2zAMvedXCL442Rq3aYEegubQQwYMWLGeBgxVESg2nWqVJU9S1gZB/vtIWXbsdCuw+WKJH4+PlEjtR4wlv8A6aXQyZ5fZ7IwkP8za4XaPa9ILJQvhYVoL78HqowqVhcmfwaLkIUpYpwt6WYkNoDrJZbU5r3f+yej5VTa7TDqrQ1w9nrWgFpzZ2hxWuRKOwiWuEkolnYHzULtB0CR/gvzZbH1ndELEbnWPdxRqUQVyn7XzGIDd777f3n3pQTTQpqqELsiwljWT0Xg6LaQTa4WFkfU0VnEaeESgxeI6u8iukh7c4Zj2/xD9Fs+CxbNgpVTg3iMcKn7FOL+5Yeny66eUa1nVxnq2E5XqNm7nuC6tqQj5Sck1i4p73HLNNVhrrGML9vDIdYy+ys1We5RdkEVpbMBcESesUnAdp1k6yexGmfU4/ZCRPp3MuSaesmRC78a1sD7DklrvXmT0YARGCsLpQDOSuNadvtxoL/UWKD7tvd31tATHTA163EFMmHCs7NnQhxUVmAUZZU6UsFJGFONy0qJGsmnbAOcp0XLe9nBPIC383EoLBRUslUV6xlIvvQJa5HiAG2N3tC7A5VbWHq9OUGE+oH36OESrpHNSbwisDKUpiUAXA7mVTJtQLMrlxBvVEeCEJH3NuWaixjJhzjzZdzkd5uwuBi4lqMLhtYxAB55MhljDK/FxwWZt9eA1h7q5bhl1xZIi0jFAj877NMiNroODxhCJwJFCDLAMPyzkv2Evh4B4ua3UnszaZivYfpDdYdh90Q2r3ASKkRsYnnCul03vlOhczDvadI6hTwZuR1dkwNh0kCl2aQav0o9nKADl4CTWLY6l9pKyMLeDK7Y913+ZQu3wHbW7MJeSF2OfS2Ve/vAO9Md/fCl6c/jta/E2wugw+g3AlOQ8")))
|
||||
REPOSITORY_POLICY_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNqlVttu4zYQfc9XEH6RDETM7gYoiuz6YbE1ugFSJ2ncFkEcGLQ0splQpEpSid3A/94Z6hLZi1zQ5iEmh6MzZ4aHQz4dMDZ4AOuk0YMT9ol/PCTLnVk4nD7hmNaFkpnwkJRGyXTTLeBSZtJ7sGi5aSysWwvrshBLwOVBKovlUbnxK6NPjvnHT4POa9uMbg9bUAvOVDaFeaqEIx4DVwilBp2D81C6naCDdAXpval857RHxFa6x7sxalEEcqfaeQzA/ArY9dffzlgprMO0DnfdU1MUQmf0RZ3JMUsKVsqSyQYgSTLpxEJhqWSZNHVNAjd2sSHo0egn/oEfD3rI2+dS/Bfyfza7E9iLssQtEp7C5haALazQ6eodmcxmX75EF9fT7+eTaKZlURrr2Z0zupsYN9O5NZix8CslF6yxX+C0c3LVorQmBec607pQHDyS4WMFBWg/JWLCsfG089mIQs0wFEE7NurB8FC9OW5tWfn4JlpKHx2ySLkklwocjZN/otshzyA1GcRR5fPk52jIHVbCx9Fs9iEaPgPfENuYajdkubGMRrh9rF6XeTDcIi8cGV+bT2aaqmaFdMCuNqi+Yrwm7Ilh3go8ARmrjwarOWE8gqF4T9HZ6bfx5GpMRCfnU5zQ6Nv5xfXp5Nd6+Mv4/K/J+PcrmnHMTy61sdDOhPdWLipPudZEwl/EIZPe2NToXC7JuXjQj+0vT4ss2s60W4FS81BCYmMcB/0grdF8CZjA5eXl/OIcGV7Pr76Pz86iIRuNWORtBSgCV+W5XDdpcAQkRtaF+nO/rn8FtoAw2BSq/hXNgMQTBriTJVgvMQOkhMKTOThfw5am4Ov6gxIrid2i+y4Vdmm4N83qBmHuIPWdBRcLk+0UJRRmUUmV8aUVmQpF7M/5vQ+SceC91EvXc9szBU+kSyIhFXQiadSAAqEpl27uMHWp7+Mha3w57T5X5hEsGvHDLueTZ7I/yCmPvj6fXoJqcJmFvyuJTZEJFnJhWAkSGrYEirYlvfUpCTcvjZPruN5NjoI4erTYGsAeFeIBdNLM+J2wUY8SaglLUMGrcLWY/EbBUa29sH89lPGUU5twKFu9jAOEBZHNPax9DBpPKdpH7TkdvhJ+R73Yr2o+tSy78oYU3arPoNc9sHVi01gIdKBOEYSVJPgf6QVuw9tDFiKMpqj64SsggU1wrUEcYIOXfjN6FFZjSu+H/h+JFngMe5m+Vd239ja0P2p0KNK6Zb0UvXFqe8LrQv4De0dJjX23M35mDhQe4beETLlgd3hfcm0qe3yRa7zXlIY90ko6H5OVO5HDXBmMgjd4TJFaTYJ6ATvsRGhTPUSac8JxNQjeOXgAqBrtDZ2xJwU6SMMNt3tXxxH20Ypux/r4h4vkM1a9f6U3VaMuUy1aI9Whvrdn+oVnRfvCOmhn4aExeDT2Psec+k89VHS+88JrnoK9p9b+c/BH9IPtwb8HDzW4")))
|
||||
MARKETING_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtXE1v2zYYvudXvNG6GhhCKXGxHRKkKDDsUAy95VCgDgRaoizOEqlQVByvzX/fS0qKbVmO3SzfYQ6JRT4k32/yoYV83wPwLpkquRTeMQz9owPTItW4xMfv+Bmf8kpwLRU2eFOZDIdB0/Dp0P/gHx15iLq2w2ZSTZNMzpbGFopEKYumiyZs/Efa6b81z3DTs7xcIGTMwnHFszikIg41K/XSJA1Y0JwZwSyOII5Y3EEHZaZaqOkNh11EQaMpnbAwpwL/WF1FkXdRZu4wkjmiYqOB923k/bIfVKUKxlwETFzCmJbpaCQKxYVOYPBrOcIfMYBBwQuWccGOwUhDZmxMiwLbl2VDDwyxKZbRlKlj/ARQlSxUrJBh3ZjwDGfQqmID+Ah+Yyt/nmcj7wBGRmhQlQBcSa+2WAu1TVdQZHQ+U3ySauCi1DTLIEqVzHmVAyEzrlMSs6JcncPof9zC6q5+9UumgbBKgtE6oTzDtnYSXExpFD7QeRFcXFwQlHVKSqbQCH4mJzD8+P4I3ttZTFtY8Pj03T4+a0ULGEw5yopG9d4t+s0jjgtidhmICvt//LBGOoEZ5XpX9AD++vr5DBdSjMbz04RmJcOnRCoIqdYsL4yx4PuR7/9xeH0CscReAJ7APlipyOG2pU5Ap0zYYQAR1Rut0EDYFYp/ZB8S3q4WVQrXIsau+KfEkBBobiIrXVQ4441ahOT0imieMxhCqnVxHASZjGiWSvTjh8PD34MVeWq1jSWahjG2TJcXLzPGCitPLIVBoTTfap3tYKvu/qm1JpwvTb5VVRalEgZfqJoyzcUE6m6IeYz5omHMMO1YLSFIAYXEGDIaYBq8H9YztKaysrbRZquPXbHsZgjGfioxv0beeTfRIyk0u9IrRarpmmBqVGNvpfm8MxyzVGNGr5Ur7BorKlCmvj5TeEU271nU9gUJo7pSaPXA/y3oSNxiUqkTftVA1hDnnZbrlefrbk3EKCGlxirQI1KP8CVWIhZicvOERrpfQ1tqdWpq56ICEVPglO5XKcaawwXVTeleH7U26Lqr5cG9y+4voifiO8m9GLC73HubfLfoWdKtdxOtd42wjKjYvHnyHPc8YjGdELA9YYvL2+w0u1fJNevCFZvwUisTwt4kjZTPZXCByUa4XIdeVFyxvtDqbuavMdXu5EwMNsV0ucWbDarXn2/KWhQPa1tMRU2F67MTbq2hFGHCRYzxbs969jjwlg1qT6qR+XVR0Yzr+WbDGhRpUQ90GHcV5I4uxAJRKXTM9jpiYb0J4pz4gE7cWx7buBTPE5csk4Xj0Y5HOx7teLTj0TtU9Zui6XjvG+O9T0+Vdoy910ttHtIAjoo8jckddXhcozfXd/XpvajKdLPNayipNbfQR7vLSxnNdBq2m0Swqd9Uf+zH48bhBkg83liObnP3LTkOt1Z52FwooRvGtwbRbQcdNN4zjsBesoncYoKx4cimI5uObDqy6cjmLlW4LZqObDqy+dhkc7fYe8Vk8wEN4Mjm05jckc3HNbojm45sPnAE9pJNxTJGcctGvfHkSDVztNPRTkc7He10tPPOb640NdW9COw46vN+d/T/BepbezH0Cazl2O8L8I+jys/YQ45XO179gsK1PrSGzcqbY7XGkRb3E55ej/I7u+WFHrB/4nakUDKuoub06K5F3LWIuxZx1yLuWmTrNXVOuXBfxb+1aw531r53Hva03zbtkMZ3CpSqMN80hVFsjwabo6TGkSi2YbxW5G6Ge3/L5GyGu8j8bCaDKKuwkCiClU5iOemMwl2eKylyRNsUxxNez8S4Z+bUAqY4GZ4X/mU9qNUg7cRdsDVocYY2CjUTVOjSjg0aeNAubfPan9M8W5uBh6hlyNBRmb0E4p/MDP561DfIVtYvtSfgz8+vlzs8WPg6knZfhl4lXeZ/We1d7/0Hg+30Mg==")))
|
||||
HOMEBREW_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNqVVNtu2zAMfc9XCMYeNqBurk7SAgXmpRlaIM2lTVYMy2AoMh2rtSVDknNBkX+fpCReLkWxvdjU4eERRVJ6KyHkLEBIyplzjWqX1QuDvPCZ1Ms3bRs/TmiIFbgKZwWq8ZCTVxAa+bVDUOGzfpriOWi3M4+JuKS8HPMUZgKWZfP5KmNc85rXFdDfegheu0a8eoVc6Z/XqFVIhJst8GbNyozMvEa11a7WrloA9QZpepU2wU1oNZq47hRbbnbW74t9hgIkzwWBgCRYmhM5MsVJ4hSEJRevlM2DkAogiou14dg8ywll+cpmmwn+or1/o4AtqOAsBaYO6qEdd4OH7rfH7nPQHwT+ZDwIJsNbf9w1otUi/JTX93s/x/edpw9Z9/2nsd/rBZ1e1+9PhlvujropEpMKMnnUEIfEQF55rg6Ej5okcnZ0BgsynNrG/QBBozXSJUNZglXERYpCvmQJx6FEmIWIMqmMW8WAYIWJQnpIkIAFtSN1caLLA51KlqtA0RRMVnoTLz2lEZ6mWtz2CxRyIecooxlEmCZTZnpid5k6n0ajUVCUaewPp45Bh8+3U2fKFEhllp/nVIt0rGmDXVdAxiU1DX9f5YsW0odwMywkoLuuf2uQm0LtzLdPS+TbPc8ldwwBODQFc125ZgqvtMHlzRbBgsTW/EggAkViQ04Sd98UqdeznCahGwmeutuhf0+lfIx8Hzw+THp+ob3v5v9H7mv972HOQc8353e4tF/Z6bYXNUr48vBZssN5+CDtnq2D6T96us6lS5vSH3rbZEU=")))
|
||||
APPLICATION_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrFWH1v2zYT/7+fgvUzYDZm0W+JnaR1gaxx0W5N81Kvw1AHBi1SNmOJVCjKcdBmn/05kpYs2U6XdBsWBJZE3h3v9ccjvzxDqLJgKuFSVI5QG7fqZuRaThL4/ALvbp4Hd55mURwSzfIJmKLSnzMFI59XIyifs/M8IlPDUPF5NG3ImIlrOj9qt3CzkpPdr96u6plUxRKZKp+N/ZAkRpFKxChPo0pOkWgWJ6VlK/6M+XOZ6pxoQxUQqqUCmQQoCzaspufsrixwNX5zc5Nb7i1a3jVZkHbLowd7ZL930JkEzUN//4DttSek1243O+29XtBuTuh+r3fYabYrJXlXha/7tQMe0jgV23oKElmHnisWE8VQzIVgFN34OkSKCcoUxKNe5vFlFBFBDVvCNPJYKoEvZgHh4UhoKcMx5ao/qvzw5eLiYjwcnJ6/Px4OxsOzs/fjk3eXR94Pb89OBw1sfdcouSRb835UGYmILJgYg2ZyW9jp8afBh/Hl4PwsFxe1G4Y24RCYOyuAB+jzZ/QceRSBgEyzBp5yPaqgq6sXSM+YGAmEYARxAT8FOiPBzXivy+PgmkhqhgilSCo+5QLNtI6To0YDyGfpBIOPGheXqfDenTWMM+2SD0kLmPZnyPMoi/Ws38pEPjYpHpSb5bAVrcHZ6M1g+Prt+O3g+GQkAg7Bgiw2TNUHrFx4kBUJQ4ajBiP9Jyjl001n/g/9nPKQGqcjHkWpJpOQ1REJFSP0zrtJScgDDumXZUEdCakRgZ8ZU8iX8R2SgWX3pUjSiClcCHJQCrLxuge51dBETZnOv70mBlzC18RY+PVrzrhOtgaXjRuoFsuylmP5NsXEMtrIpGghkPcz8oSON1UCYryMQmDwTuxy2CyHQ+mTsF9SwZDEIcoWQx6JID0TTcIQeJM5j4cQucQF8V9ZEXLRBEH4d0cTEzTPgmdM9MyIglkMiRWn+g0PWb+4ZE6H9VKbqG/Ch5BjxzrWPGIGYgFIWs2o8s+h2aXNH5sobEl8jTJ8WZfELdSpec6knCf/GcI5R2wLOvtteP7bMBNT4ie+DzBBhM+shFup5tv8v59d/nrkNXQUl5mt+Q5b52ABhNyki5FhxvxUQXp5xkp4JBBZYbAjmclbjyklgd4zqaNhe4dXxbS6Q214i8jSM8FE3WYOhIrcYgeGacIU1KsGaWVcLGiWeEDY2KPtduB395uH3R5jrNs8bDV7e70u3ad+h/j7NAjYpNlrNXI2fEciUFZmZjRAOxLKqR03NjF/ZiYPO3ttFvRa3aDVAiGkvU+6B3vBBH67+2yPkqDT7NDD7sFkPyBd0qLU97uU7XVIdzJpHXYQ2iUefUXJDGR1AYvADda7xmGa6BSKE4jRq1yzi5ub4Urt14YQm70fZIxGL1/++Mvxp+MfAcuiWCqNzAwWXOIAYoBNiSUvHpg8h0rbmEs1D/F7LuaMviXJ7JTEuwhKwxAWHBBogxSgBSjmzxMpMAVjJ1xQ/At8fZCUPZrhbHLNfA1LxEw9himQKiLaehX/cXz6/g0ULWzia1Yw10AytnspJA7OMgBnPh0I2DPZUzhOCewdAKOP4lFEJEbLwZL5KegGTCMRp5OQ+8hCHtqM70h8MfsBWhGZpIDHQnKKIsJF9aNWXEw/XyHYn5IagJWStwkaLE15Q4FZXicB/nhQNWQYSnIKEPy8jzq1bC4ngj8rBQl2i96FIZuS8FhNYZ8UOpdbHVUGyxiiA/vsKpvrDhYZ9QwiZjbXUQBN7gw5jEIAF8wGZVSpvchWvM9eTBpmlH37haVT+XP7ak0PZthsxmzJYf+qOo7a95tytqEcilLoaEzXYFfYqWsxOSEU9tG3CxVnqmagkIvV2lpUVg+wJ1O2BGYnBZs+ZqgYq5Yc0LyqYS2N3UUZm1kIMlYvoEsahjkhZF01XxDMByOP3MIY+hrwQQ6GYO1OT4LXRxUwx/YtoCmko8XwUQUz03QlVSsWm10bKDkFQZgkQ7bUoHGtIKko1QnOtX7u1K49Lm4nqdOCrbdmq0MxYO6v4JaVlzV4eCg/kTBlTvH6ljOxLcmSqPutPChq33+S9tlyKOJJAkUMlSKjrJqKJpTBCUy0D5ds5bnqmgny76UDhzpyz1doQRQ33XKyYi7B+8tXVfg1+Vawd1SJlTTp/AGaolGlDgM+z/dbNzBVMo3fUfeRgZ/P4bskiCjNA6iCjHJLTgxQDifz9UpFWYWcL1rhfIHZAuJoIFNGUMiM5iExrYIbqdXXjGtZDkd8KDnNTlblz1kOKWvIEWbjSYVer+lasHKRtq5gGcdbWK6ep18Jw3IddbYtJNVaXgG7StAGfHMPqdYAB80rq2Yr75S80/5iGq/s66OmPdE41/Dkkk3TkCiLPG4BbO5CwgWDHM6PBrVHwu9HbZK1UAWXq04W0JdayHXBsG13CWV2KP3xDtqAyJwhcAwZrsOCQHNuRD+tgvaT+TCdTuKKbN3T20NMDh8vXCe/gn7rVJqvDMvCv+mxRsJ0QMjzbeNbNR3aNw4vtaOHz5OW1GDuXzd4O1tTM3z++4l7cdGxp6V/7hT0yV60oSkTTBGz3ReCAodqilZl+7TTz/Zp83uOLn95Mn3ybQ9y94r/1nnT3faZ+xI4LidpqJNtx5vEMcL/fMjsLHeSVLEAMMszFigQ9R2qZKD8d/QoALm5ENn0HAVrubD5YsTliVTsISzf09SHaH/j2tSs9HdvSevb/th5G/vnRhptMDqKb5zhH3Ud+6w4a76sYyoGEoIQWv7Nm/Hihfjq5rxwL715e74t/dn9s/8DqAZZ8g==")))
|
||||
|
||||
|
||||
class ManifestError(ValueError):
|
||||
"""A manifest must fail closed rather than silently ignore configuration."""
|
||||
|
||||
|
||||
class UniqueLoader(yaml.SafeLoader):
|
||||
"""Reject duplicate mapping keys, including YAML merge overrides."""
|
||||
|
||||
|
||||
def unique_mapping(loader, node, deep=False):
|
||||
result = {}
|
||||
for key_node, value_node in node.value:
|
||||
key = loader.construct_object(key_node, deep=deep)
|
||||
if not isinstance(key, str) or key in result:
|
||||
raise ManifestError("Manifest keys must be unique strings")
|
||||
result[key] = loader.construct_object(value_node, deep=deep)
|
||||
return result
|
||||
|
||||
|
||||
UniqueLoader.add_constructor(yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, unique_mapping)
|
||||
|
||||
|
||||
def mapping(value, allowed, name):
|
||||
if not isinstance(value, dict) or set(value) - set(allowed):
|
||||
raise ManifestError(f"Invalid keys or mapping in {name}")
|
||||
return value
|
||||
|
||||
|
||||
def boolean(data, key, default):
|
||||
value = data.get(key, default)
|
||||
if type(value) is not bool:
|
||||
raise ManifestError(f"{key} must be a boolean")
|
||||
return value
|
||||
|
||||
|
||||
def load_manifest(path, setup_version):
|
||||
raw = Path(path).read_text(encoding="utf-8")
|
||||
if len(raw) > 65536:
|
||||
raise ManifestError("Manifest exceeds 64 KiB")
|
||||
data = yaml.load(raw, Loader=UniqueLoader)
|
||||
if not isinstance(data, dict):
|
||||
raise ManifestError("Manifest must be a mapping")
|
||||
profile = data.get("profile")
|
||||
if profile not in ("qbit", "core", "frontend-material", "frontend-core", "cli", "voyage", "frontend-next", "all", "app-starter", "android", "mcp-policy", "repository-policy", "marketing", "node-artifact", "homebrew-tap", "application-template"):
|
||||
raise ManifestError("Unsupported profile")
|
||||
allowed = ("profile", "orb_version", "default_branch", "docs_only", "publish")
|
||||
if profile == "homebrew-tap":
|
||||
allowed = ("profile", "orb_version", "default_branch", "tap", "formula")
|
||||
elif profile == "node-artifact":
|
||||
allowed = ("profile", "orb_version", "default_branch", "node_version", "context", "npm_scopes", "artifact_path", "build_branches")
|
||||
elif profile in ("qbit", "core"):
|
||||
allowed += ("java_version", "browsers", "api_checks")
|
||||
if profile == "qbit":
|
||||
allowed += ("release_completion", "release_on_main", "release_tag_policy", "test_branch_policy")
|
||||
elif profile == "cli":
|
||||
allowed += ("publish_context",)
|
||||
elif profile in ("voyage", "frontend-next", "app-starter", "android", "mcp-policy", "repository-policy", "marketing", "application-template"):
|
||||
allowed = ("profile", "orb_version", "default_branch")
|
||||
elif profile == "all":
|
||||
allowed = ("profile", "orb_version", "default_branch", "publish", "publish_context")
|
||||
else:
|
||||
allowed += ("node_version",)
|
||||
if profile == "frontend-material":
|
||||
allowed += ("java_version",)
|
||||
if profile == "repository-policy":
|
||||
allowed += ("shell_checks",)
|
||||
mapping(data, allowed, "manifest")
|
||||
version = data.get("orb_version")
|
||||
if not isinstance(version, str) or not re.fullmatch(r"(?:\d+\.\d+(?:\.\d+)?|dev:[A-Za-z0-9_-]+)", version):
|
||||
raise ManifestError("orb_version must be a quoted minor track, exact stable pin, or development version")
|
||||
if version != setup_version:
|
||||
raise ManifestError("Manifest orb_version must match the setup job orb_version")
|
||||
default_branch = data.get("default_branch")
|
||||
if default_branch not in ("main", "develop"):
|
||||
raise ManifestError("default_branch must be main or develop")
|
||||
if profile == "marketing" and default_branch != "main":
|
||||
raise ManifestError("Marketing requires the audited main production branch")
|
||||
if profile == "homebrew-tap":
|
||||
tap, formula = data.get("tap"), data.get("formula")
|
||||
if not isinstance(tap, str) or not re.fullmatch(r"[a-z0-9][a-z0-9-]*/[a-z0-9][a-z0-9-]*", tap):
|
||||
raise ManifestError("Homebrew requires an explicit lowercase owner/tap")
|
||||
if not isinstance(formula, str) or not re.fullmatch(r"[a-z0-9][a-z0-9+@._-]*", formula):
|
||||
raise ManifestError("Homebrew requires a literal formula name")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"tap": tap, "formula": formula}
|
||||
java = data.get("java_version", "21")
|
||||
if java not in ("17", "21"):
|
||||
raise ManifestError("java_version must be the string 17 or 21")
|
||||
node = data.get("node_version", "24.21" if profile == "frontend-core" else "20")
|
||||
if not isinstance(node, str) or not re.fullmatch(r"\d+(?:\.\d+){0,2}", node):
|
||||
raise ManifestError("node_version must be an explicit numeric version string")
|
||||
if profile == "node-artifact":
|
||||
if "node_version" not in data or not re.fullmatch(r"\d+\.\d+(?:\.\d+)?", node):
|
||||
raise ManifestError("Node artifact requires an explicit minor or patch image version")
|
||||
context = data.get("context", "")
|
||||
scopes = data.get("npm_scopes", [])
|
||||
artifact = data.get("artifact_path")
|
||||
branches = data.get("build_branches")
|
||||
if not isinstance(context, str) or not re.fullmatch(r"[A-Za-z0-9_-]+", context):
|
||||
raise ManifestError("Node artifact requires an explicit context")
|
||||
if not isinstance(scopes, list) or any(not isinstance(x, str) or not re.fullmatch(r"@[a-z0-9][a-z0-9-]*", x) for x in scopes) or len(scopes) != len(set(scopes)):
|
||||
raise ManifestError("Invalid npm registry scopes")
|
||||
if not isinstance(artifact, str) or not re.fullmatch(r"[A-Za-z0-9_-]+(?:/[A-Za-z0-9_.-]+)+", artifact) or any(x in (".", "..") for x in artifact.split("/")):
|
||||
raise ManifestError("Artifact must be a relative file path")
|
||||
if not isinstance(branches, list) or not branches or any(not isinstance(x, str) or not re.fullmatch(r"[A-Za-z0-9_-]+(?:/[A-Za-z0-9_.-]+)*", x) for x in branches) or len(branches) != len(set(branches)):
|
||||
raise ManifestError("Build branches must be distinct literal branch names")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"node_version": node, "context": context, "npm_scopes": scopes,
|
||||
"artifact_path": artifact, "build_branches": branches}
|
||||
publish_keys = ("snapshot", "release_candidate", "release")
|
||||
if profile == "all":
|
||||
publish_keys = ("snapshot",)
|
||||
if profile == "cli":
|
||||
publish_keys = ("release",)
|
||||
if profile in ("qbit", "core"):
|
||||
publish_keys += ("asciidoc",)
|
||||
if profile == "qbit":
|
||||
publish_keys += ("hotfix", "feature")
|
||||
if profile not in ("qbit", "cli", "all", "app-starter", "voyage", "frontend-next"):
|
||||
publish_keys += ("feature", "hotfix")
|
||||
publishing = mapping(data.get("publish", {}), publish_keys, "publish")
|
||||
publish_context = data.get("publish_context", "")
|
||||
if not isinstance(publish_context, str) or (publish_context and not re.fullmatch(r"[A-Za-z0-9_-]+", publish_context)):
|
||||
raise ManifestError("publish_context must be a CircleCI context name")
|
||||
if profile == "all" and boolean(publishing, "snapshot", False) and not publish_context:
|
||||
raise ManifestError("All image publication requires an explicitly verified context")
|
||||
if profile == "cli" and boolean(publishing, "release", False) and not publish_context:
|
||||
raise ManifestError("CLI publication requires an explicitly verified context")
|
||||
if profile == "cli" and boolean(data, "docs_only", False):
|
||||
raise ManifestError("CLI currently requires full generated-client verification")
|
||||
tag_policy = data.get("release_tag_policy", "stable")
|
||||
if tag_policy not in ("stable", "v-prefix", "none"):
|
||||
raise ManifestError("Unsupported QBit release tag policy")
|
||||
test_policy = data.get("test_branch_policy", "all")
|
||||
if test_policy not in ("all", "non-release", "non-release-no-integration", "feature", "non-release-no-main",
|
||||
"non-release-no-hotfix", "non-release-no-hotfix-integration", "non-release-no-main-hotfix", "feature-no-hotfix"):
|
||||
raise ManifestError("Unsupported QBit test branch policy")
|
||||
return {"profile": profile, "orb_version": version, "default_branch": default_branch,
|
||||
"java_version": java, "node_version": node, "browsers": boolean(data, "browsers", True),
|
||||
"api_checks": boolean(data, "api_checks", False),
|
||||
"shell_checks": boolean(data, "shell_checks", False),
|
||||
"release_completion": boolean(data, "release_completion", False),
|
||||
"release_on_main": boolean(data, "release_on_main", False),
|
||||
"release_tag_policy": tag_policy, "test_branch_policy": test_policy,
|
||||
"docs_only": boolean(data, "docs_only", False),
|
||||
"publish_context": publish_context,
|
||||
"publish": {key: boolean(publishing, key, key != "asciidoc" and profile not in ("cli", "all", "repository-policy", "application-template")
|
||||
and not (profile == "qbit" and key in ("hotfix", "feature")))
|
||||
for key in publish_keys}}
|
||||
|
||||
|
||||
def git(*args):
|
||||
try:
|
||||
return subprocess.run(["git", *args], check=True, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.DEVNULL, timeout=60).stdout
|
||||
except (subprocess.SubprocessError, OSError):
|
||||
return None
|
||||
|
||||
|
||||
def proven_docs_only(config, branch, tag):
|
||||
if not config["docs_only"] or tag or not (branch == "main" or branch.startswith(("feature/", "hotfix/"))):
|
||||
return False
|
||||
if git("rev-parse", "--is-shallow-repository") != b"false\n":
|
||||
return False
|
||||
if branch == "main":
|
||||
base = git("rev-parse", "--verify", "HEAD^1")
|
||||
else:
|
||||
default = config["default_branch"]
|
||||
if git("fetch", "--no-tags", "origin", f"+refs/heads/{default}:refs/remotes/origin/{default}") is None:
|
||||
return False
|
||||
base = git("merge-base", "HEAD", f"refs/remotes/origin/{default}")
|
||||
if not base:
|
||||
return False
|
||||
changed = git("diff", "--no-ext-diff", "--no-renames", "--name-only", "-z", base.decode().strip(), "HEAD")
|
||||
if not changed:
|
||||
return False
|
||||
paths = changed.rstrip(b"\0").split(b"\0")
|
||||
eligible = all(path in (b"README.md", b"CHANGELOG.md", b"CONTRIBUTING.md") or
|
||||
(path.startswith(b"docs/") and path.endswith(b".md")) for path in paths)
|
||||
return base.decode().strip() if eligible else False
|
||||
|
||||
|
||||
def proven_ci_maintenance(branch, tag):
|
||||
"""Keep application tests, but do not publish for isolated CI declarations."""
|
||||
if tag or not (branch == "main" or branch == "develop" or branch.startswith(("release/", "hotfix/"))):
|
||||
return False
|
||||
subject = git("log", "-1", "--format=%s")
|
||||
if not subject or not re.match(rb"ci(?:\([^\r\n()]+\))?: ", subject):
|
||||
return False
|
||||
parents = git("rev-list", "--parents", "-n", "1", "HEAD")
|
||||
if not parents or not re.fullmatch(rb"[0-9a-f]{40} [0-9a-f]{40}\n", parents):
|
||||
return False
|
||||
base = parents.split()[1].decode("ascii")
|
||||
changed = git("diff", "--no-ext-diff", "--no-renames", "--name-only", "-z", base, "HEAD")
|
||||
if not changed:
|
||||
return False
|
||||
allowed = {b".qqq-ci.yml", b".circleci/config.yml", b".github/workflows/codeql.yml",
|
||||
b".github/workflows/release-rc.yml", b".github/workflows/schema-drift.yml"}
|
||||
return all(path in allowed for path in changed.rstrip(b"\0").split(b"\0"))
|
||||
|
||||
|
||||
def event_kind(branch, tag, release_on_main=False, release_tag_policy="stable"):
|
||||
if tag:
|
||||
if release_tag_policy == "none" or not re.fullmatch(r"v.*" if release_tag_policy == "v-prefix" else r"v\d+\.\d+\.\d+", tag, flags=re.ASCII):
|
||||
return "test"
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
return "release" if tagged and tagged == git("rev-parse", "HEAD") else "test"
|
||||
if branch == "main" and release_on_main:
|
||||
return "release"
|
||||
if branch == "develop":
|
||||
return "snapshot"
|
||||
if re.fullmatch(r"release/.+", branch):
|
||||
return "release_candidate"
|
||||
return "test"
|
||||
|
||||
|
||||
def qbit_template(config, branch, tag):
|
||||
"""Profile-owned template; add future profiles as reviewed renderers, not raw YAML."""
|
||||
kind = event_kind(branch, tag, config.get("release_on_main", False), config.get("release_tag_policy", "stable"))
|
||||
if tag.startswith("publish") and config["publish"].get("feature", False):
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if tagged and tagged == git("rev-parse", "HEAD"):
|
||||
kind = "feature"
|
||||
if not tag and re.fullmatch(r"hotfix/.+", branch) and config["publish"].get("hotfix", False):
|
||||
kind = "hotfix"
|
||||
if kind != "test" and not config["publish"][kind]:
|
||||
kind = "test"
|
||||
maintenance = proven_ci_maintenance(branch, tag)
|
||||
if maintenance:
|
||||
kind = "test"
|
||||
workflow = "test_only" if kind == "test" else "publish_" + kind
|
||||
result = {"version": 2.1, "orbs": {"qqq-orb": "kingsrook/qqq-orb@" + config["orb_version"]}}
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
if kind == "test" and not tag and not maintenance:
|
||||
ignores = {"all": None, "non-release": "/(develop|release/.*)/",
|
||||
"non-release-no-integration": "/(develop|release/.*|integration.*)/",
|
||||
"feature": "/(develop|main|release/.*|integration.*)/",
|
||||
"non-release-no-main": "/(develop|main|release/.*)/",
|
||||
"non-release-no-hotfix": "/(develop|release/.*|hotfix/.*)/",
|
||||
"non-release-no-hotfix-integration": "/(develop|release/.*|hotfix/.*|integration.*)/",
|
||||
"non-release-no-main-hotfix": "/(develop|main|release/.*|hotfix/.*)/",
|
||||
"feature-no-hotfix": "/(develop|main|release/.*|hotfix/.*|integration.*)/"}
|
||||
ignored = ignores[config.get("test_branch_policy", "all")]
|
||||
if ignored:
|
||||
filters["branches"]["ignore"] = ["automation/qbit-rc-pending", ignored]
|
||||
docs_base = proven_docs_only(config, branch, tag) if kind == "test" and not maintenance else False
|
||||
if docs_base:
|
||||
# Keep the existing workflow/result identity even when Maven is not needed.
|
||||
result["jobs"] = {"docs_only": {"resource_class": "small", "docker": [{"image": "cimg/base:2026.03"}],
|
||||
"steps": ["checkout", {"run": {"name": "Check documentation whitespace",
|
||||
"command": f"git fetch --no-tags origin {docs_base}\ngit diff --check {docs_base} HEAD"}}]}}
|
||||
invocation = {"docs_only": {"name": "qqq-orb/mvn_test_only", "filters": filters}}
|
||||
else:
|
||||
options = {"java_version": config["java_version"], "install_browsers": config["browsers"],
|
||||
"compile_before_verify": False, "check_middleware_api_versions": config["api_checks"],
|
||||
"context": ["qqq-maven-registry-credentials"], "filters": filters}
|
||||
job = "qqq-orb/mvn_test_only"
|
||||
if kind != "test":
|
||||
job = "qqq-orb/mvn_publish"
|
||||
options.update(branch_type=kind, publish_asciidoc=config["publish"]["asciidoc"])
|
||||
if kind == "release_candidate":
|
||||
options["notify_rc_published"] = config["release_completion"]
|
||||
invocation = {job: options}
|
||||
result["workflows"] = {workflow: {"jobs": [invocation]}}
|
||||
return result
|
||||
|
||||
|
||||
def core_template(config, branch, tag):
|
||||
"""Keep the core acceptance/release graph in the orb; scripts stay with core."""
|
||||
result = copy.deepcopy(CORE_TEMPLATE)
|
||||
result["orbs"]["qqq-orb"] = "kingsrook/qqq-orb@" + config["orb_version"]
|
||||
kind = event_kind(branch, tag)
|
||||
if tag.startswith("publish"):
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if tagged and tagged == git("rev-parse", "HEAD"):
|
||||
kind = "feature"
|
||||
elif not tag and branch.startswith("hotfix/"):
|
||||
kind = "hotfix"
|
||||
if kind != "test" and not config["publish"][kind]:
|
||||
kind = "test"
|
||||
if kind == "test" and proven_docs_only(config, branch, tag):
|
||||
return qbit_template(config, branch, tag)
|
||||
workflow = {"test": "test_only", "hotfix": "publish_hotfix_release"}.get(kind, "publish_" + kind)
|
||||
result["workflows"] = {workflow: result["workflows"][workflow]}
|
||||
# Shared install_java owns unattended installation and the signed archive mirror.
|
||||
del result["commands"]["configure-package-install"]
|
||||
def remove_package_steps(value):
|
||||
if isinstance(value, list):
|
||||
return [remove_package_steps(item) for item in value if item != "configure-package-install"]
|
||||
if isinstance(value, dict):
|
||||
return {key: remove_package_steps(item) for key, item in value.items()}
|
||||
return value
|
||||
result = remove_package_steps(result)
|
||||
for name, job in result["jobs"].items():
|
||||
steps = job["steps"]
|
||||
for index, step in enumerate(steps):
|
||||
if step == "qqq-orb/mvn_build":
|
||||
steps[index] = {"qqq-orb/mvn_build": {"install_browsers": config["browsers"], "compile_before_verify": False}}
|
||||
elif step == "qqq-orb/install_java":
|
||||
steps[index] = {"qqq-orb/install_java": {"java_version": config["java_version"]}}
|
||||
elif isinstance(step, dict) and "qqq-orb/install_java" in step:
|
||||
step["qqq-orb/install_java"]["java_version"] = config["java_version"]
|
||||
if name in ("esb_broker_conformance", "sample_acceptance", "sample_multinode_acceptance", "sample_consumer_acceptance"):
|
||||
# Only save after the last successful executable verification step.
|
||||
last_run = max(i for i, step in enumerate(steps) if isinstance(step, dict) and "run" in step)
|
||||
steps.insert(last_run + 1, "qqq-orb/mvn_cache_save")
|
||||
# Keep the copied Lambda reports for the coverage workspace, but do not upload
|
||||
# them twice: their original directories are already uploaded by sample_acceptance.
|
||||
collect = result["commands"]["store-sample-results"]["steps"][0]["run"]
|
||||
collect["command"] = collect["command"].replace(
|
||||
' if [ -f "$report" ]; then',
|
||||
' case "${report##*/}" in\n'
|
||||
' TEST-com.kingsrook.sampleapp.SampleLambdaDispatchAcceptanceTest.xml|TEST-com.kingsrook.sampleapp.SampleSqsUtilityAcceptanceTest.xml) continue ;;\n'
|
||||
' esac\n if [ -f "$report" ]; then')
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
for invocation in result["workflows"][workflow]["jobs"]:
|
||||
job, options = next(iter(invocation.items()))
|
||||
options["filters"] = copy.deepcopy(filters)
|
||||
if job in ("qqq-orb/mvn_test_only", "qqq-orb/mvn_publish"):
|
||||
options.update(java_version=config["java_version"], install_browsers=config["browsers"],
|
||||
compile_before_verify=False, check_middleware_api_versions=config["api_checks"])
|
||||
if job == "qqq-orb/mvn_publish":
|
||||
options["publish_asciidoc"] = config["publish"]["asciidoc"]
|
||||
return result
|
||||
|
||||
|
||||
def frontend_template(config, branch, tag):
|
||||
material = config["profile"] == "frontend-material"
|
||||
kind = event_kind(branch, tag)
|
||||
if tag.startswith("publish") or (not material and tag.startswith("v")):
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if tagged and tagged == git("rev-parse", "HEAD"):
|
||||
kind = "feature" if tag.startswith("publish") else "release"
|
||||
elif not tag and branch.startswith("hotfix/"):
|
||||
kind = "hotfix"
|
||||
elif not tag and branch == "main" and not material:
|
||||
kind = "release"
|
||||
if kind != "test" and not config["publish"][kind]:
|
||||
kind = "test"
|
||||
maintenance = proven_ci_maintenance(branch, tag)
|
||||
if maintenance:
|
||||
kind = "test"
|
||||
if kind == "test" and not maintenance and proven_docs_only(config, branch, tag):
|
||||
result = qbit_template(config, branch, tag)
|
||||
result["workflows"]["test_only"]["jobs"][0]["docs_only"]["name"] = (
|
||||
"qqq-orb/mvn_frontend_test_only" if material else "qqq-orb/node_test_only")
|
||||
return result
|
||||
workflow = {"test": "test_only", "hotfix": "publish_hotfix_release"}.get(kind, "publish_" + kind)
|
||||
playwright = material and runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT") and kind in ("test", "snapshot")
|
||||
if playwright:
|
||||
workflow += "_with_playwright"
|
||||
result = {"version": 2.1, "orbs": {"qqq-orb": "kingsrook/qqq-orb@" + config["orb_version"]}}
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
job = "qqq-orb/" + ("mvn_frontend_" if material else "node_") + ("test_only" if kind == "test" else "publish")
|
||||
options = {"node_version": config["node_version"], "context": ["qqq-maven-registry-credentials"], "filters": filters}
|
||||
if material:
|
||||
options["java_version"] = config["java_version"]
|
||||
result["parameters"] = {"run_playwright": {"type": "boolean", "default": playwright}}
|
||||
else:
|
||||
options["context"].append("build-qqq-sample-app")
|
||||
if kind != "test":
|
||||
options["branch_type"] = kind
|
||||
if not material:
|
||||
options["npm_trusted_publishing"] = True
|
||||
jobs = []
|
||||
if playwright:
|
||||
result.update(copy.deepcopy(MATERIAL_TEMPLATE))
|
||||
steps = result["jobs"]["playwright_tests"]["steps"]
|
||||
for step in steps:
|
||||
if not isinstance(step, dict):
|
||||
continue
|
||||
if "restore_cache" in step:
|
||||
step["restore_cache"]["keys"] = ['material-npm-downloads-v1-{{ checksum "package-lock.json" }}', 'material-npm-downloads-v1-']
|
||||
if "save_cache" in step:
|
||||
step["save_cache"].update(key='material-npm-downloads-v1-{{ checksum "package-lock.json" }}', paths=["~/.npm"])
|
||||
if "run" in step and step["run"]["name"] == "Install dependencies":
|
||||
step["run"]["command"] = "npm ci --legacy-peer-deps --prefer-offline --cache ~/.npm"
|
||||
jobs.append({"playwright_tests": {"filters": copy.deepcopy(filters)}})
|
||||
options["requires"] = ["playwright_tests"]
|
||||
jobs.append({job: options})
|
||||
result["workflows"] = {workflow: {"jobs": jobs}}
|
||||
return result
|
||||
|
||||
|
||||
def cli_template(config, branch, tag):
|
||||
publish = False
|
||||
if tag.startswith("v") and config["publish"]["release"]:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
if not tagged and git("fetch", "--no-tags", "origin", f"refs/tags/{tag}:refs/tags/{tag}") is not None:
|
||||
tagged = git("rev-parse", "--verify", f"refs/tags/{tag}^{{commit}}")
|
||||
publish = bool(tagged and tagged == git("rev-parse", "HEAD"))
|
||||
filters = ({"branches": {"ignore": "/.*/"}, "tags": {"only": "/.*/"}} if tag else
|
||||
{"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}})
|
||||
options = {"publish": publish, "filters": filters}
|
||||
if publish:
|
||||
options["context"] = [config["publish_context"]]
|
||||
# CLI docs are still verified until its generated-client inputs get a dedicated policy.
|
||||
return {"version": 2.1, "orbs": {"qqq-orb": "kingsrook/qqq-orb@" + config["orb_version"]},
|
||||
"workflows": {"publish_release" if publish else "test_only": {"jobs": [{"qqq-orb/cli_verify_publish": options}]}}}
|
||||
|
||||
|
||||
def marketing_template(config, branch, tag):
|
||||
del config
|
||||
# Select the existing branch policy once; automation PRs use normal PR checks.
|
||||
selected = {"main": "production", "develop": "develop", "staging": "staging"}.get(
|
||||
branch, "release-candidate" if branch.startswith("release/") else "pr-checks")
|
||||
result = copy.deepcopy(MARKETING_TEMPLATE)
|
||||
workflow = result["workflows"][selected]
|
||||
for job in workflow["jobs"]:
|
||||
next(iter(job.values()))["filters"] = {
|
||||
"branches": {"ignore": "/.*/" if tag else "automation/qbit-rc-pending"},
|
||||
"tags": {"ignore": "/.*/"}}
|
||||
result["workflows"] = {"verify": workflow}
|
||||
return result
|
||||
|
||||
|
||||
def android_template(config, branch, tag):
|
||||
del config, branch, tag
|
||||
return copy.deepcopy(ANDROID_TEMPLATE)
|
||||
|
||||
|
||||
def policy_template(config, branch, tag):
|
||||
del config, branch, tag
|
||||
return copy.deepcopy(POLICY_TEMPLATE)
|
||||
|
||||
|
||||
def all_template(config, branch, tag):
|
||||
result = json.loads(json.dumps(ALL_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
jobs = result["workflows"]["verify-and-smoke"]["jobs"]
|
||||
for entry in jobs:
|
||||
next(iter(entry.values()))["filters"] = {"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}}
|
||||
if branch == "develop" and not tag and config["publish"]["snapshot"]:
|
||||
jobs.append({"qqq-orb/all_develop_image": {"context": [config["publish_context"]], "requires": ["build-and-test", "core", "full"], "filters": {"branches": {"only": "develop"}, "tags": {"ignore": "/.*/"}}}})
|
||||
return result
|
||||
|
||||
|
||||
def starter_template(config, branch, tag):
|
||||
del branch, tag
|
||||
result = json.loads(json.dumps(STARTER_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
result["workflows"]["test_only"]["jobs"][0]["qqq-orb/mvn_test_only"]["filters"]["branches"] = {"ignore": "automation/qbit-rc-pending"}
|
||||
return result
|
||||
|
||||
|
||||
def next_template(config, branch, tag):
|
||||
del branch, tag # Tag-only filters preserve the existing release validation.
|
||||
return json.loads(json.dumps(NEXT_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
|
||||
|
||||
def voyage_template(config, branch, tag):
|
||||
del tag # Existing job filters retain tag exclusion and main-only release actions.
|
||||
selected = "develop" if branch == "develop" else (
|
||||
"release" if branch == "main" or branch.startswith("release/") else "pull-request")
|
||||
result = json.loads(json.dumps(VOYAGE_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
result["workflows"] = {"verify": result["workflows"][selected]}
|
||||
return result
|
||||
|
||||
|
||||
def repository_policy_template(config, branch, tag):
|
||||
del branch, tag
|
||||
result = copy.deepcopy(REPOSITORY_POLICY_TEMPLATE)
|
||||
if config.get("shell_checks", False):
|
||||
job = result["jobs"]["validate-policy"]
|
||||
job["environment"] = {"QQQ_POLICY_SHELL": "true"}
|
||||
job["steps"].insert(1, {"run": {
|
||||
"name": "Install static shell validation",
|
||||
"command": "sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends shellcheck"}})
|
||||
return result
|
||||
|
||||
|
||||
def homebrew_template(config, branch, tag):
|
||||
del branch, tag
|
||||
result = copy.deepcopy(HOMEBREW_TEMPLATE)
|
||||
result["jobs"]["validate-tap"]["environment"].update({
|
||||
"QQQ_HOMEBREW_TAP": config["tap"], "QQQ_HOMEBREW_FORMULA": config["formula"]})
|
||||
return result
|
||||
|
||||
|
||||
def application_template(config, branch, tag):
|
||||
del config, branch, tag
|
||||
return copy.deepcopy(APPLICATION_TEMPLATE)
|
||||
|
||||
|
||||
PROFILE_TEMPLATES = {"application-template": application_template, "homebrew-tap": homebrew_template, "qbit": qbit_template, "core": core_template,
|
||||
"repository-policy": repository_policy_template,
|
||||
"frontend-material": frontend_template, "frontend-core": frontend_template,
|
||||
"cli": cli_template, "voyage": voyage_template, "frontend-next": next_template, "all": all_template, "app-starter": starter_template, "android": android_template, "mcp-policy": policy_template, "marketing": marketing_template}
|
||||
|
||||
|
||||
def node_artifact_template(config, branch, tag):
|
||||
# One checkout/install is shared by tests and an optional artifact build.
|
||||
lines = ["registry=https://registry.npmjs.org/"]
|
||||
lines += [scope + ":registry=https://npm.pkg.github.com/" for scope in config["npm_scopes"]]
|
||||
if config["npm_scopes"]:
|
||||
lines.append("//npm.pkg.github.com/:_authToken=${NPM_TOKEN}")
|
||||
npmrc = "printf '%s\\n' " + " ".join("'" + line + "'" for line in lines) + " >> .npmrc"
|
||||
steps = ["checkout", {"run": {"name": "Configure npm registries", "command": npmrc}},
|
||||
{"restore_cache": {"keys": ['node-artifact-npm-v1-{{ checksum "package-lock.json" }}', 'node-artifact-npm-v1-']}},
|
||||
{"run": {"name": "Install locked dependencies", "command": "npm ci --prefer-offline --cache ~/.npm"}},
|
||||
{"save_cache": {"key": 'node-artifact-npm-v1-{{ checksum "package-lock.json" }}', "paths": ["~/.npm"]}},
|
||||
{"run": {"name": "Test project", "command": "npm test"}}]
|
||||
if not tag and branch in config["build_branches"]:
|
||||
steps += [{"run": {"name": "Build artifact", "command": "npm run build"}},
|
||||
{"store_artifacts": {"path": config["artifact_path"], "destination": config["artifact_path"].split("/")[-1]}}]
|
||||
return {"version": 2.1,
|
||||
"jobs": {"node_artifact": {"docker": [{"image": "cimg/node:" + config["node_version"]}], "steps": steps}},
|
||||
"workflows": {"verify": {"jobs": [{"node_artifact": {"context": [config["context"]],
|
||||
"filters": {"branches": {"ignore": "automation/qbit-rc-pending"}, "tags": {"ignore": "/.*/"}}}}]}}}
|
||||
|
||||
|
||||
PROFILE_TEMPLATES["node-artifact"] = node_artifact_template
|
||||
|
||||
|
||||
def runtime_boolean(name):
|
||||
value = os.environ.get(name, "false").lower()
|
||||
if value in ("true", "1"):
|
||||
return True
|
||||
if value in ("false", "0"):
|
||||
return False
|
||||
raise ManifestError("Runtime boolean parameter has an unsupported representation")
|
||||
|
||||
|
||||
def continuation_parameters(profile):
|
||||
runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT")
|
||||
if profile != "frontend-material" and runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT"):
|
||||
raise ManifestError("run_playwright requires frontend-material")
|
||||
values = {"mongo_bind_diagnostics": runtime_boolean("QQQ_CI_MONGO_DIAGNOSTICS")}
|
||||
for key in ("next_acceptance_bundle_url", "next_acceptance_bundle_sha256", "next_acceptance_receipt_sha256"):
|
||||
values[key] = os.environ.get("QQQ_CI_" + key.upper(), "")
|
||||
if profile != "core":
|
||||
if any(values.values()):
|
||||
raise ManifestError("Core pipeline parameters require the core profile")
|
||||
return {}
|
||||
return values
|
||||
|
||||
|
||||
def main():
|
||||
config = load_manifest(os.environ.get("QQQ_CI_MANIFEST", ".qqq-ci.yml"), os.environ.get("QQQ_CI_ORB_VERSION", ""))
|
||||
expected = os.environ.get("CIRCLE_SHA1")
|
||||
if expected and (not re.fullmatch(r"[0-9a-fA-F]{40}", expected) or git("rev-parse", "HEAD") != (expected + "\n").encode()):
|
||||
raise ManifestError("Checkout does not match the pipeline commit")
|
||||
output = PROFILE_TEMPLATES[config["profile"]](config, os.environ.get("CIRCLE_BRANCH", ""), os.environ.get("CIRCLE_TAG", ""))
|
||||
if config["profile"] in ("qbit", "core", "frontend-core", "frontend-material"):
|
||||
# One whole-workflow check follows the same commit from feature to release.
|
||||
# Keep every selected job, dependency and filter; add no runner or duplicate build.
|
||||
if len(output["workflows"]) != 1:
|
||||
raise ManifestError("Stable verification requires exactly one selected workflow")
|
||||
output["workflows"] = {"verify": next(iter(output["workflows"].values()))}
|
||||
parameters = continuation_parameters(config["profile"])
|
||||
if config["profile"] == "core":
|
||||
output["parameters"] = copy.deepcopy(CORE_TEMPLATE["parameters"])
|
||||
for name, value in parameters.items():
|
||||
output["parameters"][name]["default"] = value
|
||||
elif config["profile"] == "frontend-material":
|
||||
output["parameters"] = {"run_playwright": {"type": "boolean", "default": runtime_boolean("QQQ_CI_RUN_PLAYWRIGHT")}}
|
||||
encoded = json.dumps(output, indent=2) + "\n"
|
||||
Path(os.environ.get("QQQ_CI_OUTPUT", "/tmp/qqq-generated-config.json")).write_text(encoded, encoding="utf-8")
|
||||
if os.environ.get("QQQ_CI_CONTINUE") == "true":
|
||||
key = os.environ.get("CIRCLE_CONTINUATION_KEY")
|
||||
if not key:
|
||||
raise ManifestError("CircleCI continuation key is unavailable")
|
||||
# Values are in the continued declarations, avoiding setup/API parameter conflicts.
|
||||
payload = json.dumps({"continuation-key": key, "configuration": encoded}).encode()
|
||||
request = urllib.request.Request("https://circleci.com/api/v2/pipeline/continue", data=payload,
|
||||
headers={"Content-Type": "application/json"}, method="POST")
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=60) as response:
|
||||
if response.status != 200:
|
||||
raise ManifestError("CircleCI continuation failed")
|
||||
except urllib.error.HTTPError as error:
|
||||
raise ManifestError(f"CircleCI continuation failed (HTTP {error.code})") from error
|
||||
except (urllib.error.URLError, TimeoutError) as error:
|
||||
raise ManifestError("CircleCI continuation failed; inspect pipeline status") from error
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
main()
|
||||
except ManifestError as error:
|
||||
# ManifestError messages are authored above; never include raw input or HTTP bodies.
|
||||
print(f"Pipeline generation failed: {error}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except yaml.YAMLError:
|
||||
print("Pipeline generation failed: invalid manifest YAML.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
except OSError:
|
||||
print("Pipeline generation failed: manifest input or generated output is inaccessible.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
python3 - <<'PYTHON'
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
sha = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()
|
||||
if not re.fullmatch(r"[0-9a-f]{40}", sha) or sha != os.environ.get("CIRCLE_SHA1"):
|
||||
raise SystemExit("Artifact checkout does not match the pipeline SHA")
|
||||
paths = ["qqq-all-app/target/qqq-all-app.jar", "qqq-all-app/target/smoke-classpath.txt"]
|
||||
actual = {"sha": sha, "artifacts": {p: hashlib.sha256(Path(p).read_bytes()).hexdigest() for p in paths}}
|
||||
receipt = Path(".qqq-ci-artifact.json")
|
||||
action = os.environ.get("QQQ_ALL_ARTIFACT_ACTION", "check")
|
||||
if action == "write":
|
||||
receipt.write_text(json.dumps(actual, sort_keys=True) + "\n", encoding="utf-8")
|
||||
elif action == "check":
|
||||
if json.loads(receipt.read_text(encoding="utf-8")) != actual:
|
||||
raise SystemExit("Artifact or source identity differs from the verified build")
|
||||
else:
|
||||
raise SystemExit("Unknown artifact receipt action")
|
||||
print("Verified qqq-all artifact identity for " + sha)
|
||||
PYTHON
|
||||
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
mvn -B -ntp --update-snapshots -pl qqq-all-app -am \
|
||||
dependency:build-classpath -DincludeGroupIds=com.kingsrook.qqq,com.kingsrook.qbits \
|
||||
-Dmdep.outputFile=target/smoke-classpath.txt
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
python3 scripts/run_core_smoke.py qqq-all-app/target/qqq-all-app.jar
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
[[ "${CIRCLE_BRANCH:-}" == develop && -z "${CIRCLE_TAG:-}" ]] || { echo "Develop image requires develop branch" >&2; exit 1; }
|
||||
# Retain the original public-package gate: no implicit package visibility changes.
|
||||
: "${GITHUB_TOKEN:?GitHub Packages credential required}"
|
||||
if ! registry_user=$(python3 - <<'PYTHON'
|
||||
import json
|
||||
import os
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
def get(path):
|
||||
request = urllib.request.Request("https://api.github.com/" + path,
|
||||
headers={"Authorization": "Bearer " + os.environ["GITHUB_TOKEN"], "Accept": "application/vnd.github+json"})
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
return json.load(response)
|
||||
|
||||
try:
|
||||
if get("orgs/QRun-IO/packages/container/qqq-all").get("visibility") != "public":
|
||||
raise SystemExit(1)
|
||||
user = get("user").get("login")
|
||||
if not isinstance(user, str) or not user:
|
||||
raise SystemExit(1)
|
||||
print(user)
|
||||
except (urllib.error.URLError, ValueError):
|
||||
raise SystemExit(1) from None
|
||||
PYTHON
|
||||
); then
|
||||
echo "Skipped image publication: qqq-all package is not publicly readable by this credential"
|
||||
exit 0
|
||||
fi
|
||||
printf '%s' "$GITHUB_TOKEN" | docker login ghcr.io -u "$registry_user" --password-stdin
|
||||
docker build --label org.opencontainers.image.source=https://github.com/QRun-IO/qqq-all --tag ghcr.io/qrun-io/qqq-all:develop .
|
||||
docker push ghcr.io/qrun-io/qqq-all:develop
|
||||
@@ -0,0 +1,320 @@
|
||||
"""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())
|
||||
@@ -0,0 +1,192 @@
|
||||
"""Bounded RC reconciliation. Dispatch only; tagging remains in the trusted reusable workflow."""
|
||||
import datetime
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import xml.etree.ElementTree as ET
|
||||
import zipfile
|
||||
from email.utils import parsedate_to_datetime
|
||||
|
||||
SHA = re.compile(r'[0-9a-f]{40}')
|
||||
BRANCH = re.compile(r'release/\d+\.\d+(?:\.\d+)?')
|
||||
VERSION = re.compile(r'Bump version to (\d+\.\d+\.\d+-RC\.\d+) \[skip ci\]')
|
||||
LOCK = 'automation/qbit-rc-pending'
|
||||
|
||||
|
||||
class InvalidIntent(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
class NoAuthRedirect(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, request, fp, code, msg, headers, newurl):
|
||||
if not newurl.startswith('https://'):
|
||||
raise InvalidIntent('Non-HTTPS artifact redirect')
|
||||
redirected = super().redirect_request(request, fp, code, msg, headers, newurl)
|
||||
redirected.remove_header('Authorization')
|
||||
return redirected
|
||||
|
||||
|
||||
class API:
|
||||
def __init__(self, token):
|
||||
self.token = token
|
||||
self.deadline = time.monotonic() + 480
|
||||
self.calls = 0
|
||||
self.opener = urllib.request.build_opener(NoAuthRedirect())
|
||||
|
||||
def request(self, path, payload=None, raw=False):
|
||||
self.calls += 1
|
||||
if self.calls > 500 or time.monotonic() >= self.deadline:
|
||||
raise InvalidIntent('Sweep API/time budget exhausted')
|
||||
req = urllib.request.Request('https://api.github.com/' + path,
|
||||
headers={'Authorization': 'Bearer ' + self.token, 'Accept': 'application/vnd.github+json',
|
||||
'X-GitHub-Api-Version': '2022-11-28'},
|
||||
data=None if payload is None else json.dumps(payload).encode())
|
||||
try:
|
||||
with self.opener.open(req, timeout=20) as response:
|
||||
body = response.read(2_000_001)
|
||||
if len(body) > 2_000_000:
|
||||
raise InvalidIntent('Oversized API response')
|
||||
return body if raw else (json.loads(body) if body else None)
|
||||
except urllib.error.HTTPError as error:
|
||||
if error.code == 404:
|
||||
return None
|
||||
raise InvalidIntent('GitHub HTTP ' + str(error.code)) from None
|
||||
|
||||
def central(self, artifact, version):
|
||||
if time.monotonic() >= self.deadline:
|
||||
raise InvalidIntent('Sweep time budget exhausted')
|
||||
url = f'https://repo1.maven.org/maven2/com/kingsrook/qbits/{artifact}/{version}/{artifact}-{version}.pom'
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=20) as response:
|
||||
return response.read(1_000_000), response.headers.get('Last-Modified')
|
||||
except urllib.error.HTTPError as error:
|
||||
if error.code == 404:
|
||||
return None
|
||||
raise InvalidIntent('Central HTTP ' + str(error.code)) from None
|
||||
|
||||
|
||||
def validate_run(run, intent, repo, merge, run_id):
|
||||
if not run or run.get('status') != 'completed' or run.get('conclusion') != 'success':
|
||||
raise InvalidIntent('Cut run not successfully completed')
|
||||
if run.get('path') != '.github/workflows/release-rc.yml' or run.get('event') not in ('workflow_dispatch', 'pull_request'):
|
||||
raise InvalidIntent('Untrusted cut workflow/event')
|
||||
if any(run.get(key, {}).get('full_name') != repo for key in ('repository', 'head_repository')):
|
||||
raise InvalidIntent('Wrong cut repository')
|
||||
if str(run.get('id')) != str(run_id) or str(run.get('run_attempt')) != intent.get('attempt'):
|
||||
raise InvalidIntent('Wrong cut run/attempt')
|
||||
if (intent.get('repo'), intent.get('merge_sha'), intent.get('run_id')) != (repo, merge, str(run_id)):
|
||||
raise InvalidIntent('Intent/source mismatch')
|
||||
if not BRANCH.fullmatch(intent.get('branch', '')):
|
||||
raise InvalidIntent('Invalid release branch')
|
||||
|
||||
|
||||
def reconcile(api, repo):
|
||||
prefix = 'repos/' + repo + '/'
|
||||
lock = api.request(prefix + 'git/ref/heads/' + LOCK)
|
||||
if lock is None:
|
||||
return 'idle'
|
||||
merge = lock['object']['sha']
|
||||
if not SHA.fullmatch(merge):
|
||||
raise InvalidIntent('Invalid lock source')
|
||||
name = 'qbit-rc-intent-' + merge
|
||||
result = api.request(prefix + 'actions/artifacts?name=' + name + '&per_page=100')
|
||||
artifacts = [a for a in result['artifacts'] if a['name'] == name and not a['expired']]
|
||||
if not result['artifacts']:
|
||||
return 'intent-pending'
|
||||
if len(artifacts) != 1:
|
||||
raise InvalidIntent('Pending lock lacks unique unexpired cut intent; inspect cut run')
|
||||
artifact = artifacts[0]
|
||||
run_id = artifact['workflow_run']['id']
|
||||
run = api.request(prefix + 'actions/runs/' + str(run_id))
|
||||
# A callback/sweep can race the short upload-and-exit window. Leave the lock untouched.
|
||||
if run and run.get('status') != 'completed':
|
||||
return 'cut-running'
|
||||
archive = api.request(prefix + 'actions/artifacts/' + str(artifact['id']) + '/zip', raw=True)
|
||||
with zipfile.ZipFile(io.BytesIO(archive)) as zipped:
|
||||
info = zipped.getinfo('rc-intent.json')
|
||||
if info.file_size > 10000:
|
||||
raise InvalidIntent('Oversized intent')
|
||||
intent = json.loads(zipped.read(info))
|
||||
validate_run(run, intent, repo, merge, run_id)
|
||||
checks = api.request(prefix + 'commits/' + merge + '/check-runs?filter=latest&per_page=100')
|
||||
publishers = [c for c in checks.get('check_runs', [])
|
||||
if c.get('name') in ('publish_release_candidate', 'verify') and c.get('app', {}).get('id') == 18001]
|
||||
if not publishers:
|
||||
return 'publisher-running'
|
||||
publisher = max(publishers, key=lambda c: c['id'])
|
||||
if publisher.get('head_sha') != merge:
|
||||
raise InvalidIntent('Wrong Circle publisher source')
|
||||
if publisher.get('status') != 'completed':
|
||||
return 'publisher-running'
|
||||
if publisher.get('conclusion') != 'success':
|
||||
raise InvalidIntent('Upstream CircleCI terminal failure on exact release merge')
|
||||
branch = intent['branch']
|
||||
commit = api.request(prefix + 'commits/' + urllib.parse.quote(branch, safe=''))
|
||||
match = VERSION.fullmatch(commit['commit']['message'].split('\n')[0])
|
||||
if not match or [p['sha'] for p in commit['parents']] != [merge]:
|
||||
raise InvalidIntent('Bump is not the exact published merge child')
|
||||
version = match.group(1)
|
||||
if not SHA.fullmatch(commit['sha']):
|
||||
raise InvalidIntent('Invalid bump SHA')
|
||||
# Resolve coordinates from original source, never from dispatch data.
|
||||
contents = api.request(prefix + 'contents/pom.xml?ref=' + merge)
|
||||
import base64
|
||||
pom = ET.fromstring(base64.b64decode(contents['content']))
|
||||
ns = {'m': 'http://maven.apache.org/POM/4.0.0'}
|
||||
artifact_name = pom.findtext('m:artifactId', namespaces=ns)
|
||||
if not artifact_name or not re.fullmatch(r'qbit-[a-z0-9-]+', artifact_name):
|
||||
raise InvalidIntent('Invalid artifact coordinate')
|
||||
central = api.central(artifact_name, version)
|
||||
if central is None:
|
||||
return 'central-pending'
|
||||
xml, modified = central
|
||||
published = ET.fromstring(xml)
|
||||
if (published.findtext('m:artifactId', namespaces=ns), published.findtext('m:version', namespaces=ns)) != (artifact_name, version):
|
||||
raise InvalidIntent('Central artifact/version mismatch')
|
||||
if not modified or parsedate_to_datetime(modified).timestamp() <= datetime.datetime.fromisoformat(intent['merged_at'].replace('Z', '+00:00')).timestamp():
|
||||
raise InvalidIntent('Central provenance predates cut')
|
||||
# Re-read ownership immediately before dispatch; finalizer checks it again under concurrency.
|
||||
current = api.request(prefix + 'git/ref/heads/' + LOCK)
|
||||
if not current or current['object']['sha'] != merge:
|
||||
raise InvalidIntent('Pending lock changed')
|
||||
api.request(prefix + 'dispatches', {'event_type': 'qbit-rc-published', 'client_payload': {
|
||||
'merge_sha': merge, 'bump_sha': commit['sha'], 'branch': branch, 'version': version}})
|
||||
return 'dispatched'
|
||||
|
||||
|
||||
def main():
|
||||
token = os.environ.get('GH_TOKEN') or os.environ.get('GITHUB_TOKEN')
|
||||
if not token:
|
||||
raise InvalidIntent('Existing GH_TOKEN/GITHUB_TOKEN required; no cross-repo fallback token')
|
||||
repos = json.loads(os.environ['RC_REPOSITORIES_JSON'])
|
||||
if not isinstance(repos, list) or not 1 <= len(repos) <= 64 or len(set(repos)) != len(repos):
|
||||
raise InvalidIntent('Explicit unique allowlist of 1..64 repositories required')
|
||||
if any(not isinstance(repo, str) or not re.fullmatch(r'QRun-IO/qbit-[a-z0-9-]+', repo) for repo in repos):
|
||||
raise InvalidIntent('Invalid allowlisted repository')
|
||||
api = API(token)
|
||||
failures = []
|
||||
for repo in repos:
|
||||
try:
|
||||
print(repo + ': ' + reconcile(api, repo))
|
||||
except Exception as error:
|
||||
# No HTTP bodies, URLs, credentials or artifact content in logs.
|
||||
reason = str(error) if isinstance(error, InvalidIntent) else type(error).__name__
|
||||
print(repo + ': ERROR ' + reason, file=sys.stderr)
|
||||
failures.append(repo)
|
||||
if time.monotonic() >= api.deadline or api.calls >= 500:
|
||||
raise InvalidIntent('Sweep bounded budget exhausted; remaining repos await next scheduled run')
|
||||
if failures:
|
||||
raise InvalidIntent('Sweep failures: ' + ', '.join(failures))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
main()
|
||||
except InvalidIntent as error:
|
||||
sys.exit(str(error))
|
||||
@@ -28,13 +28,17 @@ if [[ "$CURRENT_BRANCH" == "main" ]]; then
|
||||
TARGET_VERSION="$MAJOR_MINOR.0"
|
||||
echo "Main branch detected - targeting release version: $TARGET_VERSION"
|
||||
elif [[ "$CURRENT_BRANCH" == "develop" ]]; then
|
||||
# Develop branch - should be a snapshot version (e.g., 1.0.127-SNAPSHOT)
|
||||
# Increment patch version for develop
|
||||
# Snapshot coordinates are unique per CI job without pushing a version commit.
|
||||
# The source head stays the head whose required checks are being reported.
|
||||
if [[ ! "${CIRCLE_BUILD_NUM:-}" =~ ^[1-9][0-9]*$ ]]; then
|
||||
echo "ERROR: Snapshot publication requires a positive CIRCLE_BUILD_NUM" >&2
|
||||
exit 1
|
||||
fi
|
||||
MAJOR_MINOR_PATCH="${NPM_VERSION%-*}"
|
||||
MAJOR_MINOR="${MAJOR_MINOR_PATCH%.*}"
|
||||
PATCH="${MAJOR_MINOR_PATCH##*.}"
|
||||
NEW_PATCH=$((PATCH + 1))
|
||||
TARGET_VERSION="$MAJOR_MINOR.$NEW_PATCH-SNAPSHOT"
|
||||
TARGET_VERSION="$MAJOR_MINOR.$NEW_PATCH-SNAPSHOT.$CIRCLE_BUILD_NUM"
|
||||
echo "Develop branch detected - targeting snapshot version: $TARGET_VERSION"
|
||||
elif [[ "$CURRENT_BRANCH" == release/* ]]; then
|
||||
# Release branch - should be a release candidate (e.g., 1.0.0-RC.1, 1.0.0-RC.2, etc.)
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"version": 2.1,
|
||||
"orbs": {
|
||||
"qqq-orb": "kingsrook/qqq-orb@__ORB_VERSION__"
|
||||
},
|
||||
"workflows": {
|
||||
"verify-and-smoke": {
|
||||
"jobs": [
|
||||
{
|
||||
"qqq-orb/all_verify": {
|
||||
"name": "build-and-test"
|
||||
}
|
||||
},
|
||||
{
|
||||
"qqq-orb/all_smoke": {
|
||||
"name": "core",
|
||||
"profile": "core",
|
||||
"requires": [
|
||||
"build-and-test"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"qqq-orb/all_smoke": {
|
||||
"name": "full",
|
||||
"profile": "full",
|
||||
"requires": [
|
||||
"build-and-test"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"version": 2.1,
|
||||
"orbs": {
|
||||
"android": "circleci/android@2.5.0",
|
||||
"gcp-cli": "circleci/gcp-cli@3.2.2"
|
||||
},
|
||||
"jobs": {
|
||||
"unit-test": {
|
||||
"executor": {
|
||||
"name": "android/android-machine",
|
||||
"tag": "default"
|
||||
},
|
||||
"steps": [
|
||||
"checkout",
|
||||
"android/restore-gradle-cache",
|
||||
{
|
||||
"android/run-tests": {
|
||||
"test-command": "./gradlew testDebug"
|
||||
}
|
||||
},
|
||||
"android/save-gradle-cache",
|
||||
{
|
||||
"run": {
|
||||
"name": "Save test results",
|
||||
"command": "mkdir -p ~/test-results/junit/\nfind . -type f -regex \".*/build/test-results/.*xml\" -exec cp {} ~/test-results/junit/ \\;\n",
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"store_test_results": {
|
||||
"path": "~/test-results"
|
||||
}
|
||||
},
|
||||
{
|
||||
"store_artifacts": {
|
||||
"path": "~/test-results/junit"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"android-test": {
|
||||
"parameters": {
|
||||
"system-image": {
|
||||
"type": "string",
|
||||
"default": "system-images;android-30;google_apis;x86"
|
||||
}
|
||||
},
|
||||
"executor": {
|
||||
"name": "android/android-machine",
|
||||
"tag": "default"
|
||||
},
|
||||
"steps": [
|
||||
"checkout",
|
||||
{
|
||||
"android/start-emulator-and-run-tests": {
|
||||
"test-command": "./gradlew connectedDebugAndroidTest",
|
||||
"system-image": "<< parameters.system-image >>"
|
||||
}
|
||||
},
|
||||
{
|
||||
"run": {
|
||||
"name": "Save test results",
|
||||
"command": "mkdir -p ~/test-results/junit/\nfind . -type f -regex \".*/build/outputs/androidTest-results/.*xml\" -exec cp {} ~/test-results/junit/ \\;\n",
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"store_test_results": {
|
||||
"path": "~/test-results"
|
||||
}
|
||||
},
|
||||
{
|
||||
"store_artifacts": {
|
||||
"path": "~/test-results/junit"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"maven-deploy": {
|
||||
"executor": {
|
||||
"name": "android/android-machine",
|
||||
"tag": "default"
|
||||
},
|
||||
"steps": [
|
||||
"checkout",
|
||||
"android/restore-gradle-cache",
|
||||
{
|
||||
"run": {
|
||||
"name": "Publish with shared Maven credentials",
|
||||
"command": "set -euo pipefail\n: \"${GITHUB_TOKEN:?GitHub Packages write credential is required}\"\n# Authenticate before compiling; repository access is necessary, not proof of package write access.\nregistry_user=$(python3 \\<<'PYTHON'\nimport json\nimport os\nimport urllib.request\n\nclass NoRedirect(urllib.request.HTTPRedirectHandler):\n def redirect_request(self, req, fp, code, msg, headers, newurl):\n raise RuntimeError(\"GitHub authentication redirect refused\")\n\ntry:\n opener = urllib.request.build_opener(NoRedirect)\n def get(path):\n request = urllib.request.Request(\"https://api.github.com/\" + path,\n headers={\"Authorization\": \"Bearer \" + os.environ[\"GITHUB_TOKEN\"],\n \"Accept\": \"application/vnd.github+json\"})\n with opener.open(request, timeout=30) as response:\n return json.load(response)\n user = get(\"user\").get(\"login\")\n if not isinstance(user, str) or not user or not get(\"repos/QRun-IO/qqq-maven-registry\").get(\"permissions\", {}).get(\"push\"):\n raise ValueError(\"Missing registry access\")\n print(user)\nexcept Exception:\n raise SystemExit(\"GitHub Packages credential cannot access the Maven registry\") from None\nPYTHON\n)\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryUsername=\"$registry_user\"\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryPassword=\"$GITHUB_TOKEN\"\n./gradlew --console=plain publishMavenPublicationToGithubQqqMavenRegistryRepository\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"workflows": {
|
||||
"test-and-build": {
|
||||
"jobs": [
|
||||
"unit-test",
|
||||
{
|
||||
"android-test": {}
|
||||
},
|
||||
{
|
||||
"maven-deploy": {
|
||||
"requires": [
|
||||
"unit-test",
|
||||
"android-test"
|
||||
],
|
||||
"filters": {
|
||||
"branches": {
|
||||
"only": "main"
|
||||
}
|
||||
},
|
||||
"context": [
|
||||
"qqq-maven-registry-credentials"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 212 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user