Compare commits

..
Author SHA1 Message Date
james.maesandCodex 30bd089702 ci: trigger scans for newly protected release target
The original promotion PR was created before main protection, so default CodeQL did not run. Reopening did not register a scan. Trigger the documented push event without changing the tested source tree.

Co-Authored-By: Codex <noreply@openai.com>
2026-10-20 21:45:28 -05:00
james.maesandCodex 0692f9dfec release: promote tested Android publisher and All regression coverage
Promote the exact tested develop tree while preserving the existing linear main history after earlier squash promotions.

Co-Authored-By: Codex <noreply@openai.com>
2026-10-20 21:42:52 -05:00
james.maesandCodex 65265e48a4 release: promote public All smoke evidence (#45)
* fix: build marketing site before browser checks (#40)

Run lint and one production build in every shared marketing workflow before Playwright and Lighthouse. Preserve the delegated delivery contracts.

Co-authored-by: Codex <noreply@openai.com>

* fix: use shared Maven credentials for Android publication (#42)

Use the existing organization context and Gradle environment properties. Fail before publishing if either credential is absent and avoid writing secrets to gradle.properties.

Co-authored-by: Codex <noreply@openai.com>

* fix: verify public All smoke evidence without secret export (#44)

Allow unauthenticated Circle API reads for public projects, preserve optional authentication and all fail-closed provenance checks.

Co-authored-by: Codex <noreply@openai.com>

* fix: default All releases to shared Circle smoke evidence (#35)

Co-authored-by: Codex <noreply@openai.com>

---------

Co-authored-by: Codex <noreply@openai.com>
2026-10-20 21:15:15 -05:00
james.maesandCodex 49399deb3d release: promote shared Android publisher (#43)
* fix: build marketing site before browser checks (#40)

Run lint and one production build in every shared marketing workflow before Playwright and Lighthouse. Preserve the delegated delivery contracts.

Co-authored-by: Codex <noreply@openai.com>

* fix: use shared Maven credentials for Android publication (#42)

Use the existing organization context and Gradle environment properties. Fail before publishing if either credential is absent and avoid writing secrets to gradle.properties.

Co-authored-by: Codex <noreply@openai.com>

---------

Co-authored-by: Codex <noreply@openai.com>
2026-10-20 21:09:48 -05:00
james.maesandCodex 9fe4257490 fix: build marketing site before browser checks (#40) (#41)
Run lint and one production build in every shared marketing workflow before Playwright and Lighthouse. Preserve the delegated delivery contracts.

Co-authored-by: Codex <noreply@openai.com>
2026-10-20 20:58:58 -05:00
james.maes 0965a45653 Merge pull request #39 from QRun-IO/develop
release: gate Voyage publication on artifact security scan
2026-10-20 20:42:00 -05:00
james.maes bfd41c8e0d Merge pull request #37 from QRun-IO/develop
release: ship shared policy continuation fix
2026-10-20 20:08:21 -05:00
james.maes 9c30a30754 Merge pull request #33 from QRun-IO/develop
release: promote Maven reporting and publication fixes
2026-10-20 19:23:39 -05:00
james.maes ee8953bd93 Merge pull request #31 from QRun-IO/develop
fix: release confirmed Central publication checks
2026-10-20 18:48:38 -05:00
james.maes 5bc3167286 Merge pull request #29 from QRun-IO/develop
fix: release resolved Maven publication POMs
2026-10-20 18:39:47 -05:00
james.maes 1a3368e119 Merge pull request #27 from QRun-IO/develop
release: fail closed on GitHub publication errors
2026-10-20 07:39:37 -05:00
james.maes 1ddba883c9 Merge pull request #25 from QRun-IO/develop
release: central QQQ CI and release workers [minor]
2026-10-20 07:17:29 -05:00
james.maes da8044d6f2 Merge pull request #23 from QRun-IO/develop
release: qqq-orb 0.6.9 (snapshot refresh)
2026-10-14 10:04:52 -05:00
james.maes 67ba48da1f Merge pull request #18 from QRun-IO/develop
release: publish orb 0.6.8 with CircleCI npm OIDC correction
2026-09-29 15:17:00 -05:00
james.maes 5196609974 Merge pull request #16 from QRun-IO/develop
release: publish npm Trusted Publishing support in orb 0.6.7
2026-09-29 14:18:44 -05:00
james.maes 49e09a6776 Merge pull request #14 from QRun-IO/develop
release: publish orb log-safety fix as 0.6.6
2026-09-29 13:38:22 -05:00
james.maes 748016f105 Merge pull request #10 from QRun-IO/develop
[minor] feat: add node_app_* job family
2026-02-27 12:59:51 -06:00
james.maes 6514aaa688 Merge pull request #8 from QRun-IO/develop
fix(ci): remove legacy tag-based publish workflow
2026-01-31 18:46:54 -06:00
james.maes 3ac47adc21 Merge pull request #7 from QRun-IO/develop
Release: auto-publish pipelines and security scanning
2026-01-31 18:40:34 -06:00
22 changed files with 41 additions and 808 deletions

No files matched your search

-3
View File
@@ -49,7 +49,6 @@ jobs:
python3 tests/test_cli_ci_contract.py
python3 tests/test_maven_ci_contract.py
python3 tests/test_standardize_qbit.py
python3 tests/test_rollout_version.py
python3 tests/test_validate_standard.py
python3 tests/test_voyage_profile.py
python3 tests/test_next_native.py
@@ -61,8 +60,6 @@ jobs:
python3 -m unittest discover -s tests -p test_generate_qctl_workflow.py
python3 tests/test_rc_finalize_sweep.py
python3 tests/test_rc_guard.py
python3 -m unittest discover -s tests -p test_rc_timeout_recovery.py
python3 -m unittest discover -s tests -p test_rc_ref_lookup.py
python3 -m unittest discover -s tests -p test_generate_rc_workflow.py
python3 -m unittest discover -s tests -p test_audit_estate.py
python3 tests/test_all_profiles.py
-38
View File
@@ -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
+10 -230
View File
@@ -19,14 +19,6 @@ on:
description: Finalize an existing cut from repository_dispatch or an explicit retry
type: boolean
default: false
recover:
description: Verify an already-published upload after a Circle deployment timeout
type: boolean
default: false
circle_build:
description: Original Circle publisher build number (recovery only)
type: string
default: ''
merge_sha:
type: string
default: ''
@@ -40,10 +32,6 @@ on:
type: string
default: ''
secrets:
CENTRAL_USERNAME:
required: false
CENTRAL_PASSWORD:
required: false
QRUN_TAG_SIGNING_KEY:
description: SSH private key that signs release tags
required: false
@@ -60,7 +48,7 @@ concurrency:
jobs:
cut-rc:
if: ${{ !inputs.finalize && !inputs.recover }}
if: ${{ !inputs.finalize }}
runs-on: ubuntu-24.04
timeout-minutes: 10
outputs:
@@ -147,7 +135,7 @@ jobs:
retention-days: 90
tag-and-release:
if: inputs.finalize || inputs.recover
if: inputs.finalize
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
@@ -159,12 +147,6 @@ jobs:
MERGE_SHA: ${{ inputs.merge_sha }}
BUMP_SHA: ${{ inputs.bump_sha }}
VERSION: ${{ inputs.version }}
DRY_RUN: ${{ inputs.dry_run }}
RECOVER: ${{ inputs.recover }}
CIRCLE_BUILD: ${{ inputs.circle_build }}
RECOVERY_EVENT: ${{ github.event_name }}
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }}
SIGNING_KEY: ${{ secrets.QRUN_TAG_SIGNING_KEY }}
run: |
set -euo pipefail
@@ -174,22 +156,6 @@ jobs:
fi
workdir=$(mktemp -d)
trap 'rm -rf "$workdir"' EXIT
# BEGIN RC REF LOOKUP
read_ref() {
local body sha
if body=$(gh api "repos/$REPO/git/ref/$1" 2>"$workdir/ref-error"); then
sha=$(jq -er '.object.sha' <<< "$body") || return 1
[[ "$sha" =~ ^[0-9a-f]{40}$ ]] || return 1
printf '%s\n' "$sha"
elif jq -se 'length == 1 and .[0].status == "404"' >/dev/null 2>&1 <<< "$body"; then
# gh prints HTTP error JSON on stdout even when --jq was requested.
return 0
else
cat "$workdir/ref-error" >&2
return 1
fi
}
# END RC REF LOOKUP
# The evaluator is inline so a pinned reusable workflow cannot fetch mutable code.
cat > "$workdir/rc_guard.py" <<'PY'
# BEGIN RC GUARD
@@ -198,7 +164,7 @@ jobs:
class ReleaseFailure(ValueError):
pass
def evaluate(merge_sha, status, commit, recovered_version=""):
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.
@@ -211,7 +177,7 @@ jobs:
raise ReleaseFailure("Publisher Check Run identifies a different source")
if publisher.get("status") != "completed":
return ""
if publisher.get("conclusion") != "success" and not recovered_version:
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)
@@ -219,8 +185,6 @@ jobs:
return ""
if [x.get("sha") for x in commit.get("parents", [])] != [merge_sha]:
raise ReleaseFailure("RC bump is not the direct child of the published merge")
if recovered_version and recovered_version != match.group(1):
raise ReleaseFailure("Recovery receipt and bump version differ")
return match.group(1)
def validate_intent(run, intent, repo, merge, branch, run_id):
@@ -259,168 +223,24 @@ jobs:
raise ReleaseFailure("Central POM does not match the expected artifact/version")
if parsedate_to_datetime(modified).timestamp() <= datetime.fromisoformat(merged.replace("Z", "+00:00")).timestamp():
raise ReleaseFailure("Central artifact predates the exact release merge")
def validate_timeout(job, publisher, repo, merge, branch, build, merged_at):
from datetime import datetime
if (job.get('username') + '/' + job.get('reponame'), job.get('vcs_revision'),
job.get('branch'), str(job.get('build_num'))) != (repo, merge, branch, build):
raise ReleaseFailure('Timeout job does not identify the exact cut')
workflow = job.get('workflows', {})
if workflow.get('workflow_name') != 'publish_release_candidate' or workflow.get('job_name') != 'qqq-orb/mvn_publish':
raise ReleaseFailure('Unexpected Circle publication workflow/job')
if (publisher.get('head_sha') != merge or publisher.get('app', {}).get('id') != 18001
or publisher.get('name') != 'publish_release_candidate'
or publisher.get('status') != 'completed' or publisher.get('conclusion') != 'failure'):
raise ReleaseFailure('Recovery requires the failed exact Circle publisher')
from urllib.parse import urlsplit
link = urlsplit(publisher.get('details_url', ''))
if link.scheme != 'https' or link.netloc != 'app.circleci.com' or link.path != '/workflow/' + workflow.get('workflow_id', ''):
raise ReleaseFailure('Circle check does not identify the timeout workflow')
if job.get('status') != 'failed' or job.get('outcome') != 'failed':
raise ReleaseFailure('Recovery requires a terminal failed job')
actions = [action for step in job.get('steps', []) for action in step.get('actions', [])]
if not actions or actions[-1].get('name') != 'Publish to Sonatype Central (releases and SNAPSHOTs)':
raise ReleaseFailure('Deployment must be the last executed action')
deploy = actions[-1]
if deploy.get('status') != 'timedout' or deploy.get('timedout') is not True:
raise ReleaseFailure('Only a deployment timeout can be recovered')
if any(action.get('status') != 'success' for action in actions[:-1]):
raise ReleaseFailure('Every pre-publication action must have passed')
if not any(action.get('name') == 'Run Maven Verify' for action in actions[:-1]):
raise ReleaseFailure('Successful Maven verification is missing')
if datetime.fromisoformat(job['start_time'].replace('Z', '+00:00')) < datetime.fromisoformat(merged_at.replace('Z', '+00:00')):
raise ReleaseFailure('Publisher predates the trusted cut')
if any(type(deploy.get(key)) is not int or deploy[key] < 0 for key in ('step', 'index')):
raise ReleaseFailure('Invalid deployment log coordinates')
return deploy['step'], deploy['index']
def upload_receipt(log, artifact, version):
# Only the successful-upload receipt and actual Central staging paths count.
deployments = re.findall(r'Uploaded bundle successfully,[^\n]*deploymentId: ([0-9a-f-]{36})\.', log)
if len(deployments) != 1 or not re.fullmatch(r'[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}', deployments[0]):
raise ReleaseFailure('Expected exactly one successful Central upload receipt')
paths = re.findall(r'/target/central-staging/(com/kingsrook/qbits)/(qbit-[a-z0-9-]+)/(\d+\.\d+\.\d+-RC\.\d+)/', log)
coordinates = {(group.replace('/', '.'), name, revision) for group, name, revision in paths}
if not coordinates or ('com.kingsrook.qbits', artifact, version) not in coordinates:
raise ReleaseFailure('Receipt does not include the expected root artifact')
if any(revision != version for _, _, revision in coordinates):
raise ReleaseFailure('Mixed candidate versions in the uploaded bundle')
return deployments[0], sorted('pkg:maven/' + group + '/' + name + '@' + revision for group, name, revision in coordinates)
def validate_deployment(deployment, deployment_id, purls):
if deployment.get('deploymentId') != deployment_id or deployment.get('deploymentState') != 'PUBLISHED':
raise ReleaseFailure('The original Central deployment is not PUBLISHED')
if sorted(deployment.get('purls', [])) != purls:
raise ReleaseFailure('Central deployment coordinates differ from the original upload')
def validate_recovery_bump(commit, source, actual, version, merge):
if [p.get('sha') for p in commit.get('parents', [])] != [merge]:
raise ReleaseFailure('Recovery bump must be a direct child of the cut')
files = commit.get('files', [])
if len(files) != 1 or files[0].get('filename') != 'pom.xml' or files[0].get('status') != 'modified':
raise ReleaseFailure('Recovery bump may change only the root POM')
revisions = re.findall(r'<revision>([^<]+)</revision>', source)
if len(revisions) != 1 or not re.fullmatch(re.escape(version.split('-RC.')[0]) + r'-(SNAPSHOT|RC\.\d+)', revisions[0]):
raise ReleaseFailure('Unexpected source POM revision')
expected = source.replace('<revision>' + revisions[0] + '</revision>', '<revision>' + version + '</revision>')
if actual != expected:
raise ReleaseFailure('Recovery bump changed content beyond the verified version')
def verify_recovery(directory, repo, merge, branch, build, version):
import base64, json, os, pathlib, urllib.request, xml.etree.ElementTree as ET
if not re.fullmatch(r'QRun-IO/qbit-[a-z0-9-]+', repo) or not re.fullmatch(r'[1-9][0-9]*', build):
raise ReleaseFailure('Invalid recovery repository or Circle build')
directory = pathlib.Path(directory)
status = json.loads((directory / 'status.json').read_text())
intent = json.loads((directory / 'intent.json').read_text())
publishers = [p for p in status['check_runs'] if p.get('name') == 'publish_release_candidate' and p.get('app', {}).get('id') == 18001]
if status.get('sha') != merge or not publishers:
raise ReleaseFailure('Exact publisher evidence missing')
class NoRedirect(urllib.request.HTTPRedirectHandler):
def redirect_request(self, *args, **kwargs):
raise ReleaseFailure('Unexpected evidence redirect')
opener = urllib.request.build_opener(NoRedirect())
def request(url, token=None, post=False):
headers = {'Accept': 'application/json'}
if token:
headers['Authorization'] = 'Bearer ' + token
req = urllib.request.Request(url, headers=headers, data=b'' if post else None)
with opener.open(req, timeout=30) as response:
data = response.read(8_000_001)
if len(data) > 8_000_000:
raise ReleaseFailure('Oversized recovery evidence')
return data, response.headers
circle = 'https://circleci.com/api/v1.1/project/github/' + repo + '/' + build
job = json.loads(request(circle)[0])
step, index = validate_timeout(job, max(publishers, key=lambda p: p['id']), repo, merge, branch, build, intent['merged_at'])
log = request(circle + '/output/' + str(step) + '/' + str(index) + '?file=true')[0].decode()
# file=true can return either a raw log or JSON-encoded output.
try:
value = json.loads(log)
except json.JSONDecodeError:
value = log
log = value if isinstance(value, str) else ''.join(part['message'] for part in value)
token = os.environ.get('GH_TOKEN', '')
source = json.loads(request('https://api.github.com/repos/' + repo + '/contents/pom.xml?ref=' + merge, token)[0])
source_pom = base64.b64decode(source['content']).decode()
pom = ET.fromstring(source_pom)
ns = {'m': 'http://maven.apache.org/POM/4.0.0'}
artifact = pom.findtext('m:artifactId', namespaces=ns)
deployment_id, purls = upload_receipt(log, artifact, version)
username, password = os.environ.get('CENTRAL_USERNAME'), os.environ.get('CENTRAL_PASSWORD')
if not username or not password:
raise ReleaseFailure('Existing Central publisher credentials are required for receipt verification')
authorization = base64.b64encode((username + ':' + password).encode()).decode()
deployment = json.loads(request('https://central.sonatype.com/api/v1/publisher/status?id=' + deployment_id, authorization, post=True)[0])
validate_deployment(deployment, deployment_id, purls)
for purl in purls:
coordinate, revision = purl.removeprefix('pkg:maven/').split('@')
group, name = coordinate.split('/')
url = 'https://repo1.maven.org/maven2/' + group.replace('.', '/') + '/' + name + '/' + revision + '/' + name + '-' + revision + '.pom'
xml, headers = request(url)
validate_central(revision, name, xml, headers.get('Last-Modified', ''), intent['merged_at'])
(directory / 'source-pom.xml').write_text(source_pom)
# This receipt is written only after all remote evidence has been verified.
(directory / 'recovery.json').write_text(json.dumps({'merge_sha': merge, 'version': version,
'circle_build': build, 'deployment_id': deployment_id, 'purls': purls}))
# END RC GUARD
if __name__ == "__main__":
import json, sys
try:
if sys.argv[1] == "recover":
verify_recovery(*sys.argv[2:])
elif sys.argv[1] == "lock":
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:
recovered = ""
if len(sys.argv) == 5:
receipt = json.load(open(sys.argv[4]))
if receipt["merge_sha"] != sys.argv[1]:
raise ReleaseFailure("Recovery receipt source mismatch")
recovered = receipt["version"]
import pathlib
directory = pathlib.Path(sys.argv[4]).parent
validate_recovery_bump(json.load(open(sys.argv[3])), (directory / 'source-pom.xml').read_text(),
(directory / 'bump-pom.xml').read_text(), recovered, sys.argv[1])
print(evaluate(sys.argv[1], json.load(open(sys.argv[2])), json.load(open(sys.argv[3])), recovered))
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}$ ]]
if [[ "$RECOVER" == true ]]; then
[[ "$RECOVERY_EVENT" == workflow_dispatch && "$CIRCLE_BUILD" =~ ^[1-9][0-9]*$ ]]
else
[[ "$BUMP_SHA" =~ ^[0-9a-f]{40}$ ]]
fi
[[ "$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"
@@ -458,53 +278,13 @@ jobs:
PY
MERGED_AT=$(jq -er .merged_at "$workdir/intent.json")
lock=automation/qbit-rc-pending
current_lock=$(read_ref "heads/$lock")
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"
recovered_args=()
if [[ "$RECOVER" == true ]]; then
python3 "$workdir/rc_guard.py" lock "$current_lock" "$MERGE_SHA"
python3 "$workdir/rc_guard.py" recover "$workdir" "$REPO" "$MERGE_SHA" "$BRANCH" "$CIRCLE_BUILD" "$VERSION"
if [[ "$DRY_RUN" == true ]]; then
echo "Recovery evidence verified; dry run leaves branch, tag, release and lock unchanged." >> "$GITHUB_STEP_SUMMARY"
exit 0
fi
head=$(gh api "repos/$REPO/branches/$BRANCH" -q .commit.sha)
if [[ "$head" == "$MERGE_SHA" ]]; then
key="$workdir/recovery_key"
install -m 600 /dev/null "$key"
printf '%s\n' "$SIGNING_KEY" > "$key"
git init -q "$workdir/recovery-repo"
git -C "$workdir/recovery-repo" fetch -q --depth=1 "https://x-access-token:$GH_TOKEN@github.com/$REPO.git" "$MERGE_SHA"
git -C "$workdir/recovery-repo" checkout -q -b "$BRANCH" FETCH_HEAD
python3 - "$workdir/recovery-repo/pom.xml" "$VERSION" <<'PY'
import pathlib, re, sys
path, version = pathlib.Path(sys.argv[1]), sys.argv[2]
source = path.read_text()
revisions = re.findall(r'<revision>([^<]+)</revision>', source)
assert len(revisions) == 1 and re.fullmatch(re.escape(version.split('-RC.')[0]) + r'-(SNAPSHOT|RC\.\d+)', revisions[0]), 'Unexpected source revision'
path.write_text(source.replace('<revision>' + revisions[0] + '</revision>', '<revision>' + version + '</revision>'))
PY
git -C "$workdir/recovery-repo" add pom.xml
git -C "$workdir/recovery-repo" -c user.name="James Maes" -c user.email=james@kof22.com -c gpg.format=ssh -c user.signingkey="$key" commit -q -S -m "Bump version to $VERSION [skip ci]"
python3 "$workdir/rc_guard.py" lock "$(gh api "repos/$REPO/git/ref/heads/$lock" -q .object.sha)" "$MERGE_SHA"
# A normal fast-forward push refuses a competing release-branch change.
git -C "$workdir/recovery-repo" push -q "https://x-access-token:$GH_TOKEN@github.com/$REPO.git" "HEAD:$BRANCH"
BUMP_SHA=$(git -C "$workdir/recovery-repo" rev-parse HEAD)
rm -f "$key"
else
BUMP_SHA=$head
fi
recovered_args=("$workdir/recovery.json")
echo "Verified original Central upload after Circle timeout; no artifact was uploaded again." >> "$GITHUB_STEP_SUMMARY"
fi
gh api "repos/$REPO/commits/$BUMP_SHA" > "$workdir/commit.json"
if [[ "$RECOVER" == true ]]; then
gh api "repos/$REPO/contents/pom.xml?ref=$BUMP_SHA" -q .content | base64 -d > "$workdir/bump-pom.xml"
fi
version=$(python3 "$workdir/rc_guard.py" "$MERGE_SHA" "$workdir/status.json" "$workdir/commit.json" "${recovered_args[@]}")
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; }
@@ -536,7 +316,7 @@ jobs:
python3 "$workdir/rc_guard.py" central "$version" "$artifact" "$workdir/central.pom" "$last_modified" "$MERGED_AT"
# 3. Signed annotated tag on the exact bump; duplicate runs must not accept a different tag.
existing=$(read_ref "tags/v$version")
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')
-1
View File
@@ -58,7 +58,6 @@ test-pipelines: pack
bash tests/test_cli_ci_behavior.sh
python3 tests/test_cli_ci_contract.py
python3 tests/test_standardize_qbit.py
python3 tests/test_rollout_version.py
python3 tests/test_validate_standard.py
python3 tests/test_voyage_profile.py
python3 tests/test_next_native.py
-26
View File
@@ -65,29 +65,3 @@ actionlint .github/workflows/workflow-lint.yml
Tests cover exact no-CI allowlists and drift, unknown repositories, missing configured
profiles/native bridges, retained legacy workflows, bootstrap dependency/gate removal,
required-check unknown states, and the lint image/tool/command/caller contract.
## Batch orb-version rollout
Upgrade existing canonical CircleCI consumers with one command:
```sh
python tools/rollout_version.py --orb-version 0.7.11 /checkouts/qbit-one /checkouts/qqq-cli
python tools/rollout_version.py --orb-version 0.7.11 --write /checkouts/qbit-one /checkouts/qqq-cli
```
The first command previews the batch. The second updates only `.qqq-ci.yml` and
`.circleci/config.yml`, after every supplied checkout passes the existing manifest
and canonical-caller validators. It preserves publication opt-outs, release filters,
credential context names and forwarded profile parameters. Already-current files
are unchanged. Duplicate checkouts, custom jobs, invalid options and mismatched
pins reject the batch before writing; resolve these in the central profile first.
Use isolated checkouts of the intended repository heads, inspect the resulting
patches, then commit and push through the normal automated gates. The tool does not
commit, push, publish packages, change GitHub rules or modify native/RC worker pins.
A version update does not prove a publication succeeded: retain exact-head hosted
verification and artifact evidence. The requested version must already be published.
```sh
python3 -m unittest discover -s tests -p test_rollout_version.py
```
-9
View File
@@ -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.
-27
View File
@@ -80,30 +80,3 @@ release-captain reconciliation; the sweep does not invent provenance.
syntax. Full actionlint with Windows native ShellCheck hung locally and was
stopped; Linux actionlint/ShellCheck and end-to-end credential/callback rollout
verification remain required. The orb has separate sweep/dispatch fixture tests.
### Published upload timeout recovery
A Circle deployment step can time out after Central has accepted and published its
bundle. Use the canonical caller's explicit manual `recover` input with the existing
`merge_sha`, `branch`, `version` and original `circle_build`. Run with `dry_run: true`
first to verify evidence without changing the branch, tag, release or pending lock.
This mode never builds, uploads, cuts a new candidate, or changes the failed Circle check.
The pinned orb worker requires the original successful cut intent and unchanged lock,
the exact failed Circle workflow/check, a final deployment timeout after all preceding
actions (including Maven Verify) succeeded, exactly one successful upload receipt,
and an authenticated Central `PUBLISHED` response matching every staged coordinate.
It also checks public POM coordinates and publication timestamps after the cut.
Existing organization `CENTRAL_USERNAME` and `CENTRAL_PASSWORD` secrets authenticate
only the Central status request; Circle evidence uses its public API. Redirects are
rejected and credentials are never included in the recovery receipt.
After verification, recovery creates only the missing signed version bump as a direct
child of the original release merge, using a normal fast-forward push. An existing
bump must pass the same parent/version checks. The existing signed-tag/prerelease
finalizer then completes the candidate and compares lock ownership before cleanup.
A later explicit recovery retry verifies the original receipt again. Once the lock
is gone, the completed release needs no recovery dispatch. Ordinary callbacks and
scheduled reconciliation retain the requirement for a successful Circle publisher.
Central status API: https://central.sonatype.org/publish/publish-portal-api/
-4
View File
@@ -17,16 +17,12 @@ def canonical(worker_sha):
"dry_run": {"description": "Plan a cut without changing release state", "type": "boolean", "default": False},
"finalize": {"description": "Retry finalization of an existing cut; do not cut another RC", "type": "boolean", "default": False},
}
inputs['recover'] = {'description': 'Recover the same published RC after a deployment timeout; never reupload', 'type': 'boolean', 'default': False}
inputs['circle_build'] = {'description': 'Original Circle publisher build number (recovery only)', 'type': 'string', 'default': ''}
for field in ("merge_sha", "bump_sha", "branch", "version"):
inputs[field] = {"description": "Existing cut " + field + " (finalize retry only)", "type": "string", "default": ""}
forwarded = {
"dry_run": "${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || false }}",
"finalize": "${{ github.event_name == 'repository_dispatch' || (github.event_name == 'workflow_dispatch' && inputs.finalize) }}",
}
forwarded['recover'] = "${{ github.event_name == 'workflow_dispatch' && inputs.recover || false }}"
forwarded['circle_build'] = "${{ github.event_name == 'workflow_dispatch' && inputs.circle_build || '' }}"
for field in ("merge_sha", "bump_sha", "branch", "version"):
forwarded[field] = "${{ github.event_name == 'repository_dispatch' && github.event.client_payload." + field + " || inputs." + field + " || '' }}"
return {
+1 -1
View File
@@ -22,7 +22,7 @@ VOYAGE_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtW+tz2zYS/56/A
NEXT_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrNVE1v2zAMvedXCFqAtlscb70tQLGtXTEUGFYgHXqJM0OxmUSJLCmS7DYr8t9HubaXOOnHYYfdLPLp6fGR9EOHEFqAsVxJOiCn/Q89H1FmYvH4gN94Wq1WAUYwQJdczqxRahlWwc9xfD08j28vhzdX1z/imOKVTcmxUNscOp8Ibudxyux8ophJ4wUzTRoBcA9J7pSP1Q+GC1Yw2qsR1oH2jKMqgKFkDslS5a4BkYZwW3nIpXVMiLgkHOxgEFVnpUoBs87k0NtF+Ez81yZ6ekq3AJvme/OEDpPL/Wcly/xz9BYMn66JmwPhWZY7NhFADAhgFkj9aEtQorKMydRfr5C1vLOIdh8uroYX3y/jn1++vSk2EY3k1CjpQKYNqnvsayKBJh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IZo3qjOdVeYvAefaGqwDS7SfCRaRklHAZA9/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==")))
+1 -1
View File
@@ -87,7 +87,7 @@
{
"run": {
"name": "Publish with shared Maven credentials",
"command": "set -euo pipefail\n: \"${GITHUB_TOKEN:?GitHub Packages write credential is required}\"\n# Authenticate before compiling; repository access is necessary, not proof of package write access.\nregistry_user=$(python3 \\<<'PYTHON'\nimport json\nimport os\nimport urllib.request\n\nclass NoRedirect(urllib.request.HTTPRedirectHandler):\n def redirect_request(self, req, fp, code, msg, headers, newurl):\n raise RuntimeError(\"GitHub authentication redirect refused\")\n\ntry:\n opener = urllib.request.build_opener(NoRedirect)\n def get(path):\n request = urllib.request.Request(\"https://api.github.com/\" + path,\n headers={\"Authorization\": \"Bearer \" + os.environ[\"GITHUB_TOKEN\"],\n \"Accept\": \"application/vnd.github+json\"})\n with opener.open(request, timeout=30) as response:\n return json.load(response)\n user = get(\"user\").get(\"login\")\n if not isinstance(user, str) or not user or not get(\"repos/QRun-IO/qqq-maven-registry\").get(\"permissions\", {}).get(\"push\"):\n raise ValueError(\"Missing registry access\")\n print(user)\nexcept Exception:\n raise SystemExit(\"GitHub Packages credential cannot access the Maven registry\") from None\nPYTHON\n)\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryUsername=\"$registry_user\"\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryPassword=\"$GITHUB_TOKEN\"\n./gradlew --console=plain publishMavenPublicationToGithubQqqMavenRegistryRepository\n"
"command": "set -euo pipefail\n: \"${GITHUB_TOKEN:?GitHub Packages write credential is required}\"\n# Authenticate before compiling; repository access is necessary, not proof of package write access.\nregistry_user=$(python3 <<'PYTHON'\nimport json\nimport os\nimport urllib.request\n\nclass NoRedirect(urllib.request.HTTPRedirectHandler):\n def redirect_request(self, req, fp, code, msg, headers, newurl):\n raise RuntimeError(\"GitHub authentication redirect refused\")\n\ntry:\n opener = urllib.request.build_opener(NoRedirect)\n def get(path):\n request = urllib.request.Request(\"https://api.github.com/\" + path,\n headers={\"Authorization\": \"Bearer \" + os.environ[\"GITHUB_TOKEN\"],\n \"Accept\": \"application/vnd.github+json\"})\n with opener.open(request, timeout=30) as response:\n return json.load(response)\n user = get(\"user\").get(\"login\")\n if not isinstance(user, str) or not user or not get(\"repos/QRun-IO/qqq-maven-registry\").get(\"permissions\", {}).get(\"push\"):\n raise ValueError(\"Missing registry access\")\n print(user)\nexcept Exception:\n raise SystemExit(\"GitHub Packages credential cannot access the Maven registry\") from None\nPYTHON\n)\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryUsername=\"$registry_user\"\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryPassword=\"$GITHUB_TOKEN\"\n./gradlew --console=plain publishMavenPublicationToGithubQqqMavenRegistryRepository\n"
}
}
]
+17 -37
View File
@@ -198,10 +198,20 @@
"caller": {
"name": "Database migrations",
"on": {
"pull_request": {},
"pull_request": {
"paths": [
"db/**",
"pom.xml",
".github/workflows/db-migrations.yml"
]
},
"push": {
"branches": [
"main"
],
"paths": [
"db/**",
"pom.xml"
]
}
},
@@ -212,10 +222,6 @@
"validate": {
"uses": "QRun-IO/qqq-orb/.github/workflows/business-db.yml@WORKER_SHA"
}
},
"concurrency": {
"group": "business-db-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}",
"cancel-in-progress": "${{ github.event_name == 'pull_request' }}"
}
}
},
@@ -256,6 +262,11 @@
"main"
]
},
"schedule": [
{
"cron": "17 6 * * *"
}
],
"workflow_dispatch": null
},
"permissions": {
@@ -263,7 +274,7 @@
},
"concurrency": {
"group": "e2e-${{ github.ref }}",
"cancel-in-progress": "${{ github.event_name == 'pull_request' }}"
"cancel-in-progress": true
},
"jobs": {
"validate": {
@@ -396,36 +407,5 @@
}
}
}
},
"gitops": {
"repository": "QRun-IO/marketing-website-cd",
"path": ".github/workflows/validate.yml",
"caller": {
"name": "GitOps validation",
"on": {
"push": {
"branches": [
"main"
]
},
"pull_request": {
"branches": [
"main"
]
}
},
"permissions": {
"contents": "read"
},
"concurrency": {
"group": "gitops-${{ github.ref }}",
"cancel-in-progress": "${{ github.event_name == 'pull_request' }}"
},
"jobs": {
"gitops": {
"uses": "QRun-IO/qqq-orb/.github/workflows/gitops.yml@WORKER_SHA"
}
}
}
}
}
+1 -1
View File
@@ -151,7 +151,7 @@ class AuditTests(unittest.TestCase):
self.assertIn('profile_not_assigned', [f['code'] for f in report['findings']])
def test_native_specialists_require_bridges_and_report_remaining_workflows(self):
for name, kind in [('qqq-mcp-rag', 'mcp-rag'), ('qqq-business-platform', 'business-db'), ('.github', 'github-workflow-lint'), ('marketing-website-cd', 'gitops')]:
for name, kind in [('qqq-mcp-rag', 'mcp-rag'), ('qqq-business-platform', 'business-db'), ('.github', 'github-workflow-lint')]:
entry = dict(ENTRY, name=name, nameWithOwner='QRun-IO/' + name)
definition = audit.auxiliary.BRIDGES[kind]
missing = audit.audit(entry, Snapshot({}), VERSION, SHA, {})
+2 -41
View File
@@ -1,7 +1,4 @@
import copy
import os
import subprocess
import tempfile
import importlib.util
import json
from pathlib import Path
@@ -17,40 +14,6 @@ ORIGINALS = json.loads((ROOT / 'tests/fixtures/auxiliary-original-workflows.json
SHA = 'a' * 40
class GitOpsTests(unittest.TestCase):
def test_render_all_directories_and_fail_on_invalid_or_missing_configuration(self):
worker = yaml.safe_load((ROOT / '.github/workflows/gitops.yml').read_text())
command = worker['jobs']['validate']['steps'][-1]['run']
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
binary = root / 'bin'
binary.mkdir()
tool = binary / 'kustomize'
tool.write_text("#!/bin/bash\n[[ $1 == build ]] || exit 2\n[[ ! -f \"$2/invalid\" ]] || exit 1\necho sensitive-rendered-fixture\n")
tool.chmod(0o755)
env = {**os.environ, 'PATH': str(binary) + os.pathsep + os.environ['PATH']}
def run():
return subprocess.run(['bash', '-c', command], cwd=root, env=env, text=True, capture_output=True)
self.assertNotEqual(0, run().returncode)
for name in ('base', 'overlays/dev', 'overlays/with space', 'proxy'):
folder = root / name
folder.mkdir(parents=True)
(folder / 'kustomization.yaml').write_text('resources: []')
result = run()
self.assertEqual(0, result.returncode, result.stderr)
self.assertEqual(4, result.stdout.count('Validated '))
self.assertNotIn('sensitive-rendered-fixture', result.stdout)
(root / 'proxy/invalid').touch()
self.assertNotEqual(0, run().returncode)
def test_gitops_caller_is_read_only_and_has_no_duplicate_feature_push_build(self):
caller = bridge.canonical('gitops', SHA)
self.assertEqual({'contents': 'read'}, caller['permissions'])
self.assertEqual(['main'], caller['on']['push']['branches'])
self.assertNotIn('paths', caller['on']['pull_request'])
self.assertNotIn('secrets', caller['jobs']['gitops'])
class SpecialistNativeTests(unittest.TestCase):
def setUp(self):
self.originals = json.loads((ROOT / 'tests/fixtures/specialist-native-originals.json').read_text(encoding='utf-8'))
@@ -58,14 +21,12 @@ class SpecialistNativeTests(unittest.TestCase):
def worker(self, kind):
return yaml.safe_load((ROOT / '.github/workflows' / (kind + '.yml')).read_text(encoding='utf-8'))
def test_business_database_gate_reports_for_every_pr_and_preserves_validation(self):
def test_business_database_job_and_path_filters_are_unchanged(self):
original = self.originals['business-db']
worker = self.worker('business-db')
self.assertEqual(worker['jobs'], original['workflow']['jobs'])
caller = bridge.canonical('business-db', SHA)
self.assertEqual(caller['on'], {'pull_request': {}, 'push': {'branches': ['main']}})
self.assertEqual(caller['concurrency']['cancel-in-progress'], "${{ github.event_name == 'pull_request' }}")
self.assertIn('github.event.pull_request.number || github.ref', caller['concurrency']['group'])
self.assertEqual(caller['on'], original['events'])
self.assertEqual(set(worker['jobs']), {'empty-database-migration'})
self.assertNotIn('secrets', caller['jobs']['validate'])
self.assertNotIn('schedule', caller['on'])
+3 -6
View File
@@ -29,14 +29,11 @@ class BusinessE2ETests(unittest.TestCase):
self.assertEqual('always()', self.worker['jobs']['e2e']['steps'][-1]['if'])
self.assertEqual('docker compose -f deploy/compose/docker-compose.yml down -v', self.worker['jobs']['e2e']['steps'][-1]['run'])
def test_code_changes_and_manual_runs_keep_full_gate_without_nightly_duplicates(self):
expected_events = copy.deepcopy(self.original['events'])
del expected_events['schedule']
self.assertEqual(expected_events, self.caller['on'])
def test_events_permissions_path_and_single_concurrency_owner_preserved(self):
self.assertEqual(self.original['events'], self.caller['on'])
self.assertEqual(self.original['workflow']['permissions'], self.caller['permissions'])
self.assertEqual(self.caller['permissions'], self.worker['permissions'])
self.assertEqual(self.original['workflow']['concurrency']['group'], self.caller['concurrency']['group'])
self.assertEqual("${{ github.event_name == 'pull_request' }}", self.caller['concurrency']['cancel-in-progress'])
self.assertEqual(self.original['workflow']['concurrency'], self.caller['concurrency'])
self.assertNotIn('concurrency', self.worker)
self.assertEqual('.github/workflows/e2e.yml', aux.BRIDGES['business-e2e']['path'])
self.assertEqual({'workflow_call': {'secrets': {'E2E_ALERT_WEBHOOK_URL': {'required': False}}}}, self.worker['on'])
+2 -5
View File
@@ -35,16 +35,13 @@ class RcBridgeTests(unittest.TestCase):
data = rc.canonical(SHA)
inputs = data["on"]["workflow_dispatch"]["inputs"]
passed = data["jobs"]["release-rc"]["with"]
self.assertEqual({"dry_run", "finalize", "recover", "circle_build", "merge_sha", "bump_sha", "branch", "version"}, set(inputs))
self.assertEqual({"dry_run", "finalize", "merge_sha", "bump_sha", "branch", "version"}, set(inputs))
self.assertEqual(set(inputs), set(passed))
for name in ("dry_run", "finalize", "recover"):
for name in ("dry_run", "finalize"):
self.assertEqual("boolean", inputs[name]["type"])
self.assertIs(False, inputs[name]["default"])
self.assertEqual("${{ github.event_name == 'repository_dispatch' || (github.event_name == 'workflow_dispatch' && inputs.finalize) }}", passed["finalize"])
self.assertEqual("${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || false }}", passed["dry_run"])
self.assertEqual("${{ github.event_name == 'workflow_dispatch' && inputs.recover || false }}", passed['recover'])
self.assertEqual("${{ github.event_name == 'workflow_dispatch' && inputs.circle_build || '' }}", passed['circle_build'])
self.assertEqual({'description': 'Original Circle publisher build number (recovery only)', 'type': 'string', 'default': ''}, inputs['circle_build'])
for name in ("merge_sha", "bump_sha", "branch", "version"):
self.assertEqual("string", inputs[name]["type"])
self.assertEqual("", inputs[name]["default"])
+1 -3
View File
@@ -38,9 +38,7 @@ class MobilePolicyTests(unittest.TestCase):
data = json.loads((ROOT / "src/scripts/templates/android.json").read_text())
steps = data["jobs"]["maven-deploy"]["steps"]
self.assertEqual(len(steps), 3)
raw = steps[2]["run"]["command"]
self.assertIn("python3 \\<<'PYTHON'", raw)
command = raw.replace("\\<<", "<<")
command = steps[2]["run"]["command"]
with tempfile.TemporaryDirectory() as folder:
root = Path(folder)
runner = root / "gradlew"
-44
View File
@@ -1,44 +0,0 @@
"""Exercise actual shell handling of gh error JSON, including the observed 404."""
import os
from pathlib import Path
import shutil
import subprocess
import tempfile
import textwrap
import unittest
SOURCE = Path(__file__).parents[1].joinpath('.github/workflows/qbit-release-rc.yml').read_text()
FUNCTION = textwrap.dedent(SOURCE.split(' # BEGIN RC REF LOOKUP\n')[1].split(' # END RC REF LOOKUP')[0])
@unittest.skipUnless(shutil.which('bash') and shutil.which('jq'), 'Bash and jq required')
class RefLookupTests(unittest.TestCase):
def lookup(self, body, code):
with tempfile.TemporaryDirectory() as directory:
env = dict(os.environ, BODY=body, CODE=str(code), REPO='QRun-IO/qbit-alerts', workdir=directory)
script = 'set -euo pipefail\ngh() { printf "%s" "$BODY"; return "$CODE"; }\n' + FUNCTION + '\nresult=$(read_ref tags/v0.1.0-RC.17)\nprintf "%s" "$result"\n'
return subprocess.run(['bash', '-c', script], env=env, text=True, capture_output=True)
def test_absent_tag_returns_empty_not_error_json(self):
result = self.lookup('{"message":"Not Found","documentation_url":"https://docs.github.com/rest/git/refs#get-a-reference","status":"404"}', 1)
self.assertEqual(0, result.returncode, result.stderr)
self.assertEqual('', result.stdout)
def test_existing_tag_returns_only_valid_object_sha(self):
result = self.lookup('{"object":{"sha":"' + 'a' * 40 + '"}}', 0)
self.assertEqual(0, result.returncode, result.stderr)
self.assertEqual('a' * 40, result.stdout)
def test_permission_network_and_server_errors_are_not_missing_refs(self):
for body in ('{"status":"403"}', '{"status":"500"}', '', ' ', '\n', 'not json'):
with self.subTest(body=body):
self.assertNotEqual(0, self.lookup(body, 1).returncode)
def test_malformed_success_response_is_rejected(self):
for body in ('{}', '{"object":{"sha":null}}', '{"object":{"sha":"not-a-sha"}}'):
with self.subTest(body=body):
self.assertNotEqual(0, self.lookup(body, 0).returncode)
if __name__ == '__main__':
unittest.main()
-127
View File
@@ -1,127 +0,0 @@
"""A timeout recovery must prove the original upload, not forgive a failed build."""
import copy
import unittest
from test_rc_guard import scope, SHA, OTHER, Failure, bump, status, evaluate
REPO = 'QRun-IO/qbit-alerts'
WORKFLOW = '86efe478-29d6-41a4-93f0-d74b178bf329'
DEPLOYMENT = '993e5a6d-23ce-4696-8e5a-9176ae19e670'
VERSION = '0.1.0-RC.17'
PURL = 'pkg:maven/com.kingsrook.qbits/qbit-alerts@' + VERSION
def evidence():
publisher = status('failure')['check_runs'][0]
publisher['details_url'] = 'https://app.circleci.com/workflow/' + WORKFLOW + '?utm_source=github'
job = {'username': 'QRun-IO', 'reponame': 'qbit-alerts', 'vcs_revision': SHA,
'branch': 'release/0.1', 'build_num': 148, 'status': 'failed', 'outcome': 'failed',
'start_time': '2026-10-21T00:01:00Z',
'workflows': {'workflow_name': 'publish_release_candidate',
'job_name': 'qqq-orb/mvn_publish', 'workflow_id': WORKFLOW},
'steps': [{'actions': [{'name': 'Run Maven Verify', 'status': 'success'}]},
{'actions': [{'name': 'Publish to Sonatype Central (releases and SNAPSHOTs)',
'status': 'timedout', 'timedout': True, 'step': 124, 'index': 0}]}]}
return job, publisher
def validate(job, publisher):
return scope['validate_timeout'](job, publisher, REPO, SHA, 'release/0.1', '148', '2026-10-21T00:00:00Z')
class TimeoutRecoveryTests(unittest.TestCase):
def test_exact_upload_timeout_after_successful_verify(self):
self.assertEqual((124, 0), validate(*evidence()))
def test_other_source_branch_repository_or_attempt_is_rejected(self):
for key, value in [('vcs_revision', OTHER), ('branch', 'develop'),
('username', 'untrusted'), ('reponame', 'other'), ('build_num', 149)]:
with self.subTest(key=key), self.assertRaises(Failure):
job, publisher = evidence()
job[key] = value
validate(job, publisher)
def test_non_circle_or_unrelated_workflow_cannot_authorize_recovery(self):
for key, value in [('head_sha', OTHER), ('app', {'id': 1}), ('status', 'in_progress'),
('conclusion', 'success'), ('name', 'test_only'),
('details_url', 'https://example.com/workflow/' + WORKFLOW),
('details_url', 'https://app.circleci.com/workflow/another')]:
with self.subTest(key=key, value=value), self.assertRaises(Failure):
job, publisher = evidence()
publisher[key] = value
validate(job, publisher)
def test_prior_failure_or_missing_verify_never_becomes_release_success(self):
for action in [{'name': 'Run Maven Verify', 'status': 'failed'},
{'name': 'Run Maven Verify', 'status': 'skipped'},
{'name': 'Some other build', 'status': 'success'}]:
with self.subTest(action=action), self.assertRaises(Failure):
job, publisher = evidence()
job['steps'][0]['actions'][0] = action
validate(job, publisher)
def test_only_a_terminal_deployment_timeout_is_eligible(self):
for change in [{'name': 'Run Maven Verify'}, {'timedout': False}, {'status': 'failed'},
{'step': -1}, {'index': '0'}]:
with self.subTest(change=change), self.assertRaises(Failure):
job, publisher = evidence()
job['steps'][-1]['actions'][0].update(change)
validate(job, publisher)
def test_failed_later_git_push_is_not_an_upload_timeout(self):
job, publisher = evidence()
job['steps'].append({'actions': [{'name': 'Commit version', 'status': 'failed'}]})
with self.assertRaises(Failure):
validate(job, publisher)
def test_publisher_cannot_predate_the_cut(self):
job, publisher = evidence()
job['start_time'] = '2026-10-20T23:59:00Z'
with self.assertRaises(Failure):
validate(job, publisher)
def test_receipt_requires_one_upload_and_expected_staged_coordinates(self):
log = ('[INFO] Installing x to /home/circleci/project/target/central-staging/'
'com/kingsrook/qbits/qbit-alerts/' + VERSION + '/qbit-alerts-' + VERSION + '.pom\n'
'[INFO] Uploaded bundle successfully, deployment name: Deployment, deploymentId: '
+ DEPLOYMENT + '. Deployment will publish automatically\n')
self.assertEqual((DEPLOYMENT, [PURL]), scope['upload_receipt'](log, 'qbit-alerts', VERSION))
for invalid in [log + log, log.replace('Uploaded bundle successfully', 'Upload failed'),
log.replace('qbit-alerts', 'qbit-other'), log.replace(VERSION, '0.1.0-RC.16')]:
with self.subTest(invalid=invalid), self.assertRaises(Failure):
scope['upload_receipt'](invalid, 'qbit-alerts', VERSION)
def test_central_must_confirm_the_exact_receipt_and_all_coordinates(self):
result = {'deploymentId': DEPLOYMENT, 'deploymentState': 'PUBLISHED', 'purls': [PURL]}
scope['validate_deployment'](result, DEPLOYMENT, [PURL])
for key, value in [('deploymentId', 'other'), ('deploymentState', 'PUBLISHING'),
('deploymentState', 'FAILED'), ('purls', []), ('purls', [PURL, 'other'])]:
with self.subTest(key=key, value=value), self.assertRaises(Failure):
invalid = copy.deepcopy(result)
invalid[key] = value
scope['validate_deployment'](invalid, DEPLOYMENT, [PURL])
def test_retry_bump_cannot_hide_other_source_changes(self):
source = '<project><revision>0.1.0-RC.16</revision><name>Alerts</name></project>'
actual = source.replace('0.1.0-RC.16', VERSION)
commit = bump(version=VERSION)
commit['files'] = [{'filename': 'pom.xml', 'status': 'modified'}]
scope['validate_recovery_bump'](commit, source, actual, VERSION, SHA)
for changed in [actual.replace('Alerts', 'Other'), actual + '<extra/>', source]:
with self.subTest(changed=changed), self.assertRaises(Failure):
scope['validate_recovery_bump'](commit, source, changed, VERSION, SHA)
commit['files'].append({'filename': 'other.java', 'status': 'modified'})
with self.assertRaises(Failure):
scope['validate_recovery_bump'](commit, source, actual, VERSION, SHA)
def test_recovery_still_requires_exact_bump_parent_and_verified_version(self):
self.assertEqual(VERSION, evaluate(SHA, status('failure'), bump(version=VERSION), VERSION))
for commit in [bump(parent=OTHER, version=VERSION), bump(version='0.1.0-RC.18')]:
with self.subTest(commit=commit), self.assertRaises(Failure):
evaluate(SHA, status('failure'), commit, VERSION)
with self.assertRaises(Failure):
evaluate(SHA, status('failure'), bump(version=VERSION))
if __name__ == '__main__':
unittest.main()
-109
View File
@@ -1,109 +0,0 @@
"""Version rollouts preserve policy and reject drift before changing any repo."""
import importlib.util
from pathlib import Path
import tempfile
import unittest
import yaml
spec = importlib.util.spec_from_file_location('rollout', Path(__file__).resolve().parents[1] / 'tools/rollout_version.py')
rollout = importlib.util.module_from_spec(spec)
spec.loader.exec_module(rollout)
class RolloutTests(unittest.TestCase):
def setUp(self):
self.temp = tempfile.TemporaryDirectory()
self.addCleanup(self.temp.cleanup)
self.root = Path(self.temp.name)
def checkout(self, name, profile='qbit', explicit=False, **policy):
root = self.root / name
(root / '.circleci').mkdir(parents=True)
manifest = {'profile': profile, 'orb_version': '0.7.4', 'default_branch': 'develop', **policy}
caller = rollout.standard.canonical_caller(profile, '0.7.4', explicit_manifest=explicit,
release_tag_policy=manifest.get('release_tag_policy'))
(root / '.qqq-ci.yml').write_text(yaml.safe_dump(manifest), encoding='utf-8')
(root / '.circleci/config.yml').write_text(yaml.safe_dump(caller), encoding='utf-8')
return root
def contents(self, root):
return [(root / path).read_bytes() for path in ('.circleci/config.yml', '.qqq-ci.yml')]
def test_batch_preserves_opt_outs_filters_contexts_and_forwarded_parameters(self):
qbit = self.checkout('qbit', release_tag_policy='none', release_on_main=False,
test_branch_policy='feature', browsers=False,
publish={'snapshot': False, 'release_candidate': False, 'release': False})
core = self.checkout('core', profile='core', explicit=True)
cli = self.checkout('cli', profile='cli', publish={'release': True}, publish_context='npm-publisher')
roots = [qbit, core, cli]
originals = [yaml.safe_load((root / '.qqq-ci.yml').read_text()) for root in roots]
results = rollout.rollout(roots, '0.7.11', write=True)
self.assertTrue(all(result['changed'] for result in results))
for root, original in zip(roots, originals):
expected = {**original, 'orb_version': '0.7.11'}
self.assertEqual(expected, yaml.safe_load((root / '.qqq-ci.yml').read_text()))
rollout.standard.validate(*(data.decode() for data in self.contents(root)), '0.7.11')
rollout.pipeline.load_manifest(root / '.qqq-ci.yml', '0.7.11')
core_caller = yaml.safe_load((core / '.circleci/config.yml').read_text())
options = core_caller['workflows']['setup']['jobs'][0]['qqq-orb/generate_pipeline']
self.assertEqual('.qqq-ci.yml', options['manifest'])
self.assertEqual('<< pipeline.parameters.mongo_bind_diagnostics >>', options['mongo_bind_diagnostics'])
def test_all_supported_profiles_remain_valid_after_the_same_batch_upgrade(self):
roots = [self.checkout(profile, profile=profile, default_branch='main') for profile in rollout.standard.PROFILE_PARAMETERS]
results = rollout.rollout(roots, '0.7.11', write=True)
self.assertEqual(set(rollout.standard.PROFILE_PARAMETERS), {item['profile'] for item in results})
for root in roots:
rollout.pipeline.load_manifest(root / '.qqq-ci.yml', '0.7.11')
rollout.standard.validate(*(data.decode() for data in self.contents(root)), '0.7.11')
def test_dry_run_and_repeated_application_do_not_rewrite_files(self):
root = self.checkout('qbit')
before = self.contents(root)
self.assertTrue(rollout.rollout([root], '0.7.11')[0]['changed'])
self.assertEqual(before, self.contents(root))
rollout.rollout([root], '0.7.11', write=True)
applied = self.contents(root)
self.assertFalse(rollout.rollout([root], '0.7.11', write=True)[0]['changed'])
self.assertEqual(applied, self.contents(root))
def test_one_custom_caller_rejects_entire_batch_before_any_write(self):
good = self.checkout('good')
bad = self.checkout('bad')
before = self.contents(good)
with (bad / '.circleci/config.yml').open('a') as stream:
stream.write('\njobs: {custom: {steps: [checkout]}}\n')
with self.assertRaises(ValueError):
rollout.rollout([good, bad], '0.7.11', write=True)
self.assertEqual(before, self.contents(good))
def test_duplicate_manifest_keys_unknown_settings_and_mismatched_pins_are_rejected(self):
for suffix in ['orb_version: 0.7.4\n', 'unknown_setting: true\n', 'publish: {release: maybe}\n']:
with self.subTest(suffix=suffix):
root = self.checkout(str(len(list(self.root.iterdir()))))
with (root / '.qqq-ci.yml').open('a') as stream:
stream.write(suffix)
before = self.contents(root)
with self.assertRaises(ValueError):
rollout.rollout([root], '0.7.11', write=True)
self.assertEqual(before, self.contents(root))
root = self.checkout('mismatch')
path = root / '.circleci/config.yml'
path.write_text(path.read_text().replace('0.7.4', '0.7.3'))
with self.assertRaises(ValueError):
rollout.rollout([root], '0.7.11', write=True)
def test_invalid_target_and_duplicate_checkout_are_rejected(self):
root = self.checkout('qbit')
before = self.contents(root)
for version in ['latest', 'dev:test', '0.7', '0.7.11\n']:
with self.assertRaises(ValueError):
rollout.rollout([root], version, write=True)
with self.assertRaises(ValueError):
rollout.rollout([root, root], '0.7.11', write=True)
self.assertEqual(before, self.contents(root))
if __name__ == '__main__':
unittest.main()
+1 -1
View File
@@ -42,7 +42,7 @@ PROFILES = {'qqq': 'core', 'qqq-frontend-material-dashboard': 'frontend-material
'qqq-android': 'android', 'qqq-mcp-rag-standard-policies': 'mcp-policy',
'marketing-website': 'marketing', 'qqq-mcp-rag': 'native-mcp',
'qqq-business-platform': 'native-business', '.github': 'native-workflow-lint',
'qqq-orb': 'owner-bootstrap', 'marketing-website-cd': 'native-gitops'}
'qqq-orb': 'owner-bootstrap'}
NO_CI = json.loads((ROOT / 'tools/no-ci-policy.json').read_text(encoding='utf-8'))
-92
View File
@@ -1,92 +0,0 @@
#!/usr/bin/env python3
"""Upgrade canonical CircleCI callers in one batch; dry-run unless --write.
Only the orb pin changes. Repository publication policy and profile parameters
are preserved. Git commits, pushes and hosted verification remain separate.
"""
import argparse
import importlib.util
import json
from pathlib import Path
import re
import sys
import yaml
ROOT = Path(__file__).resolve().parents[1]
def module(name):
spec = importlib.util.spec_from_file_location(name, ROOT / 'src/scripts' / (name + '.py'))
result = importlib.util.module_from_spec(spec)
spec.loader.exec_module(result)
return result
standard = module('validate_standard')
pipeline = module('generate_pipeline')
def plan(checkout, version):
root = Path(checkout).resolve(strict=True)
paths = [root / '.circleci/config.yml', root / '.qqq-ci.yml']
if any(not path.resolve(strict=True).is_relative_to(root) for path in paths):
raise ValueError('CI declarations must remain inside their checkout')
originals = [path.read_bytes() for path in paths]
caller_raw, manifest_raw = [data.decode('utf-8') for data in originals]
manifest = standard.load_yaml(manifest_raw)
if not isinstance(manifest, dict):
raise ValueError('Existing manifest must be a mapping')
previous = manifest.get('orb_version')
standard.validate(caller_raw, manifest_raw, previous)
pipeline.load_manifest(paths[1], previous)
caller = standard.load_yaml(caller_raw)
if previous == version:
replacements = originals
else:
manifest['orb_version'] = version
caller['orbs']['qqq-orb'] = 'kingsrook/qqq-orb@' + version
caller['workflows']['setup']['jobs'][0]['qqq-orb/generate_pipeline']['orb_version'] = version
new_caller = yaml.safe_dump(caller, sort_keys=False)
new_manifest = yaml.safe_dump(manifest, sort_keys=False)
standard.validate(new_caller, new_manifest, version)
replacements = [new_caller.encode('utf-8'), new_manifest.encode('utf-8')]
return {'checkout': str(root), 'profile': manifest['profile'], 'from': previous, 'to': version,
'files': list(zip(paths, originals, replacements))}
def rollout(checkouts, version, write=False):
if not re.fullmatch(r'\d+\.\d+\.\d+', version):
raise ValueError('Fleet upgrades require an explicit stable orb version')
# Validate the entire batch before writing any repository.
plans = [plan(path, version) for path in checkouts]
if len({item['checkout'] for item in plans}) != len(plans):
raise ValueError('Each checkout may appear only once')
if write:
for item in plans:
for path, original, replacement in item['files']:
if path.read_bytes() != original:
raise ValueError('CI declaration changed after preflight; rerun the rollout')
for item in plans:
for path, original, replacement in item['files']:
if replacement != original:
path.write_bytes(replacement)
return [{**{key: value for key, value in item.items() if key != 'files'},
'changed': any(old != new for _, old, new in item['files']), 'written': write}
for item in plans]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('checkouts', nargs='+', type=Path)
parser.add_argument('--orb-version', required=True)
parser.add_argument('--write', action='store_true')
args = parser.parse_args()
print(json.dumps(rollout(args.checkouts, args.orb_version, args.write), indent=2))
if __name__ == '__main__':
try:
main()
except (ValueError, OSError) as error:
sys.exit('Version rollout rejected: ' + str(error))
+2 -2
View File
@@ -2,7 +2,7 @@
"""Replace audited standard QBit pipelines with the canonical orb caller.
Only modifies the two CI declarations in a supplied checkout. Git operations and
publication remain separate. Unknown jobs/options fail closed for central profile resolution.
publication remain separate. Unknown jobs/options fail closed for human review.
"""
import argparse
from pathlib import Path
@@ -158,7 +158,7 @@ def main():
manifest_path = args.checkout / ".qqq-ci.yml"
config = yaml.safe_load(config_path.read_text(encoding="utf-8"))
if manifest_path.exists():
raise ValueError("Already has a manifest; use tools/rollout_version.py")
raise ValueError("Already has a manifest; use the version rollout operation")
manifest = infer_manifest(config, args.orb_version, args.default_branch)
caller = canonical_caller(args.orb_version, manifest["release_tag_policy"])
if args.write: