Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ac47adc21 |
No files matched your search
@@ -1,9 +1,5 @@
|
||||
version: 2.1
|
||||
setup: true
|
||||
parameters:
|
||||
run_rc_finalize_sweep:
|
||||
type: boolean
|
||||
default: false
|
||||
orbs:
|
||||
orb-tools: circleci/orb-tools@12.3
|
||||
shellcheck: circleci/shellcheck@3.2
|
||||
@@ -12,23 +8,8 @@ filters: &filters
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
jobs:
|
||||
rc-finalize-sweep:
|
||||
docker:
|
||||
- image: cimg/python:3.12
|
||||
resource_class: small
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Reconcile pending QBit releases
|
||||
command: |
|
||||
RC_REPOSITORIES_JSON="$(cat tools/rc-repositories.json)" \
|
||||
python3 src/scripts/rc_finalize_sweep.py
|
||||
|
||||
workflows:
|
||||
lint-pack:
|
||||
when:
|
||||
not: << pipeline.parameters.run_rc_finalize_sweep >>
|
||||
jobs:
|
||||
- orb-tools/lint:
|
||||
filters: *filters
|
||||
@@ -46,13 +27,3 @@ 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: /.*/
|
||||
+23
-67
@@ -12,6 +12,13 @@ filters: &filters
|
||||
tags:
|
||||
only: /.*/
|
||||
|
||||
# Filter for release tags.
|
||||
release-filters: &release-filters
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/
|
||||
|
||||
# Auto-publish filters.
|
||||
develop-filters: &develop-filters
|
||||
branches:
|
||||
@@ -22,73 +29,13 @@ 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
|
||||
pipeline-contract-test:
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: cimg/python:3.12-node
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Install the setup manifest parser
|
||||
command: python3 -m pip install --disable-pip-version-check PyYAML==6.0.3
|
||||
- run:
|
||||
name: Verify pipeline selection and Maven compatibility contracts
|
||||
command: |
|
||||
python3 tests/test_generate_pipeline.py
|
||||
python3 scripts/pack_pipeline.py --check
|
||||
bash tests/test_cli_ci_behavior.sh
|
||||
python3 tests/test_cli_ci_contract.py
|
||||
python3 tests/test_maven_ci_contract.py
|
||||
python3 tests/test_standardize_qbit.py
|
||||
python3 tests/test_validate_standard.py
|
||||
python3 tests/test_voyage_profile.py
|
||||
python3 tests/test_next_native.py
|
||||
python3 tests/test_auxiliary_workflows.py
|
||||
python3 tests/test_intellij_plugin.py
|
||||
python3 tests/test_workflow_lint.py
|
||||
python3 tests/test_business_e2e.py
|
||||
python3 tests/test_qctl_native.py
|
||||
python3 -m unittest discover -s tests -p test_generate_qctl_workflow.py
|
||||
python3 tests/test_rc_finalize_sweep.py
|
||||
python3 tests/test_rc_guard.py
|
||||
python3 -m unittest discover -s tests -p test_generate_rc_workflow.py
|
||||
python3 -m unittest discover -s tests -p test_audit_estate.py
|
||||
python3 tests/test_all_profiles.py
|
||||
python3 tests/test_generate_all_release.py
|
||||
python3 -m unittest discover -s tests -p 'test_qqq_all_release*.py'
|
||||
python3 tests/test_verify_all_circle_smoke.py
|
||||
python3 tests/test_mobile_policy_profiles.py
|
||||
bash tests/test_all_artifact.sh
|
||||
python3 tests/test_maven_ci_rc_completion.py
|
||||
bash tests/test_maven_ci_push.sh
|
||||
bash tests/test_create_github_release.sh
|
||||
bash tests/test_maven_ci_cache.sh
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
# Create jobs to test the commands of your orbs.
|
||||
# You may want to add additional validation steps to ensure the commands are working as expected.
|
||||
command-test:
|
||||
docker:
|
||||
- image: cimg/node:24.21
|
||||
- image: cimg/base:current
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Verify Maven settings stay out of build logs
|
||||
command: bash tests/test_maven_settings_output.sh
|
||||
- run:
|
||||
name: Verify npm publisher authentication and dist-tags
|
||||
command: python3 tests/test_node_npm_publish.py
|
||||
# Run your orb's commands to validate them.
|
||||
- qqq-orb/install_asciidoctor
|
||||
|
||||
@@ -156,17 +103,26 @@ 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
|
||||
# The orb must be re-packed for publishing, and saved to the workspace.
|
||||
- orb-tools/pack:
|
||||
filters: *release-filters
|
||||
- orb-tools/publish:
|
||||
orb_name: kingsrook/qqq-orb
|
||||
vcs_type: << pipeline.project.type >>
|
||||
pub_type: production
|
||||
# Ensure this job requires all test jobs and the pack job.
|
||||
requires:
|
||||
- orb-tools/pack
|
||||
- command-test
|
||||
context: orb-publishing
|
||||
filters: *release-filters
|
||||
# Auto-publish dev snapshot on develop
|
||||
- publish-dev-snapshot:
|
||||
context: orb-publishing
|
||||
filters: *develop-filters
|
||||
requires: [command-test, pipeline-contract-test, maven-publication-contract]
|
||||
requires: [command-test]
|
||||
# Auto-publish production release on main
|
||||
- publish-production:
|
||||
context: orb-publishing
|
||||
filters: *main-filters
|
||||
requires: [command-test, pipeline-contract-test, maven-publication-contract]
|
||||
requires: [command-test]
|
||||
@@ -1,6 +0,0 @@
|
||||
# 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
|
||||
@@ -1 +0,0 @@
|
||||
* @KofTwentyTwo
|
||||
@@ -1,18 +0,0 @@
|
||||
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
|
||||
@@ -1,83 +0,0 @@
|
||||
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
|
||||
@@ -1,42 +0,0 @@
|
||||
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: {}
|
||||
@@ -1,51 +0,0 @@
|
||||
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
|
||||
@@ -1,109 +0,0 @@
|
||||
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
|
||||
@@ -1,38 +0,0 @@
|
||||
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
|
||||
@@ -1,109 +0,0 @@
|
||||
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
|
||||
@@ -1,77 +0,0 @@
|
||||
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
|
||||
@@ -1,278 +0,0 @@
|
||||
# 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
|
||||
@@ -1,157 +0,0 @@
|
||||
# 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
|
||||
@@ -1,74 +0,0 @@
|
||||
# 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"
|
||||
@@ -1,370 +0,0 @@
|
||||
# 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
|
||||
merge_sha:
|
||||
type: string
|
||||
default: ''
|
||||
bump_sha:
|
||||
type: string
|
||||
default: ''
|
||||
branch:
|
||||
type: string
|
||||
default: ''
|
||||
version:
|
||||
type: string
|
||||
default: ''
|
||||
secrets:
|
||||
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 }}
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 10
|
||||
outputs:
|
||||
branch: ${{ steps.merge.outputs.branch }}
|
||||
merge_sha: ${{ steps.merge.outputs.merge_sha }}
|
||||
merged_at: ${{ steps.merge.outputs.merged_at }}
|
||||
steps:
|
||||
- name: Merge develop into the release line
|
||||
id: merge
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
REPO: ${{ github.repository }}
|
||||
DRY_RUN: ${{ inputs.dry_run }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
# An unresolved release owns this ref until verified finalization or explicit recovery.
|
||||
lock=automation/qbit-rc-pending
|
||||
if gh api "repos/$REPO/git/ref/heads/$lock" --silent 2>/dev/null; then
|
||||
echo "::error::An RC is unresolved ($lock); finalize or explicitly recover it before cutting another."
|
||||
exit 1
|
||||
fi
|
||||
develop_sha=$(gh api "repos/$REPO/branches/develop" -q .commit.sha)
|
||||
revision=$(gh api "repos/$REPO/contents/pom.xml?ref=$develop_sha" -q .content | base64 -d \
|
||||
| sed -n 's:.*<revision>\(.*\)</revision>.*:\1:p' | head -n 1)
|
||||
if [[ ! "$revision" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)-SNAPSHOT$ ]]; then
|
||||
echo "::error::develop pom.xml <revision> must be X.Y.Z-SNAPSHOT, found '$revision'"
|
||||
exit 1
|
||||
fi
|
||||
full="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
|
||||
line="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
|
||||
branch_exists() { gh api "repos/$REPO/branches/$1" --silent 2>/dev/null; }
|
||||
if branch_exists "release/$full"; then branch="release/$full"
|
||||
elif branch_exists "release/$line"; then branch="release/$line"
|
||||
else branch=""; fi
|
||||
|
||||
if [[ "$DRY_RUN" != true ]]; then
|
||||
# POST is atomic: a concurrent creator gets 422 and cannot steal the lock.
|
||||
gh api "repos/$REPO/git/refs" -f ref="refs/heads/$lock" -f sha="$develop_sha" --silent
|
||||
fi
|
||||
if [[ -z "$branch" ]]; then
|
||||
branch="release/$line"
|
||||
echo "Plan: create $branch from develop $develop_sha (first RC of $full)"
|
||||
[[ "$DRY_RUN" == true ]] && exit 0
|
||||
gh api "repos/$REPO/git/refs" -f ref="refs/heads/$branch" -f sha="$develop_sha" --silent
|
||||
merge_sha="$develop_sha"
|
||||
else
|
||||
echo "Plan: merge develop $develop_sha into $branch"
|
||||
[[ "$DRY_RUN" == true ]] && exit 0
|
||||
# 201 merged, 204 already up to date (nothing new to release), 409 conflict.
|
||||
response=$(gh api --include "repos/$REPO/merges" -f base="$branch" -f head="$develop_sha" \
|
||||
-f commit_message="Merge develop into $branch for the next $full RC" 2>&1) || true
|
||||
status=$(printf '%s\n' "$response" | sed -n 's:^HTTP/[0-9.]* \([0-9][0-9]*\).*:\1:p' | head -n 1)
|
||||
case "$status" in
|
||||
201) merge_sha=$(printf '%s\n' "$response" | sed '1,/^\r\{0,1\}$/d' | jq -er .sha) ;;
|
||||
204)
|
||||
[[ "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" == "$develop_sha" ]]
|
||||
gh api -X DELETE "repos/$REPO/git/refs/heads/$lock"
|
||||
echo "::warning::$branch already contains develop; no new RC"; exit 0 ;;
|
||||
409) echo "::error::Merge conflict between develop and $branch; resolve it in a PR into $branch"; exit 1 ;;
|
||||
*) echo "::error::Merge of develop into $branch failed (HTTP ${status:-unknown})"; exit 1 ;;
|
||||
esac
|
||||
fi
|
||||
[[ "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" == "$develop_sha" ]]
|
||||
gh api -X PATCH "repos/$REPO/git/refs/heads/$lock" -f sha="$merge_sha" -F force=false --silent
|
||||
merged_at=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||
jq -n --arg repo "$REPO" --arg branch "$branch" --arg merge_sha "$merge_sha" \
|
||||
--arg merged_at "$merged_at" --arg run_id "$GITHUB_RUN_ID" --arg attempt "$GITHUB_RUN_ATTEMPT" \
|
||||
'{repo:$repo,branch:$branch,merge_sha:$merge_sha,merged_at:$merged_at,run_id:$run_id,attempt:$attempt}' \
|
||||
> "$RUNNER_TEMP/rc-intent.json"
|
||||
{
|
||||
echo "branch=$branch"
|
||||
echo "merge_sha=$merge_sha"
|
||||
echo "merged_at=$merged_at"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
echo "Pushed $branch; CircleCI publish_release_candidate cuts the RC." >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "Release line: $branch. Waiting without a runner for qbit-rc-published." >> "$GITHUB_STEP_SUMMARY"
|
||||
- name: Persist trusted release intent
|
||||
if: steps.merge.outputs.merge_sha != ''
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: qbit-rc-intent-${{ steps.merge.outputs.merge_sha }}
|
||||
path: ${{ runner.temp }}/rc-intent.json
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
|
||||
tag-and-release:
|
||||
if: inputs.finalize
|
||||
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 }}
|
||||
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
|
||||
# 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):
|
||||
if status.get("sha") != merge_sha:
|
||||
raise ReleaseFailure("Status response does not identify the exact release merge")
|
||||
# Circle's workflow Check Run is stable even when job statuses receive -1/-2 suffixes.
|
||||
publishers = [x for x in status.get("check_runs", [])
|
||||
if x.get("name") == "publish_release_candidate" and x.get("app", {}).get("id") == 18001]
|
||||
if not publishers:
|
||||
return ""
|
||||
publisher = max(publishers, key=lambda x: x["id"])
|
||||
if publisher.get("head_sha") != merge_sha:
|
||||
raise ReleaseFailure("Publisher Check Run identifies a different source")
|
||||
if publisher.get("status") != "completed":
|
||||
return ""
|
||||
if publisher.get("conclusion") != "success":
|
||||
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")
|
||||
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")
|
||||
# END RC GUARD
|
||||
if __name__ == "__main__":
|
||||
import json, sys
|
||||
try:
|
||||
if 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:
|
||||
print(evaluate(sys.argv[1], json.load(open(sys.argv[2])), json.load(open(sys.argv[3]))))
|
||||
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}$ && "$BUMP_SHA" =~ ^[0-9a-f]{40}$ ]]
|
||||
[[ "$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=$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha 2>/dev/null || true)
|
||||
# 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"
|
||||
gh api "repos/$REPO/commits/$BUMP_SHA" > "$workdir/commit.json"
|
||||
version=$(python3 "$workdir/rc_guard.py" "$MERGE_SHA" "$workdir/status.json" "$workdir/commit.json")
|
||||
[[ -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=$(gh api "repos/$REPO/git/ref/tags/v$version" --jq '.object.sha' 2>/dev/null || true)
|
||||
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"
|
||||
@@ -1,30 +0,0 @@
|
||||
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: ''
|
||||
@@ -1,325 +0,0 @@
|
||||
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
|
||||
@@ -1,664 +0,0 @@
|
||||
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
|
||||
@@ -1,13 +0,0 @@
|
||||
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,7 +10,3 @@ tests/test_data
|
||||
.idea
|
||||
|
||||
.claude
|
||||
|
||||
# Local Python regression-test caches.
|
||||
__pycache__/
|
||||
*.pyc
|
||||
@@ -7,9 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
- Maven compile, verify and frontend test steps pass `--update-snapshots`, so SNAPSHOT dependencies restored from the pom-checksum-keyed `~/.m2` cache are re-checked against the remote on every build instead of going stale
|
||||
|
||||
### Added
|
||||
- Auto-publish `dev:snapshot` on develop branch pushes
|
||||
- Auto-publish production releases on main branch pushes with semantic version bumping
|
||||
|
||||
@@ -80,15 +80,3 @@ The orb uses CircleCI's "unpacked" format. YAML files in `src/` are packed into
|
||||
- `MAVEN_USERNAME`, `MAVEN_PASSWORD` - Sonatype credentials
|
||||
- `GPG_PRIVATE_KEY_B64`, `GPG_KEYNAME`, `GPG_PASSPHRASE` - GPG signing
|
||||
- `GITHUB_TOKEN` - GitHub API access
|
||||
|
||||
## Knowledge base
|
||||
|
||||
Deep-review dossiers for this repo and the wider QQQ platform live in the second-brain
|
||||
vault (Obsidian, `R:/Git.Local/KofTwentyTwo/second-brain`):
|
||||
|
||||
- Platform hub: `knowledge/qqq/qqq-hub.md`
|
||||
- This repo's dossier: `knowledge/qqq/repos/qqq-orb.md` (reviewed at develop
|
||||
commit `bdff16ff9582`, 2026-07-04) — covers 0.5.0→0.6.0→HEAD behavior changes,
|
||||
the npm dist-tag defect verdict, org-wide pin survey, licensing history, and
|
||||
open bug #5 (release-branch patch loss).
|
||||
- Release/versioning architecture: `knowledge/qqq/architecture/build-release-versioning.md`
|
||||
@@ -24,7 +24,6 @@ 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
|
||||
@@ -47,45 +46,9 @@ test-scripts:
|
||||
@echo "✅ Script tests passed!"
|
||||
|
||||
# Test all: run both orb tests and script tests
|
||||
test-all: test test-scripts test-pipelines
|
||||
test-all: test test-scripts
|
||||
@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_validate_standard.py
|
||||
python3 tests/test_voyage_profile.py
|
||||
python3 tests/test_next_native.py
|
||||
python3 tests/test_auxiliary_workflows.py
|
||||
python3 tests/test_intellij_plugin.py
|
||||
python3 tests/test_workflow_lint.py
|
||||
python3 tests/test_business_e2e.py
|
||||
python3 tests/test_qctl_native.py
|
||||
python3 -m unittest discover -s tests -p test_generate_qctl_workflow.py
|
||||
python3 tests/test_rc_finalize_sweep.py
|
||||
python3 tests/test_rc_guard.py
|
||||
python3 -m unittest discover -s tests -p test_generate_rc_workflow.py
|
||||
python3 -m unittest discover -s tests -p test_audit_estate.py
|
||||
python3 tests/test_all_profiles.py
|
||||
python3 tests/test_generate_all_release.py
|
||||
python3 -m unittest discover -s tests -p 'test_qqq_all_release*.py'
|
||||
python3 tests/test_verify_all_circle_smoke.py
|
||||
python3 tests/test_mobile_policy_profiles.py
|
||||
bash tests/test_all_artifact.sh
|
||||
python3 tests/test_maven_ci_rc_completion.py
|
||||
bash tests/test_maven_ci_push.sh
|
||||
bash tests/test_create_github_release.sh
|
||||
bash tests/test_maven_ci_cache.sh
|
||||
bash tests/test_maven_test_results.sh
|
||||
bash tests/test_maven_ci_install.sh
|
||||
bash tests/test_snapshot_refresh.sh
|
||||
bash tests/test_maven_settings_output.sh
|
||||
|
||||
# Clean up generated files
|
||||
clean:
|
||||
@echo "Cleaning up packed orb files..."
|
||||
@@ -209,9 +172,3 @@ 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
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
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:** Teams using CircleCI to build, test, and publish QQQ applications
|
||||
**Status:** Stable (v0.6.x)
|
||||
|
||||
@@ -63,20 +60,6 @@ workflows:
|
||||
| `static_analysis` | Run SpotBugs and PMD static analysis |
|
||||
| `security_scan` | Run Gitleaks, Semgrep, OWASP Dependency Check, and CycloneDX SBOM |
|
||||
|
||||
### npm Trusted Publishing
|
||||
|
||||
For npm Trusted Publishing, set `npm_trusted_publishing: true` and use a supported
|
||||
executor such as `node_version: "24.21"` on `node_publish`. Configure the package's
|
||||
[npm Trusted Publisher](https://docs.npmjs.com/trusted-publishers/) for the exact
|
||||
CircleCI organization, project, pipeline definition and VCS origin, and allow
|
||||
direct `npm publish`. The job requires Node >=22.14.0 and npm >=11.5.1, obtains an
|
||||
OIDC identity at publish time, and does not run `npm whoami` or need `NPM_TOKEN`.
|
||||
Existing token authentication remains the default. Trusted mode requires no
|
||||
project `.npmrc` or npm credential/config-path environment settings; it ignores user/global
|
||||
npm config and clears conventional token variables to prevent token fallback.
|
||||
CircleCI does not currently provide npm provenance attestations. A successful
|
||||
real publication, not a dry run, verifies the trust relationship.
|
||||
|
||||
### Branch Types
|
||||
|
||||
| Branch | Version Format |
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,42 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,67 +0,0 @@
|
||||
# Estate audit policy
|
||||
|
||||
`tools/audit_estate.py` classifies repositories from explicit mappings and observed source.
|
||||
It never changes consumers, branch rules or publication settings.
|
||||
|
||||
- Circle profiles include android, mcp-policy and marketing. Their manifest and canonical
|
||||
setup caller remain mandatory; a missing configuration is a finding.
|
||||
- MCP, business-platform and the organization `.github` repository use approved native
|
||||
bridges from `src/scripts/templates/auxiliary-bridges.json`. Unknown remaining workflows
|
||||
are findings. Legacy Circle configuration remains a finding until retired after equivalent
|
||||
native checks pass on the actual consumer head. Business E2E is not implicitly approved.
|
||||
- `qqq-orb` is the owner/bootstrap exception, not a consumer of itself. Audit requires its
|
||||
lint/pack/review/ShellCheck graph and continuation dependencies, executable command and
|
||||
pipeline-contract test jobs, and develop/main publishers gated by those tests. Both
|
||||
publishers must pack, validate and publish. This structural check is not hosted proof.
|
||||
- `tools/no-ci-policy.json` approves exactly nine named repositories with rationale,
|
||||
immutable baseline SHA and required identity paths. Their approved state has no Circle,
|
||||
Actions, manifest, Jenkins or GitLab entrypoint at the declared paths. A new workflow or
|
||||
missing identity path is drift; an unknown repository never inherits this exemption.
|
||||
Baseline SHA records audit provenance, not a requirement to freeze documentation forever.
|
||||
|
||||
`managed_branches` is an explicit, nonempty unique list of `main` and/or `develop`,
|
||||
provided only after branch inventory readback. Its default is both for compatibility.
|
||||
The auditor queries only listed branches. A missing policy remains unknown; an API
|
||||
403/404 does not prove a branch is absent and remains unknown. A policy entry alone
|
||||
never proves a branch exists: successful `Snapshot.checks` first reads the branch.
|
||||
|
||||
Only the exact approved no-CI repositories may declare an empty expected context list.
|
||||
They pass that check only after successful readback returns an actually empty set.
|
||||
Stale required contexts are findings. Ordinary, native and owner profiles still reject
|
||||
empty context policies. No-CI classification documents absence, not product readiness.
|
||||
|
||||
Required-check policy is independent of classification. Without an explicit observed
|
||||
context policy and successful branch-rule readback, check status stays `unknown`, including
|
||||
no-CI and bootstrap repositories. No classification fabricates a passing merge check.
|
||||
|
||||
## Organization workflow lint bridge
|
||||
|
||||
Generate only after the worker is published at an immutable commit:
|
||||
|
||||
```sh
|
||||
python src/scripts/generate_auxiliary_workflow.py github-workflow-lint --ref <40SHA>
|
||||
```
|
||||
|
||||
The output belongs at `.github/workflows/workflow-lint.yml` in `QRun-IO/.github`.
|
||||
The orb owns `.github/workflows/workflow-lint.yml` as a reusable worker. It retains the
|
||||
original Circle `cimg/go:1.24` image and exact actionlint v1.7.7 command over
|
||||
`.github/workflows/*.yml`, with checkout and read-only contents permission. Branch pushes
|
||||
run lint; fork PRs also run it without secrets. Same-repository PR events do not duplicate
|
||||
push lint, and tags do not add new builds. Manual dispatch is available for verification.
|
||||
|
||||
Keep the existing Circle actionlint pipeline and legacy RC worker until a hosted native
|
||||
canary proves tool/runtime equivalence and the required-check migration is reviewed.
|
||||
Do not remove the old RC coordinator while any consumer still references it.
|
||||
|
||||
## Checks
|
||||
|
||||
```sh
|
||||
python3 -m unittest discover -s tests -p test_audit_estate.py -v
|
||||
python3 -m unittest discover -s tests -p test_workflow_lint.py -v
|
||||
python3 -m unittest discover -s tests -p test_auxiliary_workflows.py -v
|
||||
actionlint .github/workflows/workflow-lint.yml
|
||||
```
|
||||
|
||||
Tests cover exact no-CI allowlists and drift, unknown repositories, missing configured
|
||||
profiles/native bridges, retained legacy workflows, bootstrap dependency/gate removal,
|
||||
required-check unknown states, and the lint image/tool/command/caller contract.
|
||||
@@ -1,224 +0,0 @@
|
||||
# Standardized QQQ pipelines
|
||||
|
||||
The orb owns workflow selection and job configuration. A consumer declares a
|
||||
small manifest; it does not copy pipeline jobs. The initial supported profile is
|
||||
`qbit`; `core` owns the framework's complete acceptance/release graph. Frontend
|
||||
and CLI profiles described below retain their own publication contracts. Additional
|
||||
profiles belong in reviewed `PROFILE_TEMPLATES` renderers in
|
||||
`src/scripts/generate_pipeline.py`, with profile-specific schema and tests. There
|
||||
is no arbitrary script or job-YAML passthrough.
|
||||
|
||||
Use the same **published** orb version in all three positions below. `0.7.0` is
|
||||
an illustrative version, not a claim that this change is published. A development
|
||||
orb version can be used for a controlled canary.
|
||||
|
||||
`.circleci/config.yml`:
|
||||
|
||||
```yaml
|
||||
version: 2.1
|
||||
setup: true
|
||||
orbs:
|
||||
qqq-orb: kingsrook/qqq-orb@0.7.0
|
||||
workflows:
|
||||
setup:
|
||||
jobs:
|
||||
- qqq-orb/generate_pipeline:
|
||||
orb_version: "0.7.0"
|
||||
filters:
|
||||
branches:
|
||||
ignore: automation/qbit-rc-pending
|
||||
tags:
|
||||
only: /.*/
|
||||
```
|
||||
|
||||
`.qqq-ci.yml`:
|
||||
|
||||
```yaml
|
||||
profile: qbit
|
||||
orb_version: "0.7.0"
|
||||
default_branch: develop
|
||||
java_version: "21"
|
||||
browsers: false
|
||||
api_checks: false
|
||||
docs_only: false
|
||||
publish:
|
||||
snapshot: true
|
||||
release_candidate: true
|
||||
release: true
|
||||
asciidoc: false
|
||||
```
|
||||
|
||||
Only `profile`, `orb_version` and `default_branch` are required. `default_branch`
|
||||
must be `develop` or `main`; Java must be the string `17` or `21`. Browsers default
|
||||
to **true** for compatibility: opt out only after verifying that the consumer has
|
||||
no browser tests. API checks and docs-only default to false. Publication defaults
|
||||
to true for snapshots, RCs and tagged releases; AsciiDoc publication defaults to
|
||||
false. Unknown/duplicate keys, unexpected types, unsupported profiles and a setup
|
||||
parameter/manifest version mismatch fail before continuation. The canonical-caller
|
||||
validator also verifies the setup import, filters and profile-specific parameter
|
||||
declarations; additional jobs, commands, workflows or orbs fail validation. The
|
||||
parser is pinned to PyYAML 6.0.3 and uses its safe loader.
|
||||
|
||||
| Event | Workflow | Job contract |
|
||||
| --- | --- | --- |
|
||||
| develop | publish_snapshot | existing mvn_publish, snapshot |
|
||||
| release/* | publish_release_candidate | existing mvn_publish, release_candidate |
|
||||
| vX.Y.Z tag resolving to the checkout | publish_release | existing mvn_publish, release |
|
||||
| main, feature/*, hotfix/*, other/unknown branch | test_only | existing mvn_test_only |
|
||||
| Disabled publication or unrecognized/unproven tag | test_only | full verification, no publication |
|
||||
|
||||
The pipeline SHA must match the checkout when Circle supplies it. A tagged release
|
||||
must resolve to that checkout; missing local tags are fetched individually. A main
|
||||
push does **not** publish a release. Migrating a legacy main-publishing consumer
|
||||
therefore requires explicit review of its release contract. Existing direct orb
|
||||
callers remain supported.
|
||||
|
||||
The setup filter and generated jobs exclude `automation/qbit-rc-pending`, the
|
||||
shared RC orchestrator's persistent release lock. Lock updates must not trigger
|
||||
Maven test or publication work.
|
||||
|
||||
The shared jobs keep the `qqq-maven-registry-credentials` context, complete verify,
|
||||
coverage and configured API checks. Publishing retains version management, signed
|
||||
artifact deployment, Git operations and release handling. Generated calls disable
|
||||
the redundant preliminary compile; they do not skip tests or verification. Existing
|
||||
callers retain the compatibility defaults in the jobs.
|
||||
|
||||
## Core profile
|
||||
|
||||
QBit alone accepts `release_completion: true` (default false). It enables the
|
||||
shared Maven RC job's `notify_rc_published` only for RC publication, including
|
||||
fail-closed verification that the bumped version was pushed before dispatching
|
||||
the completion event. Enable this on a consumer only after its default branch
|
||||
contains the shared completion caller. Snapshot and GA jobs never receive this
|
||||
opt-in; other profiles reject the key.
|
||||
|
||||
Use `profile: core` for the QQQ framework. The orb owns the complete baseline
|
||||
acceptance, broker conformance, cold bootstrap, coverage, diagnostics, static
|
||||
analysis and publication graph. Core scripts remain in the core source repository.
|
||||
The independent baseline fixture pins job sets, dependency edges, contexts,
|
||||
coverage requirements and actual verification commands across all six workflows.
|
||||
|
||||
Core additionally supports `publish.feature` and `publish.hotfix` (both true by
|
||||
default), preserving `publish*` tag and hotfix branch publication. QBit does not
|
||||
accept these keys. Snapshot, RC and GA behavior remains distinct; RC/GA/hotfix
|
||||
publication still requires the complete source coverage gate. Cold bootstrap and
|
||||
fresh consumer Maven repositories remain uncached. Shared installer policy replaces
|
||||
local package preparation; preliminary compilation is disabled before clean
|
||||
lifecycles and the dependency cache is saved after successful verification.
|
||||
|
||||
Lambda XML copies remain in sample coverage evidence. The sample JUnit collector
|
||||
excludes those two copied reports because their original module directories are
|
||||
already uploaded, avoiding duplicate test identities without dropping evidence.
|
||||
|
||||
External core API triggers require these declarations in the tiny **setup** config:
|
||||
|
||||
```yaml
|
||||
parameters:
|
||||
mongo_bind_diagnostics:
|
||||
type: boolean
|
||||
default: false
|
||||
next_acceptance_bundle_url:
|
||||
type: string
|
||||
default: ""
|
||||
next_acceptance_bundle_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
next_acceptance_receipt_sha256:
|
||||
type: string
|
||||
default: ""
|
||||
```
|
||||
|
||||
Forward each value on `qqq-orb/generate_pipeline`, for example
|
||||
`mongo_bind_diagnostics: << pipeline.parameters.mongo_bind_diagnostics >>`, and
|
||||
likewise for the three bundle parameters. Requested values become defaults in the
|
||||
continued configuration; the continuation POST deliberately omits `parameters` to
|
||||
avoid CircleCI's setup/continuation/API parameter conflict. Verify both default and
|
||||
explicit API-triggered parameter values in the hosted canary before migrating
|
||||
triggering consumers. Other profiles reject non-default core parameters.
|
||||
|
||||
## Frontend profiles
|
||||
|
||||
`frontend-material` preserves the Maven frontend build/test/package/publication
|
||||
jobs, Java21/Node20 defaults, registry context, feature-tag, RC, GA and hotfix
|
||||
contracts. Declare setup pipeline parameter `run_playwright` (boolean, default
|
||||
false) and forward `run_playwright: << pipeline.parameters.run_playwright >>` on
|
||||
the generator job. Test/snapshot events select exactly one base or Playwright graph,
|
||||
so enabling visual tests cannot publish twice. Visual testing retains the pinned
|
||||
Playwright image, npm ci with legacy peer dependencies and report uploads; only
|
||||
npm downloads (`~/.npm`) are cached, never node_modules.
|
||||
|
||||
`frontend-core` preserves Node24.21, npm trusted publishing and both existing
|
||||
registry/build-sample contexts. Unlike QBit, its existing main-push **and v-tag**
|
||||
release contract remains intentional. Both frontend profiles support explicit
|
||||
numeric-string `node_version` and publication toggles including feature/hotfix.
|
||||
Material also supports `java_version`. Browser/API/AsciiDoc flags are rejected
|
||||
rather than silently ignored on these profiles. Existing direct jobs remain usable.
|
||||
|
||||
## CLI profile
|
||||
|
||||
`cli` owns npm install, generated-client drift, build, unit tests and the real
|
||||
Prism smoke contract through `cli_verify_publish`. Publication is **disabled by
|
||||
default**. To enable the existing v-tag publication, declare `publish.release:
|
||||
true` plus `publish_context: VERIFIED_CONTEXT_NAME`, after verifying that an
|
||||
existing trusted CircleCI context grants the required GitHub Packages permission.
|
||||
No context name or credential availability is inferred from the former Actions
|
||||
GITHUB_TOKEN. A tag must resolve to the current checkout; the job additionally
|
||||
checks the client version before publishing its three fixed workspaces with the
|
||||
existing rc dist-tag. Main pushes never publish. CLI docs-only is currently
|
||||
rejected because generated-client verification remains mandatory.
|
||||
|
||||
## Conservative documentation routing
|
||||
|
||||
With `docs_only: true`, only feature/hotfix and main changes can take the light
|
||||
route. Feature/hotfix branches fetch the declared default branch without tags and
|
||||
compare its merge base with HEAD, covering the whole branch. Main compares its first
|
||||
parent. Develop, release branches and all tags remain full. Shallow repositories,
|
||||
missing ancestry, fetch/diff errors, empty diffs and unknown paths remain full.
|
||||
|
||||
Only root README.md, CHANGELOG.md, CONTRIBUTING.md and Markdown files below docs/
|
||||
are eligible. Renames are treated as deletion plus addition, so moving code into
|
||||
docs cannot hide it. The lightweight job checks whitespace over the proven diff;
|
||||
manifest validation already ran in setup. It adds no new security scanner and
|
||||
makes no security-scanning claim. Keep docs-only disabled if those paths are build
|
||||
inputs or packaged application content.
|
||||
|
||||
The light route keeps workflow `test_only` and names its job
|
||||
`qqq-orb/mvn_test_only`. Verify actual CircleCI/GitHub status contexts on the canary
|
||||
before changing any protection rule; workflow/job identity alone is not proof of
|
||||
the hosted context name. Current protections must not be removed speculatively.
|
||||
|
||||
## Implementation and verification
|
||||
|
||||
The setup job checks out source, installs the pinned parser, runs the embedded
|
||||
Python resource and invokes CircleCI's native continuation API once. JSON output
|
||||
is valid CircleCI configuration YAML; it is saved at
|
||||
`/tmp/qqq-generated-config.json`. No external framework or per-consumer generator
|
||||
installation is required. Readable templates live in src/scripts/templates. scripts/pack_pipeline.py embeds
|
||||
them as base64 into packed_generate_pipeline.py before orb packing, preventing
|
||||
CircleCI from interpolating template expressions during setup. The orb includes
|
||||
the complete generated resource; no runtime source-tree template access is needed.
|
||||
make pack regenerates it and CI rejects a stale generated resource.
|
||||
Continuation credentials and response bodies are never printed.
|
||||
|
||||
Run `make test-pipelines` with CircleCI CLI, Python3/PyYAML and Bash available.
|
||||
Tests use offline temporary Git repositories and a bare origin to cover selection,
|
||||
whole-branch changes, tags, errors, defaults and source/packed parity. The hosted
|
||||
pipeline-contract-test runs the source suite and shared Maven behavioral tests;
|
||||
the full local target additionally extracts and executes the actual packed command.
|
||||
|
||||
## Android and MCP policy profiles
|
||||
|
||||
`android` and `mcp-policy` accept only profile, orb_version and default_branch.
|
||||
Android retains the audited Android/GCP orb versions and every active unit,
|
||||
emulator and Maven-publication step. The emulator now runs on main as well as
|
||||
feature branches so main publication cannot omit its required instrumentation
|
||||
gate. Dormant Firebase benchmark and release-build definitions referencing absent
|
||||
app/macrobenchmark modules are not scheduled or copied into the profile.
|
||||
|
||||
MCP policy validation remains a small Python container validating all visible YAML
|
||||
and required pattern fields. Its existing PyYAML dependency is pinned to 6.0.3.
|
||||
Neither profile introduces Maven/JUnit stand-ins for its actual tests.
|
||||
|
||||
`tests/test_mobile_policy_profiles.py` protects Android steps and dependency edges
|
||||
and executes the policy validator with valid, incomplete and malformed documents.
|
||||
The generator suite verifies source/packed parity for both profiles.
|
||||
@@ -1,41 +0,0 @@
|
||||
# Marketing pipeline ownership
|
||||
|
||||
The `marketing` profile accepts only `profile`, `orb_version`, and
|
||||
`default_branch: main`. The QQQ version must match the setup caller's explicit
|
||||
orb version. The canonical QQQ setup produces one final continuation containing
|
||||
jobs from the pinned `kof22/munitor@0.3.11` orb. It never invokes Munitor's setup
|
||||
generator or creates another continuation.
|
||||
|
||||
The profile is the exact semantic graph rendered by Munitor 0.3.11 from
|
||||
marketing-website commit `4eb5f63b9fbfac8e5529fcd638324870cea08ae2`, with its
|
||||
manifest's floating `0.3` pin changed to `0.3.11` for the baseline render.
|
||||
The checked-in fixture records that real render; the JSON resource contains the
|
||||
same jobs, parameters, contexts, filters and dependency edges.
|
||||
|
||||
There are five workflows and 33 job invocations: PR checks (7), develop (7),
|
||||
staging (7), release candidate (8), and production (4). They preserve Node 22,
|
||||
Chromium Playwright and Lighthouse, the existing scan and quality jobs, advisory
|
||||
SAST, and the existing synthetic zero-threshold coverage command. That command
|
||||
does not measure actual coverage.
|
||||
|
||||
Production follows build → image build/Trivy/push/health → independent CD update
|
||||
and GitHub release. Both final jobs depend on the image job; neither depends on
|
||||
the other. Only main updates
|
||||
`KofTwentyTwo/cluster-gitops/tenants/qrun/website/kustomization.yaml`, using the
|
||||
existing `github` context; image publication uses `ghcr`. Production-only means
|
||||
no non-main deployment update, not no non-main artifacts: develop/staging image
|
||||
publishing and release-candidate GitHub releases remain unchanged.
|
||||
|
||||
Keep `.munitor.yml` as declarative worker input when migrating the consumer.
|
||||
Munitor's `generate_dockerfile` reads it from the attached workspace and requires
|
||||
`pipeline: node-webapp` and `docker.use_repo_dockerfile: true` to preserve the
|
||||
repository Dockerfile. The profile does not replace that file or validate all
|
||||
of its values. Changes to worker input require review alongside the centralized
|
||||
profile; arbitrary manifest job overrides are not supported. Health remains `/`
|
||||
on port 3000; the repository Dockerfile remains responsible for the standalone
|
||||
runtime without npm or npx.
|
||||
|
||||
`MarketingContractTests` checks whole-graph equality and explicit release/test
|
||||
contracts. The normal generator suite additionally checks source/packed parity.
|
||||
These are configuration tests, not a claim of hosted delivery, credentials,
|
||||
container health, or production deployment verification.
|
||||
@@ -1,36 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,41 +0,0 @@
|
||||
# Preserve existing QBit release selection
|
||||
|
||||
Migration now reads the audited job filters, not just the presence of a
|
||||
publication job. The following bounded QBit-only manifest fields preserve the
|
||||
recognized contracts:
|
||||
|
||||
| Field | Values | Behavior |
|
||||
|---|---|---|
|
||||
| `release_on_main` | boolean, default false | Main pushes select the existing release job when release publishing is enabled. |
|
||||
| `release_tag_policy` | `stable`, `v-prefix`, `none` | Stable `v1.2.3`, the existing broad `/v.*/` contract, or no tags. |
|
||||
| `test_branch_policy` | `all`, `non-release`, `non-release-no-integration`, `feature`, `non-release-no-main` | Selects one of the five audited test branch exclusions. |
|
||||
|
||||
`feature` preserves the original exclusion of develop, main, release branches,
|
||||
and integration-prefixed branches; it is not a new feature-prefix-only rule.
|
||||
All policies continue to exclude the RC coordination lock branch.
|
||||
No consumer-supplied regex, command, job, or arbitrary branch-publication rule
|
||||
is accepted.
|
||||
|
||||
An explicit tag policy also controls the canonical setup caller's tag filter.
|
||||
`none` prevents even setup from running on tags for the four test-only repos.
|
||||
Stable and broad policies run only their approved tags. Existing manifests
|
||||
without the field retain their previous canonical caller for compatibility.
|
||||
Every tag publication still verifies that the actual Git tag resolves to HEAD.
|
||||
Main publication does not invent a tag requirement that the existing jobs lacked.
|
||||
`publish.release: false` still disables release publication.
|
||||
|
||||
The 42 immutable source fixtures preserve eight main-push publishers, four broad
|
||||
tag publishers, the remaining stable tag publishers, and four test-only repos.
|
||||
Snapshot/RC inference accepts only the observed develop and release branch
|
||||
filters. Unknown filters, duplicate publication/test jobs, and custom job options
|
||||
fail migration rather than silently changing release behavior.
|
||||
|
||||
Use `tools/standardize_qbit.py --write` for the two-file migration. API callers
|
||||
must pass the inferred policy to
|
||||
`canonical_caller(version, manifest["release_tag_policy"])`; the legacy one-argument
|
||||
form is only for manifests without an explicit policy.
|
||||
|
||||
Focused tests cover the immutable inventory, unknown-filter rejection, canonical
|
||||
caller agreement, main opt-in, broad/stable tag selection, HEAD provenance,
|
||||
publication opt-out and test exclusions. The packed generator suite also exercises
|
||||
main, broad RC-shaped tags, and excluded integration branches.
|
||||
@@ -1,51 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,9 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,28 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,47 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,37 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,55 +0,0 @@
|
||||
# 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.
|
||||
@@ -1,82 +0,0 @@
|
||||
# RC completion without waiting runners
|
||||
|
||||
The reusable `qbit-release-rc.yml` keeps the existing cut entry point. `finalize: false`
|
||||
(the default) briefly merges develop, then records `qbit-rc-intent-<merge SHA>` as a
|
||||
90-day Actions artifact. It does not wait for CircleCI or Central. `finalize: true`
|
||||
accepts `merge_sha`, `bump_sha`, `branch`, and `version` from a publisher callback
|
||||
or explicit recovery retry. The callback is only a hint, never release authority.
|
||||
|
||||
The caller must remain `.github/workflows/release-rc.yml` on the repository default
|
||||
branch. It handles `repository_dispatch` type `qbit-rc-published` and passes those
|
||||
four fields and `finalize: true` to this reusable, with `secrets: inherit` and
|
||||
`contents: write`, `actions: read`, `checks: read`. Existing manual dispatch and merged/labelled
|
||||
PR cut behavior remains in the tiny caller. Add an explicit finalization retry
|
||||
option to manual dispatch; retrying finalization must not request another cut.
|
||||
GitHub documents dispatch/default-branch behavior at:
|
||||
https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#repository_dispatch
|
||||
|
||||
## Ownership and provenance
|
||||
|
||||
- A cut atomically creates `refs/heads/automation/qbit-rc-pending` before changing
|
||||
the release branch. The ref initially points at develop and then at the exact
|
||||
merge API response SHA. A second cut fails while it exists. CI must ignore this
|
||||
exact automation branch. The lock has no expiry or automatic takeover.
|
||||
- Cut and finalizer share one repository concurrency group. The pending ref holds
|
||||
ownership between these short runs; workflow concurrency alone cannot do that.
|
||||
- Finalization retrieves the unique unexpired intent artifact and verifies its
|
||||
originating successful `release-rc.yml` run, repository, trigger and attempt.
|
||||
Callback fields must match that immutable intent.
|
||||
- The exact merge SHA must have a successful `publish_release_candidate` Check Run
|
||||
from CircleCI app ID `18001`; unrelated job statuses cannot authorize release.
|
||||
Terminal publisher failure stops finalization immediately. Pending/absent publication cannot authorize a tag.
|
||||
The RC bump must have exactly that one parent and the release branch must still
|
||||
point to it. A later unrelated bump or an old version is never substituted.
|
||||
- The Central POM must identify the expected artifact/version and have a
|
||||
Last-Modified time after the cut. Missing Central visibility leaves the intent
|
||||
pending, with no tag, no lock release, no sleeping runner.
|
||||
- Tags remain SSH-signed annotated tags using `QRUN_TAG_SIGNING_KEY`. Temporary
|
||||
key/repository/intent files are cleaned on all shell exits. Existing annotated
|
||||
tags must resolve to the exact bump; duplicate delivery cannot retarget a tag.
|
||||
A tag created before an interrupted release operation can finish the missing
|
||||
prerelease on retry. Ownership is compared again before lock deletion.
|
||||
|
||||
## Automatic retry and rollout
|
||||
|
||||
The orb's single centrally scheduled `rc_finalize_sweep` job uses the existing
|
||||
`qqq-maven-registry-credentials` context's `GITHUB_TOKEN` (or `GH_TOKEN`) and an
|
||||
explicit JSON allowlist, not `.github`'s repository-limited Actions token. It
|
||||
reads only pending locks, validates cut provenance and exact publisher success,
|
||||
checks Central availability, and redispatches the same immutable candidate.
|
||||
Idle repositories cause one read and no finalizer job. Central delay causes a
|
||||
later scheduled retry, not allocated polling. Terminal failure is visible in
|
||||
sweep job failure; the lock stays for diagnosis. Bound: 64 repositories,
|
||||
500 GitHub calls, 480 seconds plus the current bounded request; no infinite retry.
|
||||
The root owns the single Circle schedule and confirms existing credential access
|
||||
before enabling it. No new credential or service is required by this patch.
|
||||
|
||||
Roll out shared reusable and default-branch callers first, then the released orb
|
||||
callback/profile plus automation-branch exclusion. Enable the one central sweep
|
||||
only after checking the allowlist and representative cross-repository API access.
|
||||
The orb callback must be opt-in until callers exist, RC-only, after successful
|
||||
deployment AND successful pushed bump, with remote head and direct parent checks.
|
||||
Do not emit a callback after the legacy warning-only failed version push.
|
||||
|
||||
## Recovery
|
||||
|
||||
A failed cut, expired artifact, failed publisher or conflicting tag deliberately
|
||||
retains the lock. Inspect the cut run, lock SHA, release branch, Circle result,
|
||||
Central artifact and tag/release before changing state. If the cut is recoverable,
|
||||
retry the same publication/finalization; do not delete the lock merely to unblock
|
||||
another version. For an abandoned cut, an authorized operator must compare the
|
||||
current lock with the recorded expected SHA immediately before deleting that
|
||||
exact ref, under the same release lane. Never delete a different cut's lock or
|
||||
retag a published version. A missing/expired trusted artifact requires explicit
|
||||
release-captain reconciliation; the sweep does not invent provenance.
|
||||
|
||||
## Local checks
|
||||
|
||||
`python -m unittest discover -s tests -v` exercises the exact inline evaluator.
|
||||
`actionlint -shellcheck= .github/workflows/qbit-release-rc.yml` validates Actions
|
||||
syntax. Full actionlint with Windows native ShellCheck hung locally and was
|
||||
stopped; Linux actionlint/ShellCheck and end-to-end credential/callback rollout
|
||||
verification remain required. The orb has separate sweep/dispatch fixture tests.
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Embed profile resources before Circle packs/interpolates its own syntax."""
|
||||
import base64
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import zlib
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
source = root / "src/scripts/generate_pipeline.py"
|
||||
output = root / "src/scripts/packed_generate_pipeline.py"
|
||||
text = source.read_text(encoding="utf-8")
|
||||
start = text.index("# BEGIN PROFILE RESOURCES")
|
||||
end = text.index("# END PROFILE RESOURCES") + len("# END PROFILE RESOURCES")
|
||||
embedded = ["# Generated by scripts/pack_pipeline.py; edit source/resources, then regenerate.", "import base64", "import zlib"]
|
||||
for variable, name in (("CORE_TEMPLATE", "core"), ("MATERIAL_TEMPLATE", "frontend-material"), ("VOYAGE_TEMPLATE", "voyage"), ("NEXT_TEMPLATE", "frontend-next"), ("ALL_TEMPLATE", "all"), ("STARTER_TEMPLATE", "app-starter"), ("ANDROID_TEMPLATE", "android"), ("POLICY_TEMPLATE", "mcp-policy"), ("MARKETING_TEMPLATE", "marketing")):
|
||||
payload = base64.b64encode(zlib.compress((source.parent / "templates" / (name + ".json")).read_bytes(), level=9)).decode("ascii")
|
||||
embedded.append(f'{variable} = json.loads(zlib.decompress(base64.b64decode("{payload}")))')
|
||||
packed = text[:start] + "\n".join(embedded) + text[end:]
|
||||
if len(packed.encode("utf-8")) > 100_000:
|
||||
sys.exit("Packed generator exceeds the tested CircleCI command-argument budget")
|
||||
if "--check" in sys.argv:
|
||||
if not output.exists() or output.read_text(encoding="utf-8") != packed:
|
||||
sys.exit("Packed generator is stale; run python3 scripts/pack_pipeline.py")
|
||||
else:
|
||||
output.write_text(packed, encoding="utf-8", newline="\n")
|
||||
@@ -1,49 +0,0 @@
|
||||
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) >>
|
||||
@@ -1,12 +0,0 @@
|
||||
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,10 +5,6 @@ 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"
|
||||
@@ -23,5 +19,4 @@ 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)>>
|
||||
@@ -1,7 +1,6 @@
|
||||
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).
|
||||
|
||||
|
||||
+17
-25
@@ -1,31 +1,23 @@
|
||||
description: >
|
||||
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"
|
||||
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
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: Setup Maven Settings
|
||||
command: <<include(scripts/setup_maven_settings.sh)>>
|
||||
- mvn_cache_restore
|
||||
- when:
|
||||
condition: << parameters.install_browsers >>
|
||||
steps:
|
||||
- browser-tools/install-chrome
|
||||
- browser-tools/install-chromedriver
|
||||
- when:
|
||||
condition: << parameters.compile_before_verify >>
|
||||
steps:
|
||||
- run:
|
||||
name: Run Maven Compile
|
||||
command: <<include(scripts/mvn_build_compile.sh)>>
|
||||
- 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" }}
|
||||
@@ -1,12 +0,0 @@
|
||||
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 }}-
|
||||
@@ -1,13 +0,0 @@
|
||||
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,8 +1,9 @@
|
||||
description: >
|
||||
Publishes artifacts to Maven Central (Sonatype Central Portal)
|
||||
- Configures Maven credentials without logging settings
|
||||
- Restores Maven dependency cache
|
||||
- Debugs Maven settings to verify configuration
|
||||
- Sets up GPG signing for artifact verification
|
||||
- Deploys signed artifacts and waits for confirmed Central release publication
|
||||
- Deploys signed artifacts to Maven Central using release profile
|
||||
- Saves Maven cache for future builds
|
||||
|
||||
steps:
|
||||
@@ -14,9 +15,6 @@ steps:
|
||||
command: <<include(scripts/mvn_jar_deploy_gpg_setup.sh)>>
|
||||
- run:
|
||||
name: Publish to Sonatype Central (releases and SNAPSHOTs)
|
||||
# Central's native publication wait can be silent for its 30-minute limit.
|
||||
# Let Maven return its real result before CircleCI's inactivity watchdog.
|
||||
no_output_timeout: 35m
|
||||
command: <<include(scripts/mvn_jar_deploy.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
description: >
|
||||
Runs the complete Maven lifecycle including tests and generates reports
|
||||
- Saves the complete Maven dependency repository after successful verification
|
||||
- Restores Maven dependency cache
|
||||
- Runs Maven verify (compile, test, package, verify)
|
||||
- Collects JaCoCo code coverage reports
|
||||
- Stores test output artifacts
|
||||
@@ -13,7 +13,6 @@ 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)>>
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
description: >
|
||||
Runs the production build for a Node.js application
|
||||
- Executes the build script with timing output
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
build_script:
|
||||
type: string
|
||||
default: "build"
|
||||
description: "Name of the build script in package.json."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Production build"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
BUILD_SCRIPT: << parameters.build_script >>
|
||||
command: <<include(scripts/node_app_build.sh)>>
|
||||
@@ -1,31 +0,0 @@
|
||||
description: >
|
||||
Runs Playwright end-to-end tests for a Node.js application
|
||||
- Installs Playwright browsers
|
||||
- Runs e2e test suite producing JUnit output
|
||||
- Stores test results and Playwright traces as artifacts
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
e2e_script:
|
||||
type: string
|
||||
default: "test:e2e"
|
||||
description: "Name of the e2e test script in package.json."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Run Playwright e2e tests"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
E2E_SCRIPT: << parameters.e2e_script >>
|
||||
command: <<include(scripts/node_app_e2e.sh)>>
|
||||
- store_test_results:
|
||||
path: test-results/e2e
|
||||
- store_artifacts:
|
||||
path: test-results/e2e
|
||||
destination: e2e-results
|
||||
- store_artifacts:
|
||||
path: playwright-report
|
||||
destination: playwright-report
|
||||
@@ -1,72 +0,0 @@
|
||||
description: >
|
||||
Installs dependencies for a Node.js application
|
||||
- Restores dependency cache
|
||||
- Runs install via configured package manager (pnpm, npm, yarn)
|
||||
- Saves dependency cache
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
|
||||
steps:
|
||||
# Restore cache using only the lockfile for the configured pkg manager.
|
||||
# All three lockfiles cannot be checksummed simultaneously — CircleCI
|
||||
# fails hard if any referenced file doesn't exist.
|
||||
- when:
|
||||
condition:
|
||||
equal: [ pnpm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-app-v1-pnpm-{{ checksum "pnpm-lock.yaml" }}
|
||||
- node-app-v1-pnpm-
|
||||
- when:
|
||||
condition:
|
||||
equal: [ npm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-app-v1-npm-{{ checksum "package-lock.json" }}
|
||||
- node-app-v1-npm-
|
||||
- when:
|
||||
condition:
|
||||
equal: [ yarn, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- node-app-v1-yarn-{{ checksum "yarn.lock" }}
|
||||
- node-app-v1-yarn-
|
||||
- run:
|
||||
name: "Install dependencies"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
command: <<include(scripts/node_app_install.sh)>>
|
||||
- when:
|
||||
condition:
|
||||
equal: [ pnpm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: node-app-v1-pnpm-{{ checksum "pnpm-lock.yaml" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.cache/pnpm
|
||||
- when:
|
||||
condition:
|
||||
equal: [ npm, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: node-app-v1-npm-{{ checksum "package-lock.json" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.npm
|
||||
- when:
|
||||
condition:
|
||||
equal: [ yarn, << parameters.pkg_manager >> ]
|
||||
steps:
|
||||
- save_cache:
|
||||
key: node-app-v1-yarn-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- ~/.cache/yarn
|
||||
@@ -1,37 +0,0 @@
|
||||
description: >
|
||||
Runs type-check, lint, and unit tests for a Node.js application
|
||||
- Runs type checking, linting, and tests via package.json scripts
|
||||
- Stores test results as artifacts
|
||||
|
||||
parameters:
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
typecheck_script:
|
||||
type: string
|
||||
default: "typecheck"
|
||||
description: "Name of the typecheck script in package.json."
|
||||
lint_script:
|
||||
type: string
|
||||
default: "lint"
|
||||
description: "Name of the lint script in package.json."
|
||||
test_script:
|
||||
type: string
|
||||
default: "test"
|
||||
description: "Name of the test script in package.json."
|
||||
|
||||
steps:
|
||||
- run:
|
||||
name: "Run type-check, lint, and tests"
|
||||
environment:
|
||||
NODE_PKG_MANAGER: << parameters.pkg_manager >>
|
||||
TYPECHECK_SCRIPT: << parameters.typecheck_script >>
|
||||
LINT_SCRIPT: << parameters.lint_script >>
|
||||
TEST_SCRIPT: << parameters.test_script >>
|
||||
command: <<include(scripts/node_app_test.sh)>>
|
||||
- store_test_results:
|
||||
path: test-results
|
||||
- store_artifacts:
|
||||
path: test-results
|
||||
destination: test-results
|
||||
@@ -3,21 +3,10 @@ description: >
|
||||
- Sets up NPM authentication
|
||||
- Publishes the package to NPM
|
||||
|
||||
parameters:
|
||||
trusted_publishing:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Authenticate npm publish using the CircleCI job's OIDC identity."
|
||||
|
||||
steps:
|
||||
- unless:
|
||||
condition: << parameters.trusted_publishing >>
|
||||
steps:
|
||||
- run:
|
||||
name: "Setup NPM authentication"
|
||||
command: <<include(scripts/node_npm_auth.sh)>>
|
||||
- run:
|
||||
name: "Setup NPM authentication"
|
||||
command: <<include(scripts/node_npm_auth.sh)>>
|
||||
- run:
|
||||
name: "Publish to NPM"
|
||||
environment:
|
||||
QQQ_NPM_TRUSTED_PUBLISHING: << parameters.trusted_publishing >>
|
||||
command: <<include(scripts/node_npm_publish.sh)>>
|
||||
@@ -1,12 +0,0 @@
|
||||
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)>>
|
||||
@@ -1,19 +0,0 @@
|
||||
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)>>
|
||||
@@ -1,12 +0,0 @@
|
||||
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)>>
|
||||
@@ -1,33 +0,0 @@
|
||||
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
|
||||
@@ -1,37 +0,0 @@
|
||||
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
|
||||
@@ -1,35 +0,0 @@
|
||||
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)>>
|
||||
@@ -1,42 +0,0 @@
|
||||
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 >>
|
||||
@@ -6,18 +6,6 @@ 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"
|
||||
@@ -41,9 +29,7 @@ steps:
|
||||
|
||||
- git_full_checkout
|
||||
|
||||
- mvn_build:
|
||||
install_browsers: << parameters.install_browsers >>
|
||||
compile_before_verify: << parameters.compile_before_verify >>
|
||||
- mvn_build
|
||||
|
||||
- mvn_manage_version
|
||||
|
||||
@@ -66,17 +52,6 @@ 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,14 +7,6 @@ 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"
|
||||
@@ -28,9 +20,7 @@ steps:
|
||||
- install_java:
|
||||
java_version: << parameters.java_version >>
|
||||
- git_full_checkout
|
||||
- mvn_build:
|
||||
install_browsers: << parameters.install_browsers >>
|
||||
compile_before_verify: << parameters.compile_before_verify >>
|
||||
- mvn_build
|
||||
- mvn_verify
|
||||
- when:
|
||||
condition: << parameters.check_middleware_api_versions >>
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
description: >
|
||||
Build job for Node.js applications on protected branches
|
||||
Runs checkout, install, test, and production build
|
||||
Persists build output to workspace for downstream jobs (e.g., e2e)
|
||||
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
typecheck_script:
|
||||
type: string
|
||||
default: "typecheck"
|
||||
description: "Name of the typecheck script in package.json."
|
||||
lint_script:
|
||||
type: string
|
||||
default: "lint"
|
||||
description: "Name of the lint script in package.json."
|
||||
test_script:
|
||||
type: string
|
||||
default: "test"
|
||||
description: "Name of the test script in package.json."
|
||||
build_script:
|
||||
type: string
|
||||
default: "build"
|
||||
description: "Name of the build script in package.json."
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- node_app_install:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
- node_app_test:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
typecheck_script: << parameters.typecheck_script >>
|
||||
lint_script: << parameters.lint_script >>
|
||||
test_script: << parameters.test_script >>
|
||||
- node_app_build_step:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
build_script: << parameters.build_script >>
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- .next/
|
||||
- node_modules/
|
||||
- package.json
|
||||
@@ -1,29 +0,0 @@
|
||||
description: >
|
||||
End-to-end test job for Node.js applications using Playwright
|
||||
Attaches workspace from a prior build job and runs e2e tests
|
||||
Stores JUnit results and Playwright traces as artifacts
|
||||
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
e2e_script:
|
||||
type: string
|
||||
default: "test:e2e"
|
||||
description: "Name of the e2e test script in package.json."
|
||||
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- node_app_e2e:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
e2e_script: << parameters.e2e_script >>
|
||||
@@ -1,40 +0,0 @@
|
||||
description: >
|
||||
Test-only job for Node.js application feature branches
|
||||
Runs checkout, dependency install, and test suite
|
||||
Supports: pnpm, npm, and yarn package managers
|
||||
|
||||
executor:
|
||||
name: default
|
||||
tag: << parameters.node_version >>
|
||||
|
||||
parameters:
|
||||
node_version:
|
||||
type: string
|
||||
default: "lts"
|
||||
description: "Node.js version tag (e.g., 'lts', '18.0', '20.0')."
|
||||
pkg_manager:
|
||||
type: string
|
||||
default: "pnpm"
|
||||
description: "Package manager to use (e.g., 'pnpm', 'npm', 'yarn')."
|
||||
typecheck_script:
|
||||
type: string
|
||||
default: "typecheck"
|
||||
description: "Name of the typecheck script in package.json."
|
||||
lint_script:
|
||||
type: string
|
||||
default: "lint"
|
||||
description: "Name of the lint script in package.json."
|
||||
test_script:
|
||||
type: string
|
||||
default: "test"
|
||||
description: "Name of the test script in package.json."
|
||||
|
||||
steps:
|
||||
- checkout
|
||||
- node_app_install:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
- node_app_test:
|
||||
pkg_manager: << parameters.pkg_manager >>
|
||||
typecheck_script: << parameters.typecheck_script >>
|
||||
lint_script: << parameters.lint_script >>
|
||||
test_script: << parameters.test_script >>
|
||||
@@ -16,10 +16,6 @@ parameters:
|
||||
type: string
|
||||
default: "snapshot"
|
||||
description: "Branch type: snapshot, release_candidate, release, or hotfix"
|
||||
npm_trusted_publishing:
|
||||
type: boolean
|
||||
default: false
|
||||
description: "Use CircleCI OIDC instead of NPM_TOKEN (Node >=22.14, npm >=11.5.1)."
|
||||
|
||||
steps:
|
||||
- git_full_checkout
|
||||
@@ -30,8 +26,7 @@ steps:
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- node_build_package
|
||||
- node_publish:
|
||||
trusted_publishing: << parameters.npm_trusted_publishing >>
|
||||
- node_publish
|
||||
|
||||
# GitHub releases only for final releases and hotfixes (not RCs)
|
||||
# RCs just publish artifacts - GitHub release happens when merged to main
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
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 >>
|
||||
@@ -1,11 +0,0 @@
|
||||
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 >>
|
||||
@@ -1,40 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/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,73 +208,50 @@ REQUEST_BODY=$(jq -n \
|
||||
generate_release_notes: true
|
||||
}')
|
||||
|
||||
# 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
|
||||
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
|
||||
}
|
||||
# Create the release with retry logic
|
||||
MAX_RETRIES=2
|
||||
RETRY_COUNT=0
|
||||
|
||||
same_published_tag() {
|
||||
jq -e --arg tag "$TAG_NAME" '.tag_name == $tag and .draft == false' \
|
||||
<<< "$HTTP_BODY" >/dev/null 2>&1
|
||||
}
|
||||
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")
|
||||
|
||||
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"
|
||||
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
|
||||
;;
|
||||
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"
|
||||
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
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: GitHub release creation failed (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
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
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
|
||||
echo "WARNING: GitHub release creation failed after $MAX_RETRIES retries"
|
||||
echo "Artifacts are published, continuing..."
|
||||
exit 0
|
||||
@@ -14,7 +14,4 @@
|
||||
set -e
|
||||
|
||||
echo "Running Maven Compile with optimized settings"
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots -T4 --no-transfer-progress compile
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -T4 --no-transfer-progress compile
|
||||
@@ -21,7 +21,4 @@ export PORT=3001
|
||||
npm run start &
|
||||
dockerize -wait tcp://localhost:3001 -timeout 3m
|
||||
export QQQ_SELENIUM_HEADLESS=true
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots --no-transfer-progress -B test
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --no-transfer-progress -B test
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/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')
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/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()
|
||||
@@ -1,483 +0,0 @@
|
||||
#!/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"))
|
||||
MARKETING_TEMPLATE = json.loads((_TEMPLATE_DIR / "marketing.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", "marketing"):
|
||||
raise ManifestError("Unsupported profile")
|
||||
allowed = ("profile", "orb_version", "default_branch", "docs_only", "publish")
|
||||
if 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", "marketing"):
|
||||
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",)
|
||||
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 an explicit stable 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")
|
||||
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")
|
||||
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 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"):
|
||||
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),
|
||||
"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"))
|
||||
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 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):
|
||||
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 kind != "test" and not config["publish"][kind]:
|
||||
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:
|
||||
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/.*)/"}
|
||||
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" 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"
|
||||
if kind == "test" 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, branch, tag
|
||||
# One final continuation; Munitor supplies jobs, never another setup pipeline.
|
||||
return copy.deepcopy(MARKETING_TEMPLATE)
|
||||
|
||||
|
||||
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 branch, tag # This profile's reviewed static filters own its three workflows.
|
||||
return json.loads(json.dumps(VOYAGE_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
|
||||
|
||||
PROFILE_TEMPLATES = {"qbit": qbit_template, "core": core_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 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", ""))
|
||||
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)
|
||||
@@ -1,53 +0,0 @@
|
||||
"""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))
|
||||
@@ -1,70 +0,0 @@
|
||||
#!/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},
|
||||
}
|
||||
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) }}",
|
||||
}
|
||||
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")
|
||||
@@ -11,23 +11,9 @@ NODE_VERSION="${PARAM_NODE_VERSION:-20}"
|
||||
|
||||
echo "Installing Java ${JAVA_VERSION} and Maven..."
|
||||
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# Add Eclipse Temurin repository
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get update -qq
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y -qq wget apt-transport-https gpg maven curl
|
||||
sudo apt-get update -qq
|
||||
sudo 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
|
||||
@@ -36,8 +22,8 @@ wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo g
|
||||
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 env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get update -qq
|
||||
sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y -qq "temurin-${JAVA_VERSION}-jdk"
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq "temurin-${JAVA_VERSION}-jdk"
|
||||
|
||||
# Set JAVA_HOME
|
||||
JAVA_HOME="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64"
|
||||
@@ -49,7 +35,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 env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=l apt-get install -y -qq nodejs
|
||||
sudo apt-get install -y -qq nodejs
|
||||
echo ""
|
||||
echo "Node.js version:"
|
||||
node --version
|
||||
@@ -57,46 +43,6 @@ 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,13 +20,6 @@
|
||||
|
||||
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 ##
|
||||
@@ -55,15 +48,8 @@ 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"
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/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
|
||||
@@ -23,7 +23,4 @@ set -e
|
||||
###################################################
|
||||
## Compile Maven project with optimized settings ##
|
||||
###################################################
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots -T4 --no-transfer-progress compile
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -T4 --no-transfer-progress compile
|
||||
@@ -25,12 +25,5 @@ set -e
|
||||
##############################################
|
||||
## Deploy signed artifacts to Maven Central ##
|
||||
##############################################
|
||||
# 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 \
|
||||
-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
|
||||
cat /tmp/circleci/mvn-settings.xml
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -P release -B -DskipTests -Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" deploy
|
||||
@@ -23,7 +23,4 @@ set -e
|
||||
########################################################
|
||||
## Run Maven verify lifecycle with optimized settings ##
|
||||
########################################################
|
||||
## --update-snapshots: the ~/.m2 cache is keyed only on the pom checksum, so
|
||||
## without it a SNAPSHOT dependency restored from cache is never re-checked
|
||||
## (Maven's daily update policy) and builds run against stale snapshots.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml --update-snapshots -T4 --no-transfer-progress verify
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -T4 --no-transfer-progress verify
|
||||
@@ -1,10 +1,26 @@
|
||||
#!/bin/bash
|
||||
# Collect unit and integration JUnit reports without losing same-named module suites.
|
||||
set -euo pipefail
|
||||
|
||||
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)
|
||||
############################################################################
|
||||
## 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/ \;
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## node_app_build.sh
|
||||
## Node Application Production Build
|
||||
##
|
||||
## Runs the production build for a Node.js application with timing output.
|
||||
##
|
||||
## Environment Variables:
|
||||
## NODE_PKG_MANAGER - Package manager to use (default: pnpm)
|
||||
## BUILD_SCRIPT - Script name for the build step (default: build)
|
||||
##
|
||||
## Usage: Called by CircleCI orb command node_app_build_step
|
||||
## Output: Production build artifacts
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Source shared helpers (no-op in packed orb — file won't exist at runtime)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${SCRIPT_DIR}/qqq_helpers.sh" 2>/dev/null || true
|
||||
|
||||
# Fallback stubs when helpers couldn't be sourced (packed orb environment)
|
||||
if ! type banner &>/dev/null; then
|
||||
banner() { echo ""; echo "========================================"; echo " ${1:-}"; echo "========================================"; echo ""; }
|
||||
require_tool() { command -v "$1" &>/dev/null || { echo "ERROR: Required tool '$1' is not installed."; exit 1; }; }
|
||||
fi
|
||||
|
||||
NODE_PKG_MANAGER="${NODE_PKG_MANAGER:-pnpm}"
|
||||
BUILD_SCRIPT="${BUILD_SCRIPT:-build}"
|
||||
|
||||
banner "Production Build"
|
||||
|
||||
require_tool "${NODE_PKG_MANAGER}"
|
||||
|
||||
START_TIME=$(date +%s)
|
||||
|
||||
"${NODE_PKG_MANAGER}" run "${BUILD_SCRIPT}"
|
||||
|
||||
END_TIME=$(date +%s)
|
||||
ELAPSED=$((END_TIME - START_TIME))
|
||||
echo "Build completed in ${ELAPSED}s"
|
||||
@@ -1,56 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## node_app_e2e.sh
|
||||
## Node Application End-to-End Test Runner
|
||||
##
|
||||
## Installs Playwright browsers and runs e2e tests producing JUnit output.
|
||||
##
|
||||
## Environment Variables:
|
||||
## NODE_PKG_MANAGER - Package manager to use (default: pnpm)
|
||||
## E2E_SCRIPT - Script name for e2e tests (default: test:e2e)
|
||||
##
|
||||
## Usage: Called by CircleCI orb command node_app_e2e
|
||||
## Output: JUnit test results in test-results/e2e/ and Playwright traces
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Source shared helpers (no-op in packed orb — file won't exist at runtime)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${SCRIPT_DIR}/qqq_helpers.sh" 2>/dev/null || true
|
||||
|
||||
# Fallback stubs when helpers couldn't be sourced (packed orb environment)
|
||||
if ! type banner &>/dev/null; then
|
||||
banner() { echo ""; echo "========================================"; echo " ${1:-}"; echo "========================================"; echo ""; }
|
||||
require_tool() { command -v "$1" &>/dev/null || { echo "ERROR: Required tool '$1' is not installed."; exit 1; }; }
|
||||
fi
|
||||
|
||||
NODE_PKG_MANAGER="${NODE_PKG_MANAGER:-pnpm}"
|
||||
E2E_SCRIPT="${E2E_SCRIPT:-test:e2e}"
|
||||
|
||||
banner "End-to-End Tests (Playwright)"
|
||||
|
||||
require_tool "${NODE_PKG_MANAGER}"
|
||||
|
||||
###########################
|
||||
## Install Browsers ##
|
||||
###########################
|
||||
echo "Installing Playwright browsers..."
|
||||
npx playwright install --with-deps chromium
|
||||
|
||||
###########################
|
||||
## Run E2E Tests ##
|
||||
###########################
|
||||
mkdir -p test-results/e2e
|
||||
|
||||
echo "Running e2e tests..."
|
||||
"${NODE_PKG_MANAGER}" run "${E2E_SCRIPT}" || E2E_EXIT=$?
|
||||
|
||||
if [[ "${E2E_EXIT:-0}" -ne 0 ]]; then
|
||||
echo "E2E tests failed with exit code ${E2E_EXIT}"
|
||||
exit "${E2E_EXIT}"
|
||||
fi
|
||||
|
||||
echo "E2E tests completed successfully"
|
||||
@@ -1,96 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## node_app_install.sh
|
||||
## Node Application Dependency Installation
|
||||
##
|
||||
## Installs dependencies for a Node.js application project using the
|
||||
## configured package manager (pnpm, npm, or yarn). Enables corepack
|
||||
## when using pnpm or yarn.
|
||||
##
|
||||
## Environment Variables:
|
||||
## NODE_PKG_MANAGER - Package manager to use (default: pnpm)
|
||||
##
|
||||
## Usage: Called by CircleCI orb command node_app_install
|
||||
## Output: Installed node_modules and validated lockfile
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Source shared helpers (no-op in packed orb — file won't exist at runtime)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${SCRIPT_DIR}/qqq_helpers.sh" 2>/dev/null || true
|
||||
|
||||
# Fallback stubs when helpers couldn't be sourced (packed orb environment)
|
||||
if ! type banner &>/dev/null; then
|
||||
banner() { echo ""; echo "========================================"; echo " ${1:-}"; echo "========================================"; echo ""; }
|
||||
require_tool() { command -v "$1" &>/dev/null || { echo "ERROR: Required tool '$1' is not installed."; exit 1; }; }
|
||||
fi
|
||||
|
||||
NODE_PKG_MANAGER="${NODE_PKG_MANAGER:-pnpm}"
|
||||
|
||||
banner "Install Dependencies (${NODE_PKG_MANAGER})"
|
||||
|
||||
###########################
|
||||
## Enable Corepack ##
|
||||
###########################
|
||||
if [[ "${NODE_PKG_MANAGER}" == "pnpm" || "${NODE_PKG_MANAGER}" == "yarn" ]]; then
|
||||
if command -v "${NODE_PKG_MANAGER}" &>/dev/null; then
|
||||
echo "${NODE_PKG_MANAGER} already available: $(${NODE_PKG_MANAGER} --version)"
|
||||
else
|
||||
echo "Installing ${NODE_PKG_MANAGER} via corepack..."
|
||||
# corepack enable requires write access to /usr/local/bin; use sudo if available
|
||||
if sudo -n corepack enable 2>/dev/null; then
|
||||
echo "corepack enable succeeded (sudo)"
|
||||
else
|
||||
corepack enable --install-directory "${HOME}/.local/bin"
|
||||
export PATH="${HOME}/.local/bin:${PATH}"
|
||||
fi
|
||||
corepack prepare "${NODE_PKG_MANAGER}@latest" --activate
|
||||
fi
|
||||
fi
|
||||
|
||||
require_tool "${NODE_PKG_MANAGER}"
|
||||
|
||||
###########################
|
||||
## Lockfile Validation ##
|
||||
###########################
|
||||
case "${NODE_PKG_MANAGER}" in
|
||||
pnpm)
|
||||
if [[ ! -f pnpm-lock.yaml ]]; then
|
||||
echo "WARNING: pnpm-lock.yaml not found"
|
||||
fi
|
||||
;;
|
||||
npm)
|
||||
if [[ ! -f package-lock.json ]]; then
|
||||
echo "WARNING: package-lock.json not found"
|
||||
fi
|
||||
;;
|
||||
yarn)
|
||||
if [[ ! -f yarn.lock ]]; then
|
||||
echo "WARNING: yarn.lock not found"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unsupported package manager '${NODE_PKG_MANAGER}'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
###########################
|
||||
## Install ##
|
||||
###########################
|
||||
case "${NODE_PKG_MANAGER}" in
|
||||
pnpm)
|
||||
pnpm install --frozen-lockfile
|
||||
;;
|
||||
npm)
|
||||
npm ci
|
||||
;;
|
||||
yarn)
|
||||
yarn install --immutable
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Dependencies installed successfully with ${NODE_PKG_MANAGER}"
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## node_app_test.sh
|
||||
## Node Application Test Runner
|
||||
##
|
||||
## Runs type-checking, linting, and unit tests for a Node.js application.
|
||||
## Each step can be overridden via environment variables to support
|
||||
## projects with non-standard script names.
|
||||
##
|
||||
## Environment Variables:
|
||||
## NODE_PKG_MANAGER - Package manager to use (default: pnpm)
|
||||
## TYPECHECK_SCRIPT - Script name for type checking (default: typecheck)
|
||||
## LINT_SCRIPT - Script name for linting (default: lint)
|
||||
## TEST_SCRIPT - Script name for unit tests (default: test)
|
||||
##
|
||||
## Usage: Called by CircleCI orb command node_app_test
|
||||
## Output: Test results and lint/typecheck status
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
# Source shared helpers (no-op in packed orb — file won't exist at runtime)
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
|
||||
# shellcheck disable=SC1091
|
||||
source "${SCRIPT_DIR}/qqq_helpers.sh" 2>/dev/null || true
|
||||
|
||||
# Fallback stubs when helpers couldn't be sourced (packed orb environment)
|
||||
if ! type banner &>/dev/null; then
|
||||
banner() { echo ""; echo "========================================"; echo " ${1:-}"; echo "========================================"; echo ""; }
|
||||
require_tool() { command -v "$1" &>/dev/null || { echo "ERROR: Required tool '$1' is not installed."; exit 1; }; }
|
||||
fi
|
||||
|
||||
NODE_PKG_MANAGER="${NODE_PKG_MANAGER:-pnpm}"
|
||||
TYPECHECK_SCRIPT="${TYPECHECK_SCRIPT:-typecheck}"
|
||||
LINT_SCRIPT="${LINT_SCRIPT:-lint}"
|
||||
TEST_SCRIPT="${TEST_SCRIPT:-test}"
|
||||
|
||||
############################################################################
|
||||
## has_script - check if a script exists in package.json
|
||||
############################################################################
|
||||
has_script() {
|
||||
local name="$1"
|
||||
node -e "
|
||||
const pkg = require('./package.json');
|
||||
process.exit(pkg.scripts && pkg.scripts['${name}'] ? 0 : 1);
|
||||
"
|
||||
}
|
||||
|
||||
############################################################################
|
||||
## run_step - run a package.json script if it exists
|
||||
############################################################################
|
||||
run_step() {
|
||||
local label="$1"
|
||||
local script="$2"
|
||||
|
||||
banner "${label}"
|
||||
|
||||
if has_script "${script}"; then
|
||||
"${NODE_PKG_MANAGER}" run "${script}"
|
||||
else
|
||||
echo "SKIP: No '${script}' script found in package.json"
|
||||
fi
|
||||
}
|
||||
|
||||
###########################
|
||||
## Run Steps ##
|
||||
###########################
|
||||
run_step "Type Check" "${TYPECHECK_SCRIPT}"
|
||||
run_step "Lint" "${LINT_SCRIPT}"
|
||||
run_step "Unit Tests" "${TEST_SCRIPT}"
|
||||
|
||||
echo "All test steps completed successfully"
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## node_npm_publish.sh
|
||||
@@ -16,45 +16,7 @@
|
||||
## Usage: Called by CircleCI orb command node_publish
|
||||
############################################################################
|
||||
|
||||
set +x
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "${QQQ_NPM_TRUSTED_PUBLISHING:-false}" == "true" || "${QQQ_NPM_TRUSTED_PUBLISHING:-false}" == "1" ]]; then
|
||||
NPM_CLI_VERSION=$(npm --version)
|
||||
node - "$NPM_CLI_VERSION" <<'NODE'
|
||||
const atLeast = (actual, minimum) => {
|
||||
const parts = actual.split('.').map(Number);
|
||||
return minimum.every((part, index) => parts[index] === part)
|
||||
|| minimum.some((part, index) => parts[index] > part
|
||||
&& minimum.slice(0, index).every((value, previous) => parts[previous] === value));
|
||||
};
|
||||
if (!atLeast(process.versions.node, [22, 14, 0]) || !atLeast(process.argv[2], [11, 5, 1])) {
|
||||
console.error('Trusted publishing requires Node >=22.14.0 and npm >=11.5.1.');
|
||||
process.exit(1);
|
||||
}
|
||||
if (Object.keys(process.env).some(name => /^npm_config_.*(auth|password|username|userconfig|globalconfig)/i.test(name))) {
|
||||
console.error('Remove npm credential/config-path environment settings before using trusted publishing.');
|
||||
process.exit(1);
|
||||
}
|
||||
NODE
|
||||
|
||||
# Do not inherit a project/user token or write the short-lived identity to disk.
|
||||
if [[ -f .npmrc ]]; then
|
||||
echo "Trusted publishing requires a publish directory without .npmrc." >&2
|
||||
exit 1
|
||||
fi
|
||||
unset NPM_TOKEN NODE_AUTH_TOKEN NPM_AUTH_TOKEN
|
||||
PUBLISH_CONFIG_DIR=$(mktemp -d)
|
||||
trap 'rm -rf "$PUBLISH_CONFIG_DIR"' EXIT
|
||||
export NPM_CONFIG_USERCONFIG="$PUBLISH_CONFIG_DIR/user.npmrc"
|
||||
export NPM_CONFIG_GLOBALCONFIG="$PUBLISH_CONFIG_DIR/global.npmrc"
|
||||
NPM_ID_TOKEN=$(circleci run oidc get --claims '{"aud":"npm:registry.npmjs.org"}')
|
||||
if [[ -z "$NPM_ID_TOKEN" ]]; then
|
||||
echo "CircleCI did not provide an npm OIDC token." >&2
|
||||
exit 1
|
||||
fi
|
||||
export NPM_ID_TOKEN
|
||||
fi
|
||||
set -e
|
||||
|
||||
# Extract version from package.json
|
||||
VERSION=$(grep '"version"' package.json | sed 's/.*"version": "//;s/".*//')
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,483 +0,0 @@
|
||||
#!/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/0VuOrM2M6IpPclifvcxHbfeCar48z0nChXByJBiW1uJig7Oonn26cKACmKIiVSluUlTr/IJFAo1F6FAvv7L4Q0LljEncBvPCPr+loTn4Q0oh6L4Tk8/A5P4JkX+N2g3XF8q205tOsHPHbM4XsYEQ9CBn83OkHgMuo3mskLi9m078bwzqYuZ+LxlXzb8Nm3uE1Nk4Ux9U3W7vR9y2XtfuQWgeZx5PjdIsiNRhWwvEfXt7bnCjliJnPC+Fqgf1HgG0HUyZD8/Pxcgyc48Awg8CgIzgz18H9X9W19r5HONAPPo76Vmc1jGsWaYJuGbNPiiJosiyCPWYgTvqgHCKbHzLOgH6fYknS4eB/1/QwE9dAHYUEkP0QMJIeR4NJnFnmLKxMemGcsJlmRaY7OVpgjAMcmvG8FhIax1oVZ/dCiMSPa+Tn5619HXzk+7M91iTYQr7nYHIxq+QBTgSTaBfE580GQCecpiHQqDPDIztYWMWIvFITNUCuDcQJWzFYraYyIH/s4mGjBNBhGGDHbdbq9WHeDLszts+ck7jEfIYcgILFNlti3MIhi8vHjx/bb9+/+73379OTlwVH75PO7/b+ct1r+Emk1nhwcnxy8OWr/6/3JP35/8/5f7b+/f9U+Pmw1yG+/4etXLz+9bh+9+2er0fIZaBvCZ2YvIEuSIYg1CBNJ8SF9n15Qx6UdF1AyAz92/D4wMXK6jk9d8pZeMJ8IweD6Usu3nZbfyLDwKv19NYvQvO9wFl3Aer47AII4nPwZdJY4AXyY66ZyZDvf4n7ExqSnQ82zbhT0hQAhVculK2Y8JpqPRPpeQOJn2hUQ8ccPwr45MVlt+YLdmgaEEhhqzL/Yl8Q/OG4Wc6FZAJeEg7gX+BtEN53IdJnpGEJyMoKih4NSmqpfX0eMEI+DsKZqV+fI747v8F5NLb4EUcbJ1L2kg0k6PhMX4qBv9qaqGFJFTBXifhD0XYv4QUy40xWCLLZiBiBVZhxEQpaDiNA4Zl6IFoU8WebsnKyR9dWV58QKUHUEuv9DNHvq6iAmYNX1P3ngIxKdiNEzhMBdxkKy1vKtwGdqP2bPC8BqnBD6t+iPqeanYEsePWMEjdhwHAFz79jUjDmBpS1UZ9wi2FRJ8lo7GNomk8Z1JhYbnQyWyl8Sz+Ec7NDzRLZQ3CLec0IY4VGw0WCXwigA2zOb0QFhiFg7pcm4uIc07qFATtlcXpQtICbYxVhGTI2SSTV0GSyu7XTBtmkh2DLaZZpyUPPS53+g/CnYifMT+KPlB+H3LWZNUNhfyWkPLCDp9B0QPo+aPcdnnKCjtxxu0gimE2qjkwWZQeutt/xfyWeY8hnCrri/hINhFhh5z4miIGqSy54D+gzBIKgCjSIH4OFcVFQAxpnZj5x4AA7XiZmudIbDG80hS/xHL47DZ4aRDNP7YhkdcDbkTzGCwxC1bsGI7hIxWGwaEE8YPOhHJuO66/BYLZaJEcQwnzELpBxDKgMZplstP/Haf+HCNS898SN89V2NuyL7YOTcVuP5EvkhY4eYsTJwxt6ehkJoOjo+IL8ZFrsw/L7r1vYMIEmceqHLNKmXfF6CdCBNJ/n7Zx9ss7AqEPFBxDK7N/DOLCciWkhw7wpr0Po/YRkDqAORnvFnH1ZLtiJNtlwVLXb5NA4aZTsREkGgaJwefTrVnurfPHfCLBsCIU7tolmJRwCD+gWtKTgwOQj81dehvQSLGY68q7gzAyejmZNuYhZjhxxpj/M8Z+8q4nMbCAiFYJFGw9B1TGGjNIHUDZn+ckw6UXDJEZM00Vs4CmBcQ5cOtEvHgj/5wteX62qYEESBu/j1bUYx4gcELliEbjETZSwcGcz6M8KggaR22SRUCo1ziJUWHidrsAvHYv5o4F5QepF76IGjzWGerzCMrZ4SZC5mX2JNEqwJWmL02gmDSBeS9et7AhGP5ShkvHhBhpTRBTEg35XeAOaJgH6ADiFv9kneopNSI0PGlZ7klJDklGLUJ1hg98tF6EmKZ4HDgFSg8twaBLqWU1HS2o6D9mUQnfFwNMdMRCcI4jSMzgt2c1zPRqVQvSjGvjEy7GsVRUvrYRCGZmphjHfawN0zFrUxugoij+b0TsW1o0rneCDWuDkZNGrr66ubzyDojJifuqShjoF9EoFk23Qpx8UbLnKv0ZxUbysN/oekS+qAhnrV/pNe0Oz7gqJdOse78Nsicp+povdPFjn2gBxiihYRBwL5pFIktF+SlGRJWq7glgICY+dYPjrp++Ql6LOHyPkWOaGdjhO//VgPN6AS0V4RjUvlSgs18FzjLI6x+ioiRy2U0SMIFNGoR7RD+KVnFtH5mRPuizo3MbEMTi4EDee5ZXbeB3OQ7FDlEdmdEsjt3jh+/9uELSdVKY20Wi9eLH34N2bZUeARVFLX6RDHE0H2B/hTvQEC6CyOIIlR745c5oEqnMKjFtiyxMLui0nL0qABfcqC61ZjRVpwtRMw3zBJcbPVaIJJTNgJQ59JY4nowQrJWgaxWw0RpMPe9LRMrsPSep413+U6VwfDZ8enyFaslRJR4IV8E4Bn9qWDXeJsGVdd0WETaO6WV+Rwj8agerjfLyblUiXED+GHMHW1Hd8CjYVdYWiM72Aj6C3wJ4KDN8hWfLqP6SJY+cD3wdTzl5hRvxIIn0gOtxpf5bpgXRhQ32X+skJBzF5rIi2STT7Ly4fI11TVJdmwgqSgfFn9KjAGpFCKQ2YJbDl5B96jAvBLCt41mdjyP/z7ptOYCbJVK2cWXqvdAdZidT9sSzuedQ/sGzP7gF2yMprWETO8SONeI3TDySTdGIHBPnANDaXLIJJBBnaB1Hj+xysYi6IIBbk1JN0wdhJF7WkTVZDfTmLISZXw2Y6kADCR/MzQQZgzsM1Y+B0kJxwQAbDZaFCyfaLJPCFZX9MwjsIwN605pjM1JXPzdxMqXhknQlmUNs/izXB/adpQudKTFFpKiWVkqC3K7pmo2gxrzKuCf27OjayRRvOy4I3+BA8LwZ2Ur/MUzxMLalPwdJhnqJqUfFYLk+eZ9OEul95mrbpl9zdBw2UQp+VrEoVKHknFSwarvFlPiXuzeVjpxisnY6UyXykfu9sVyusVBcfU4z4UxSaFPJny5iKCnRFqFAY+YyRJ3vqBxdQJ/zSa32A+/EqcgdlYqUBVJBYL8fjMN/EEK6mHSdrOJds8jEDSMDjbX9Xhv0QoMgUq7RAj7lPQK67yzYTs84skZBQJBBXbCx1fNAZQyE8c6hKL8l4nwOpk+Y67DuSnLhhZkpzMwZNevyNO5D5CDq8dvxfuDQIzH08kNU+B11LwOgLJVpnGh7R8HKMdTBlGEgEBY22xGOI+srazu8k22a61vmdumXvM3jU3V5m5aa9vm3TLtOyt3c7a3s567eCUSaWXweUYhc/YoNAEpzj7oaddrGlV0dO+f1edOn0P3OFkMhiJorqBeSaDmga5urqOla+gPBNFiNAuHv3HshEo1bMJkmVaU2XiVwIJPxAE3KjojJDAlZoAGh/evyWXII6JgAvzsMSTLjLNdUBuwQ6DH45Bz/VhoKCZZGLVJIQXaTEE/pC1hpUWiPi3GN7gI8SojX9jVSEAAmEZ4AWWL1Rf5m+bqPovjOwjTK9V7o5TQY36frwMs5NCQKvxQdJ4SNqPHz8SNR9khPpdmaUjDpeREzOJhAAHUZQLQQYCbOaxKTFEefxWYDdAG5BfYjqgZy7rUnOghYxFoHMhl41VNvwV2LagsKYJJSH/MXSY1fIPjvfR2hMEITtYNMygsFTx0nVViQ2irb5/7L8CPiGj3+JbwUSJGRAAGGf1TdHuIBj7HDuLsIWjqyI2kJmQXNLIR7Ormk/Sv3WBh1wLEYHVJJiWn2Y/PDINnGQkBWBuFImhrPKLyYZebZKBezqV0grvsIlJUCJ1OwMyIsmihw42KgR8pF8D9lHD62RYOcHxVPBN3bArC6KCk0vaIaK//xTd1dKou6pdKoKcfYJVFW72No1o1WBbSvuN2Vwsj6tzO4vGtElen55+EPUfddhFMiFghWLxK2yZxSBcyqHDRSCKQjUes6JuLImI/ynkSUupLH98BU4ay/WJAgqxVQ2ezYw4g9AHIy2hgQkaIJheT55rRVGQX2b2glTTzjtObCj7nRfb+aJRTfNwVBIp6QWR0lQIdlGOm2xQ+5A56Eb+8WZKhSyU7PHGXIt2KLRvqNexEgmpJqRAbaKxfgDhRciwmjBn5qijH8+xLJeBgwCdF0g28Wk/dlwnHqhHPEecCpWyfNFEOIzC9SaXWUaPQeRaNAz1T+KXJOuhw0PhR9PdoehPqc+MLZdimNv7dfD7dM4/S2jXxW2qPBa3ys2pfFGZaTd7QFKRMzPVoyZ0seR6VlS1AVgfsRmKFB7s08H8f9Hlils8eL8jhYaU9AupM4hgBXCChcWa6qKUPNgXqMjny69frlRzCfMkQE2fSVotLFmrkFdZN7G5dwDuUG3tVCQ2h4lC6ui2ju13wacQ0LQdZgmKJ8nOoRPrGXBvETmEdnwK79KadI+68Xv/d4AEUAtaEebrq5NmhCDuoZS6wQCPzokHaHEC8VsPAnVMmxbbiiAN3WgnQqHrSHsQpClsEs/xHQ8Cf2xGwIPwWZxYIZtl8t8k2ytNefhe9A9WLD4HmbxiRhKSZdbWVpKWifK2BkUmQ+1+rMMhAqHZxzh8WfYzyI4FId+Y4gPH8u+GjQMrIy0GCOm3/YS6splALnoFsgVvr4hUG/jZhBQd5B+z9+9qwlWuYyG/rC2lXWK1v09Whc3Ij2J4+2A4pqm2XbFVoThgmOS5TFV3enRco44roQt/QEXyxBCqnLbLfLDGKMKq31QIZKbnNOPARPWRuHhB5u3g08c3ear4QRt4Ffbjdux4DNkG622sevVyoVQYUcH3nyx7Z3jvTdxwSQ6X09bYoS/7Q/zDkiLine 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+tz2zYS/56/AqPJXJKeSUqqHzndqBNbdm1NGzsnObneVDkNREISLBKgAVCWYuv+9lvwpQepV2K1TpoPsUhggV38drEPgLl/hlBhSISknBUqqGyW9nTLDe9IeL2HZ3jrBNR1DMwcQxGp0nbo8bDdp4zMNEEj9XBPNxWCTsBUYJTLxf2KHQhBmCrEZJO9ZApBJA+ETdq2i6VmWnCxgPEpAWFDKjjz9Og5Pm+PP5xdtq/eXTf1KOM3bwSMXntZFlIRX8/8+3Ss3Sf2gAcqZYNmZob+29tbg4uORZlU2HXbN3iI57iHVLq1PUWvUC4VZggm6fNkyiWd2Ruytg3wkTYgoLggy0QRActyZtgLIf5ABO2OEfZ9l9pYgRx7iDJFeiJ8QVphcg/dBtilCuiYg2wOEuPeLL8IEu550K9nBdmQ7RLM0DCa3zhBxvU+MozAd7AihmTYl32uJDQxbiiBmewSYfiC92A58nNgkHi4FIMQoLZejEYrcJXMQuJj1dfCK20+ypKBIF0qiCGIz4VaL9KXMuxi6krc/SKGWCjaxfYG3IZ8DDo0b7BY1KMDQlMWql/Tg2mEVDuVRlJF1sgRm2DoRlIT3EooX280UIji7TsuBtLHNslKJjjXfqJgLsqjRZ73AnFHvIbQ/xC5MGzar43BWEeUsbplhEv1h1aBOu28wTa3uUlGxM7SnHJ7QESXujnjfe6ZI8/NdkiRM5Npc9alvRxqznC432+IrUz4Be0oSuasHqGP+Qp+Ntsbq7sgiS2Ikoa08azDKzjhYuYUN2cWabixqdezOliSxWAzw3FF2JEeOPrClwSNlZ66HkUSdE4VeNaBXOF+70DByLhFfaV8WbGsHlX9oAOq8PRjOHr6IAj8gklaDr9jLseONXxtlktmOSVpR+9tl7Jg1B4d7ptgQ2bvU4vBLzJGn7poPand97iD/j5KSVtsu927EpxGwDYBxkzXhByiwPAg/ERqRCY8RraKzITIVNxzoR2cTYfLZd4m3xgxbPbPtkSw40AwBRtU+JYkHsREv+LiMHvayiY94tDA251RNiPZUPO4eY2aernLwY/XgTQqqNVqMTSFHAeKL7b5lk6Psq38DkvfUBz+EZbtBjcQiDBQBA5VaT8Rgov07QbcD/zAsv1AoVgyI47UZtgbkZro4QEpEZAW26X8Jir/9LcSAlaEzIijQ4CpRmoqxI7CcB4Ca+Jx7pBdS5cAsrFs6YDtAklkQYv7dyfVyvotOgcaVgqkWJXA4Dh92c67RjVElEpn5xyQcW7qE2UhkL/T4dgYFo8Oi8ZGAfyzfI2d1BOUOLMVC/hynzCHMJtmMqsC4+1ol7cV9Yj2czBV6cBb6aggLpCAI5/6RGflEOgAHmRIlEm+WswbOBSioI9ahecXV2/PLDPE0AoxaRWSIalRxYldi0XRAMGawTsIL3EUQz3Ru3+fWhleFUsb5GyD4MBgybhFhhUr4Tw/JCMzEEIKnDSl1BgScJgzpimaR4dm8Y3s4/LBYaW8Xzp0St2j/eL+QefgqHy073RL+Mf9IiHksHNQKsJcztGP9uEhPrTtzmsHF/9R7pRKR6Rz5JTLZaQ5dmXqK/U6GWTraBi4Gh1JtN6h/ryon1/s1Rr163rt+Fft1UcUcmruEFRKB7uQ4xuQKRn+oKfryy4XHlZo3uUnYFizthM5/hDlrT0tFJ8rNo82q5y9cn+PQAy7jyaTjauN/80p60t229ZF2oJFrXHCKbLgSOORW3nhsEB4Ii54bZa0I7f8tRwjNbWyai4PHHTMsDuGOnvN8ZBxgkINV8K/yeY9Dd/MuCz8hYyrt8DXoLwd7Z4FOi56mNFPockllAskfS6VGQi3mhRDYbOtRTUzxIoPCKs+v29eXR432tdXv5xdThZIkqMHMy6goRRuhNvhnd6w1ZnSOy6xrSnhwlTS9kyHStxxiVNdmd7lbpAofhjh4epfeIustMsTDQ6KjjNQ3Vt9ahkH5BBQZCgUmVzl+X2t3qj9etZuXhyXKsXK0QSZafRWuLeCLu6JKrdHLXivtfNHNQ4lOOharKu9rhv1D/9pfzhrNOtXl9VWoWgeQKXeKqzIQqwhFhY0WxGFKeGnkteYmx88v59jOUGhAU4DfBLQk1i+pyP7tFjLCeu0x8A7GQFUUSPI/6LmpdA/KtjvAtlHUOCdU3URdNA7bA+A6yoPR+w+18nV/flFLXEkkEk9oBhul/coQ72+LbQTMoIp7fvmWePy+O2ZJjcMH7YfbBjHkMqhbEOri6e1YodorQApO19kq8vmSCw5HudrYLZnt2pYwoF20e8hKvEsJ43jy9qFRqUKzQ7Yj8t9ePuoa+MVlB7sD032T6T6hGmbeRQMEybT+TbCYmZYbCLatsCcNx0IO7ZLW2y7wVMNFLYLMbLDvc8/SuWQ/904g0q5ZBb/gKPUR05pzgn4VTBG1Dy5eote1saQMzBy+turNYkN5CSmHRE7o0r6ZHhQITDDdwPY+RUPD8hxrydIDzic8NTtnkblyc9hyVKdOYdKei5BuqpWS9J+srMzoSSVAWYbnQeldFsYWHwdaDthTfEkT+3nwSMq8MGsPK5IOxVxAcCZTNwhXRy46hFj0fsQMVQ7RRoxdEdVHzFyF8dXh/b0GfEfH5harP72+PysfVo/P2teV5+/jOcDvrSrAwpUML4+cN/YV03P3VH5JyjThxYLXBckvblFhkAvzFMibUF9MGczWjayLEQ8X41fJOelr7RgYSQxPoUrmRVykhsWfM1ki5CGUP7Ck/Um5w/VF/f3FMrhETJ1vXAaSixRcTJ5sQUmD8gOYE7nDTK65VdRLEijQX3GBCoos9gtsIgnPGs0rhoVyDIDSIgZV+GlifAg4ZwzNz01jIGcDZUSkXrwEno+AKAjMLP7SEfi9EoKjKp+ffH+JDbBNzNXVP9qAAr1K+tDdF5SOzXeUZ+4wFVfzLSY7aBsl+YpIRQaFOSWDwkI8fmU+cPDElgeYOG6onPxWFpQdjqBrR2aNQjAT3pxaWmOsefG8OmFObTbhXXdBpSoDUdnsL3kyO5jBkLpzFLvUJjYiBFF2BUEO2MU+LpX7/gZkItzIEfXCoGEbFz7CJi6RqG+JbW6HrJIQkALUIeC13yjrQ2sLqHCjrMxEtGskcienq0PMeXldNCrCoo8e5xhxeYCS8nPSfR8Yf7EBdX+J0zapobdDGybSNmFrTmOJ3ZWe8BtE534EhTCs/75/DjEoGaplItmqfSk7o719ejCEpeHCOaPFohRtDuNuDUtyZLjkrmtnPZq7Rj65CXZ0PNHOMlshhr7pBpmR2mXH1VYhpa/Gg1rsRy50lfxJ8m0kY09i+2soI8+ui6/m/k0Tocb4HobLHwYF39At8Toln5QF/d3qQuOOpvb6aGhMyZ5fdqawyI759g5PlmiLPMlR5wLhvVYfqf133m1GYb5g7WGtNWyNFGG5uNCy+TZsrcNMuH8D0a+Y7jVvUf2O4fvAG5nhLmXzWmogCxDkNyboAUvMH8TtPddGSuUkX+gHov857thztxxVD5GEj19p7dLiXfgYnYL8JPe0Ltcet6VbZpgMkVGKm/Z0xu51Uv+pqGbP2ldD1qUkv91AVty+7kBcH1bPBps2c+aZ91rtjd1ZXkDZ9zG01XHqvL56UTOLZOVb6Hs+BpWvrtI/sQV/jVkBE8awr9GZvGkVfAtZyhPGfjvmc43qdalV98b76y9x1X4nJ3tNgENVfCIWC69vtm9l/oaUFtyHcHF7H/Sj7+e0YwGlPWk4HxgxY1v2u2rxknyMV+7raWYPJs8+z8FFeia")))
|
||||
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/4g5FBmFNr1cpJroo4e9eTSzATfR4eHjy/+HJ+enz0OOc2kUAZdacHrF6HrZa4Yo9PAYoeQhMATMQxgzsSIQM1DB+t1WYLT8fiiop2CFxlRu8OQW8dCdoBdBWlS8vc0YUnfOqePEtkHF8SkjzKd9tGM4Bh6HNhK5qCkkmIfhakmaJSD/zJyrJRQvdArg4Abx8JVtlYIiwT8EIferjUD3FLKE5JwotDRmq2B60yTgtpr7N1tbEmJ6dnK7CArTm+KG5X2ht7MGKmHgwGMwiCFvMynAQR+AC3uKbLi+o00+5RuOLoLPZszQtG/nGWhZzPxFYGcVsgdFjog/JYqwT+CN1oJGnqXa0LrB4RCukhTSMNSstJxg1sel/CeuuzwVruNDFdPhW8C+9MrzewjGxGo6qP9Z7sI26zXUnBNhl39iphccZd2ARM47lV8pQ6bseBD6+HQsy8QtqB4YyKl3EXRMtLElQLVlMNo5hHpWe4+grzfRUI5ohNWrgsZrroG7yCB/Dfng5ubG7/ojFXFNNokURnV9qNIh14fZk9NyPUM2DaS8g/M8jol39qjPEWV3LI2a/QS7lLGIYYNsrCBQMfuBxSWogux792gP15Q02R63W5ajSbC3JpZ9gyohLLdtSxDiRIZVDAnIS/6QMidelfx56OTycno5evfjycXo/Nfj38ZT4oseHdz40SNSkkfALVts0fQDjudxva3LxV2AU1lLlRshXUzN+TNpcmHuxTXgpEjyTDlSBbd3Ulynb5I3bE42apkVPdUuCY8ZGrW36gA7TphYt76UHWD2F7/XJ9oD9Pyg7Y16pqP2vtvl/VF/fNXhk9M8momFrOmC+MeMNtgdIiXayMyoWzj86EkTRWU4Yxso9n/J3C2dFdGiJ+3Rl513lcbU5kbsjDbTNosYL893ruWPDTwO6udfwDDGeSz")))
|
||||
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")))
|
||||
MARKETING_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtW89v4ygUvuevQD7MSKsSp5lbD6OR9rRa7W1uk8oiGMc0GFzATbNV/vd9+EeaOHaqVpt6knBpbfh4wHufee9z3ZcRQsET04YrGdyh6fj2xrUoPTdw+wLXcJcVkluloSFYqmQ6DeuGH5Pxt/HtbQCoTTlspfQyEWq1MzbXmKaMLl+boPFBleZ/1fdo27M7XShVzKJ5wUUcERlHlhm7Y6QGS5Ixt7AShwGHS9xNC+VMvW4zmE7biJzQJVmwKCMSfpV7lXnWRjnbEVUZoGK3g+DXzMGQLiQSXNpZcINeW8o1NU3PKBdkvdJ8kVrEpbFECERTrTJeZAjjFbcpjllu9m24Ge8a2H6XcKZSVRg2C+7bK6VKWvZs97xcdy1gpmIe7DXft4YnXFhw14G/oWuuiYSQdvU55kix7pi07AsTRmyh2WwWjv8IWytuMKmyCX+uIQeI+1bLZtR393q9uTnOs1jRJdORoUT284tnQAtcYlquKnuiBpcRvWSWywVesbnhlrXhmi24sdo5KVikVI+5Ch8hnJirQ+hjwTUzXUFs8d0Hsw6mYVQza96IZo3qjOdVeYvAefaGqwDS7SfCRaRklHAZA9/L4zAhwrBrdmiZaKj78VgQwe2637EOhRvUifKVP0E+HELwPjj2WPhqxIlCl3G5u4pgcpjhq87IKiUc4qGj8NmCTAFFi15HObHp7vLD5gLXiPGDUbLXTF37lJluGXONcI6aTvTlC2I0VejryyywCgqcWXAHl1AYMVNd5hRKpLvbyWSz2XxF39H7VuHZ/EE2Q7orNBwzb2fFEtZ53Psj6YRBHO2OrUMaxOyJCZV74XRNwmkb9YusjU+6u3OoZU/pAF97DuVyXyv6WnEo9vna7nOdXr8trMqrvDBpv88rKK52XkI/7dVhyoiw6fYJDvv6lXaVTvBtMpn0QOJ5bzI8Fu4jGQb1HojoaPWB+hM4ahP8KL2OlXjg1t+Ym506ASriBbDG64Sr0glN1C9TJ5xyd2ehE07oAK8ThnK51wleJwzFPq8TPtfpXid4nTAYNzt1gmaCEcMw7DvmMbHMKwb/SVZNCv+JzjCuON/vbwbwlhcuZxEfr3K8yjkLqnpJ9BtHyOsnr58ugshVbR/VM/ezuMLhBvcODhzy/8NhuSgd0qmCc63igtrquPby93r+YJYRLv2LvsES1XuKmGFfvJ2KKEXuXrpFNIZckKt+llQ4TGNc4tq+2Q4P/lbJzxWTdv1zpUIqCgP7xvAsqdy0RzH5xLWSGaDdSHcIdhhOlM5ICViCMXjA/2UdqH2StngXvklasNCw0DJJpDXl2LCGh83UxJ3R4zXJxIEFHsEuIwaBKuUb5T+chfEh62tks9Z/qkigP/+63PR6Mvr6Oub/cvR+XeL+e3q0Gf0Hgnpc+w==")))
|
||||
|
||||
|
||||
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", "marketing"):
|
||||
raise ManifestError("Unsupported profile")
|
||||
allowed = ("profile", "orb_version", "default_branch", "docs_only", "publish")
|
||||
if 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", "marketing"):
|
||||
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",)
|
||||
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 an explicit stable 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")
|
||||
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")
|
||||
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 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"):
|
||||
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),
|
||||
"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"))
|
||||
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 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):
|
||||
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 kind != "test" and not config["publish"][kind]:
|
||||
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:
|
||||
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/.*)/"}
|
||||
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" 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"
|
||||
if kind == "test" 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, branch, tag
|
||||
# One final continuation; Munitor supplies jobs, never another setup pipeline.
|
||||
return copy.deepcopy(MARKETING_TEMPLATE)
|
||||
|
||||
|
||||
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 branch, tag # This profile's reviewed static filters own its three workflows.
|
||||
return json.loads(json.dumps(VOYAGE_TEMPLATE).replace("__ORB_VERSION__", config["orb_version"]))
|
||||
|
||||
|
||||
PROFILE_TEMPLATES = {"qbit": qbit_template, "core": core_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 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", ""))
|
||||
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)
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
python3 scripts/run_core_smoke.py qqq-all-app/target/qqq-all-app.jar
|
||||
@@ -1,34 +0,0 @@
|
||||
#!/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
|
||||
@@ -1,320 +0,0 @@
|
||||
"""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())
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
## qqq_helpers.sh
|
||||
## QQQ Orb Shared Helper Functions
|
||||
##
|
||||
## Provides common utilities used across node_app_* scripts:
|
||||
## - Double-source guard to prevent re-initialization
|
||||
## - Banner display for step identification
|
||||
## - Tool existence checking
|
||||
##
|
||||
## Usage: source qqq_helpers.sh (from other scripts)
|
||||
## Output: Exports helper functions into the calling script
|
||||
############################################################################
|
||||
|
||||
# Double-source guard
|
||||
if [[ -n "${_QQQ_HELPERS_LOADED:-}" ]]; then
|
||||
# shellcheck disable=SC2317
|
||||
return 0 2>/dev/null || true
|
||||
fi
|
||||
_QQQ_HELPERS_LOADED=1
|
||||
|
||||
############################################################################
|
||||
## banner
|
||||
## Print a visible section header
|
||||
##
|
||||
## Usage: banner "Step Name"
|
||||
############################################################################
|
||||
banner() {
|
||||
local msg="$1"
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo " ${msg}"
|
||||
echo "========================================"
|
||||
echo ""
|
||||
}
|
||||
|
||||
############################################################################
|
||||
## require_tool
|
||||
## Verify a CLI tool is available, exit 1 if missing
|
||||
##
|
||||
## Usage: require_tool "pnpm"
|
||||
############################################################################
|
||||
require_tool() {
|
||||
local tool="$1"
|
||||
if ! command -v "${tool}" &>/dev/null; then
|
||||
echo "ERROR: Required tool '${tool}' is not installed."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
"""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') == 'publish_release_candidate' 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))
|
||||
Loaded 100 of 172 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user