Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8160559838
|
||
|
|
5e9bbb54ec | ||
|
|
5bcec90e33 | ||
|
|
a50b07d927 | ||
|
|
6318d90e96 | ||
|
|
a6fea661ff | ||
|
|
2894bae29a | ||
|
|
a14e8f9b24 | ||
|
|
83611872a3 | ||
|
|
30c4e0e85c | ||
|
|
f429d9f3c4 | ||
|
|
8c994aa824 | ||
|
|
344a3f7665
|
||
|
|
cec106ce30 | ||
|
|
ba6a3c6f92
|
||
|
|
43144c974b | ||
|
|
6806de4892
|
||
|
|
a9d51ebd47 | ||
|
|
284c69aa3e
|
||
|
|
fb30d9acc5
|
||
|
|
563f88bdad | ||
|
|
4cb662f076
|
||
|
|
a2cdd818f6 | ||
|
|
42e0be02c9
|
||
|
|
b71c9ca4d7
|
||
|
|
7dd5f38d35 | ||
|
|
02c14d7237
|
No files matched your search
@@ -22,6 +22,15 @@ 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:
|
||||
@@ -40,6 +49,7 @@ 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,7 +71,9 @@ jobs:
|
||||
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
|
||||
@@ -147,13 +159,15 @@ workflows:
|
||||
filters: *filters
|
||||
- pipeline-contract-test:
|
||||
filters: *filters
|
||||
- maven-publication-contract:
|
||||
filters: *filters
|
||||
# Auto-publish dev snapshot on develop
|
||||
- publish-dev-snapshot:
|
||||
context: orb-publishing
|
||||
filters: *develop-filters
|
||||
requires: [command-test, pipeline-contract-test]
|
||||
requires: [command-test, pipeline-contract-test, maven-publication-contract]
|
||||
# Auto-publish production release on main
|
||||
- publish-production:
|
||||
context: orb-publishing
|
||||
filters: *main-filters
|
||||
requires: [command-test, pipeline-contract-test]
|
||||
requires: [command-test, pipeline-contract-test, maven-publication-contract]
|
||||
@@ -3,3 +3,4 @@
|
||||
*.py text eol=lf
|
||||
*.yml text eol=lf
|
||||
*.yaml text eol=lf
|
||||
*.json text eol=lf
|
||||
@@ -0,0 +1,38 @@
|
||||
name: GitOps validation
|
||||
'on':
|
||||
workflow_call:
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Install verified Kustomize
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
tool_dir="$RUNNER_TEMP/qqq-kustomize"
|
||||
mkdir -p "$tool_dir"
|
||||
curl --fail --silent --show-error --location --retry 2 --max-time 60 \
|
||||
https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v5.7.1/kustomize_v5.7.1_linux_amd64.tar.gz \
|
||||
--output "$tool_dir/kustomize.tar.gz"
|
||||
echo "ea375e7372f9aa029129d4b2d16c66b7750b7f1213c4f66f910d981c895818d8 $tool_dir/kustomize.tar.gz" | sha256sum --check --status
|
||||
tar -xzf "$tool_dir/kustomize.tar.gz" -C "$tool_dir" kustomize
|
||||
echo "$tool_dir" >> "$GITHUB_PATH"
|
||||
- name: Render every Kustomization
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mapfile -d '' manifests < <(find . -path './.git' -prune -o -type f \( -name kustomization.yaml -o -name kustomization.yml -o -name Kustomization \) -print0)
|
||||
if (( ${#manifests[@]} == 0 )); then
|
||||
echo 'No Kustomization found' >&2
|
||||
exit 1
|
||||
fi
|
||||
for manifest in "${manifests[@]}"; do
|
||||
directory=$(dirname "$manifest")
|
||||
# Rendered Secrets must never enter logs or uploaded artifacts.
|
||||
kustomize build "$directory" >/dev/null
|
||||
printf 'Validated %s\n' "$directory"
|
||||
done
|
||||
@@ -12,7 +12,7 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
smoke_evidence:
|
||||
description: github (legacy default) or circle (requires consumer adapter and Circle credential)
|
||||
description: github (legacy default) or circle (public API evidence; optional credential)
|
||||
type: string
|
||||
default: github
|
||||
circle_workflow_id:
|
||||
@@ -494,9 +494,12 @@ jobs:
|
||||
|
||||
def circle(path):
|
||||
token = os.environ.get('CIRCLECI_TOKEN')
|
||||
require(token, 'CIRCLECI_TOKEN is required for Circle evidence mode')
|
||||
# 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={'Circle-Token': token, 'Accept': 'application/json'})
|
||||
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')
|
||||
|
||||
@@ -58,6 +58,7 @@ 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
|
||||
@@ -79,7 +80,9 @@ test-pipelines: pack
|
||||
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
|
||||
@@ -207,3 +210,9 @@ 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
|
||||
@@ -65,3 +65,29 @@ actionlint .github/workflows/workflow-lint.yml
|
||||
Tests cover exact no-CI allowlists and drift, unknown repositories, missing configured
|
||||
profiles/native bridges, retained legacy workflows, bootstrap dependency/gate removal,
|
||||
required-check unknown states, and the lint image/tool/command/caller contract.
|
||||
|
||||
## Batch orb-version rollout
|
||||
|
||||
Upgrade existing canonical CircleCI consumers with one command:
|
||||
|
||||
```sh
|
||||
python tools/rollout_version.py --orb-version 0.7.11 /checkouts/qbit-one /checkouts/qqq-cli
|
||||
python tools/rollout_version.py --orb-version 0.7.11 --write /checkouts/qbit-one /checkouts/qqq-cli
|
||||
```
|
||||
|
||||
The first command previews the batch. The second updates only `.qqq-ci.yml` and
|
||||
`.circleci/config.yml`, after every supplied checkout passes the existing manifest
|
||||
and canonical-caller validators. It preserves publication opt-outs, release filters,
|
||||
credential context names and forwarded profile parameters. Already-current files
|
||||
are unchanged. Duplicate checkouts, custom jobs, invalid options and mismatched
|
||||
pins reject the batch before writing; resolve these in the central profile first.
|
||||
|
||||
Use isolated checkouts of the intended repository heads, inspect the resulting
|
||||
patches, then commit and push through the normal automated gates. The tool does not
|
||||
commit, push, publish packages, change GitHub rules or modify native/RC worker pins.
|
||||
A version update does not prove a publication succeeded: retain exact-head hosted
|
||||
verification and artifact evidence. The requested version must already be published.
|
||||
|
||||
```sh
|
||||
python3 -m unittest discover -s tests -p test_rollout_version.py
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
# GitOps validation
|
||||
|
||||
The orb owns `.github/workflows/gitops.yml`. The consumer keeps only the immutable caller generated by `generate_auxiliary_workflow.py gitops --ref <orb-commit>` at `.github/workflows/validate.yml`.
|
||||
|
||||
One native job downloads Kustomize 5.7.1 with its pinned official SHA-256 and renders every Kustomization, including bases, overlays and proxy declarations. Missing configurations or a failed render fail the job. Rendered resources are discarded rather than logged or uploaded because they may contain Secrets. This checks rendering, not Kubernetes schema compatibility or cluster health. No cluster access or publication credentials are required.
|
||||
|
||||
The caller runs on main pushes and pull requests without path filters, so a required check always reports. Superseded PR runs are canceled. Feature pushes do not create duplicate jobs. Remove the old Circle pipeline only after the native job passes on the consumer, then disable obsolete Circle build requests and require the observed native check with no human review.
|
||||
|
||||
For marketing-website-cd, the prior Circle job only printed Hello World. Its former production role moved to KofTwentyTwo/cluster-gitops; validation does not re-enable that retired deployment path.
|
||||
@@ -1,9 +1,8 @@
|
||||
description: >
|
||||
Publishes artifacts to Maven Central (Sonatype Central Portal)
|
||||
- Restores Maven dependency cache
|
||||
- Debugs Maven settings to verify configuration
|
||||
- Configures Maven credentials without logging settings
|
||||
- Sets up GPG signing for artifact verification
|
||||
- Deploys signed artifacts to Maven Central using release profile
|
||||
- Deploys signed artifacts and waits for confirmed Central release publication
|
||||
- Saves Maven cache for future builds
|
||||
|
||||
steps:
|
||||
@@ -15,6 +14,9 @@ steps:
|
||||
command: <<include(scripts/mvn_jar_deploy_gpg_setup.sh)>>
|
||||
- run:
|
||||
name: Publish to Sonatype Central (releases and SNAPSHOTs)
|
||||
# Central's native publication wait can be silent for its 30-minute limit.
|
||||
# Let Maven return its real result before CircleCI's inactivity watchdog.
|
||||
no_output_timeout: 35m
|
||||
command: <<include(scripts/mvn_jar_deploy.sh)>>
|
||||
- save_cache:
|
||||
paths:
|
||||
|
||||
@@ -208,50 +208,73 @@ REQUEST_BODY=$(jq -n \
|
||||
generate_release_notes: true
|
||||
}')
|
||||
|
||||
# Create the release with retry logic
|
||||
MAX_RETRIES=2
|
||||
RETRY_COUNT=0
|
||||
|
||||
while [[ $RETRY_COUNT -lt $MAX_RETRIES ]]; do
|
||||
HTTP_RESPONSE=$(curl -s -w "\n%{http_code}" -X POST \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$REQUEST_BODY" \
|
||||
"$API_URL")
|
||||
|
||||
HTTP_BODY=$(echo "$HTTP_RESPONSE" | sed '$d')
|
||||
HTTP_CODE=$(echo "$HTTP_RESPONSE" | tail -n1)
|
||||
|
||||
if [[ "$HTTP_CODE" -ge 200 ]] && [[ "$HTTP_CODE" -lt 300 ]]; then
|
||||
RELEASE_URL=$(echo "$HTTP_BODY" | jq -r '.html_url')
|
||||
echo "GitHub release created successfully: $RELEASE_URL"
|
||||
exit 0
|
||||
elif [[ "$HTTP_CODE" -ge 500 ]]; then
|
||||
echo "Server error (HTTP $HTTP_CODE), retrying..."
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
sleep 2
|
||||
elif [[ "$HTTP_CODE" == "422" ]]; then
|
||||
# Check if release already exists
|
||||
if echo "$HTTP_BODY" | grep -q "already_exists"; then
|
||||
echo "Release for $TAG_NAME already exists, skipping"
|
||||
exit 0
|
||||
else
|
||||
echo "ERROR: GitHub API returned HTTP $HTTP_CODE"
|
||||
echo "$HTTP_BODY"
|
||||
# Don't fail the build - artifacts are already published
|
||||
echo "WARNING: GitHub release creation failed, but artifacts are published"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
echo "ERROR: GitHub API returned HTTP $HTTP_CODE"
|
||||
echo "$HTTP_BODY"
|
||||
# Don't fail the build - artifacts are already published
|
||||
echo "WARNING: GitHub release creation failed, but artifacts are published"
|
||||
exit 0
|
||||
# Keep response bodies private: errors can contain repository details or echoed input.
|
||||
request_release() {
|
||||
local method="$1" url="$2"
|
||||
local args=(-s --connect-timeout 10 --max-time 60 -w "\n%{http_code}" -X "$method"
|
||||
-H "Accept: application/vnd.github.v3+json"
|
||||
-H "Authorization: token $GITHUB_TOKEN")
|
||||
if [[ "$method" == POST ]]; then
|
||||
args+=(-H "Content-Type: application/json" -d "$REQUEST_BODY")
|
||||
fi
|
||||
done
|
||||
if ! HTTP_RESPONSE=$(curl "${args[@]}" "$url"); then
|
||||
echo "ERROR: GitHub release request failed at the transport layer"
|
||||
return 1
|
||||
fi
|
||||
HTTP_BODY=$(printf '%s\n' "$HTTP_RESPONSE" | sed '$d')
|
||||
HTTP_CODE=$(printf '%s\n' "$HTTP_RESPONSE" | tail -n1)
|
||||
if [[ ! "$HTTP_CODE" =~ ^[0-9]{3}$ ]]; then
|
||||
echo "ERROR: GitHub release request returned an invalid HTTP status"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
echo "WARNING: GitHub release creation failed after $MAX_RETRIES retries"
|
||||
echo "Artifacts are published, continuing..."
|
||||
exit 0
|
||||
same_published_tag() {
|
||||
jq -e --arg tag "$TAG_NAME" '.tag_name == $tag and .draft == false' \
|
||||
<<< "$HTTP_BODY" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
MAX_ATTEMPTS=2
|
||||
for ((attempt=1; attempt<=MAX_ATTEMPTS; attempt++)); do
|
||||
request_release POST "$API_URL"
|
||||
case "$HTTP_CODE" in
|
||||
2??)
|
||||
if ! same_published_tag; then
|
||||
echo "ERROR: GitHub release response did not confirm the requested published tag"
|
||||
exit 1
|
||||
fi
|
||||
echo "GitHub release created successfully for $TAG_NAME"
|
||||
exit 0
|
||||
;;
|
||||
5??)
|
||||
if [[ "$attempt" -lt "$MAX_ATTEMPTS" ]]; then
|
||||
echo "GitHub server error (HTTP $HTTP_CODE); retrying release creation"
|
||||
sleep 2
|
||||
else
|
||||
echo "ERROR: GitHub release creation failed after $MAX_ATTEMPTS attempts (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
422)
|
||||
# A validation failure is not proof that this release already exists.
|
||||
if ! jq -e 'any(.errors[]?; .resource == "Release" and .field == "tag_name" and .code == "already_exists")' \
|
||||
<<< "$HTTP_BODY" >/dev/null 2>&1; then
|
||||
echo "ERROR: GitHub release creation rejected (HTTP 422)"
|
||||
exit 1
|
||||
fi
|
||||
ENCODED_TAG=$(jq -nr --arg tag "$TAG_NAME" '$tag | @uri')
|
||||
request_release GET "$API_URL/tags/$ENCODED_TAG"
|
||||
if [[ "$HTTP_CODE" != 200 ]] || ! same_published_tag; then
|
||||
echo "ERROR: Existing GitHub release could not be verified for the requested published tag (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
fi
|
||||
echo "Published GitHub release for $TAG_NAME already exists; verified"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: GitHub release creation failed (HTTP $HTTP_CODE)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
exit 1
|
||||
@@ -25,4 +25,12 @@ set -e
|
||||
##############################################
|
||||
## Deploy signed artifacts to Maven Central ##
|
||||
##############################################
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -P release -B -DskipTests -Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" deploy
|
||||
# Resolve CI-friendly coordinates without stripping parent/BOM configuration.
|
||||
# Flatten must share this Maven process so deploy uses the resolved project POMs.
|
||||
# Central 0.8.x: this completion flag overrides inherited literal waitUntil=uploaded.
|
||||
# Do not report a release as successful until Central confirms publication.
|
||||
mvn -s /tmp/circleci/mvn-settings.xml -P release -B -DskipTests \
|
||||
-Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \
|
||||
-DwaitForPublishCompletion=true \
|
||||
-Dflatten.mode=resolveCiFriendliesOnly -DupdatePomFile=true \
|
||||
org.codehaus.mojo:flatten-maven-plugin:1.7.3:flatten deploy
|
||||
@@ -1,26 +1,10 @@
|
||||
#!/bin/bash
|
||||
# Collect unit and integration JUnit reports without losing same-named module suites.
|
||||
set -euo pipefail
|
||||
|
||||
############################################################################
|
||||
## mvn_verify_save_test_results.sh
|
||||
## Test Results Collection Script
|
||||
##
|
||||
## This script collects JUnit test results from Maven Surefire reports
|
||||
## and saves them to the CircleCI test results directory for reporting.
|
||||
## It finds all XML test result files and copies them to the standard location.
|
||||
##
|
||||
## Process:
|
||||
## 1. Creates test results directory structure
|
||||
## 2. Finds all Surefire XML report files
|
||||
## 3. Copies test results to CircleCI test results directory
|
||||
##
|
||||
## Usage: Called by CircleCI orb command mvn_verify
|
||||
## Output: Collects and saves JUnit test results for CircleCI reporting
|
||||
############################################################################
|
||||
|
||||
set -e
|
||||
|
||||
#############################################################
|
||||
## Create test results directory and collect JUnit reports ##
|
||||
#############################################################
|
||||
mkdir -p ~/test-results/junit/
|
||||
find . -type f -regex ".*/target/surefire-reports/.*xml" -exec cp {} ~/test-results/junit/ \;
|
||||
mkdir -p "$HOME/test-results/junit"
|
||||
while IFS= read -r -d '' report; do
|
||||
destination="$HOME/test-results/junit/${report#./}"
|
||||
mkdir -p "$(dirname "$destination")"
|
||||
cp "$report" "$destination"
|
||||
done < <(find . -type f \( -path '*/target/surefire-reports/TEST-*.xml' -o -path '*/target/failsafe-reports/TEST-*.xml' \) -print0)
|
||||
@@ -18,13 +18,13 @@ import base64
|
||||
import zlib
|
||||
CORE_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtPdl22ziy7/0VuOrM2M6IpPclifvcxHbfeCar48z0nChXByJBiW1uJig7Oonn26cKACmKIiVSluUlTr/IJFAo1F6FAvv7L4Q0LljEncBvPCPr+loTn4Q0o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L8jhYaU9AupM4hgBXCChcWa6qKUPNgXqMjny69frlRzCfMkQE2fSVotLFmrkFdZN7G5dwDuUG3tVCQ2h4lC6ui2ju13wacQ0LQdZgmKJ8nOoRPrGXBvETmEdnwK79KadI+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+avg1kojfXLc6wUxaXmHrmvbvgLWNtQgmaE4h5bW8X6quUNmctfRdREPykC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5NnuCSUmx3ilkKxcWB8hr5w653z69PH4v/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("eNrtV21v2jAQ/s6vsKJ92KomdFSbptKhIoGqfugL0K6aRoWMY4LbxE5tp4BQ9tt3TgJJeGtXbVI17Vty57t77rmXOPMKQtYTlYoJbh2hmvNx30iEHCp4ncMzvGHuSsFcEFiESeJTwqqZ7KTmfHIOrP30oEdCm/isdDCTnRw6Nadmwbk4iXAvihEizrStqdJLEQjplJJIC1mQgZTj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gf0Hgnpc+w==")))
|
||||
|
||||
|
||||
class ManifestError(ValueError):
|
||||
|
||||
@@ -86,14 +86,8 @@
|
||||
"android/restore-gradle-cache",
|
||||
{
|
||||
"run": {
|
||||
"name": "Write credentials to gradle.properties",
|
||||
"command": "echo \"\" >> gradle.properties\necho \"githubQqqMavenRegistryUsername=${QQQ_ANDROID_MAVEN_REGISTRY_USERNAME}\" >> gradle.properties\necho \"githubQqqMavenRegistryPassword=${QQQ_ANDROID_MAVEN_REGISTRY_PASSWORD}\" >> gradle.properties\n"
|
||||
}
|
||||
},
|
||||
{
|
||||
"run": {
|
||||
"name": "Publish (Deploy) to Maven",
|
||||
"command": "./gradlew publishMavenPublicationToGithubQqqMavenRegistryRepository\n"
|
||||
"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"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -116,7 +110,10 @@
|
||||
"branches": {
|
||||
"only": "main"
|
||||
}
|
||||
}
|
||||
},
|
||||
"context": [
|
||||
"qqq-maven-registry-credentials"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
"on": {
|
||||
"push": {
|
||||
"branches": [
|
||||
"**"
|
||||
"main"
|
||||
]
|
||||
},
|
||||
"pull_request": {
|
||||
@@ -198,20 +198,10 @@
|
||||
"caller": {
|
||||
"name": "Database migrations",
|
||||
"on": {
|
||||
"pull_request": {
|
||||
"paths": [
|
||||
"db/**",
|
||||
"pom.xml",
|
||||
".github/workflows/db-migrations.yml"
|
||||
]
|
||||
},
|
||||
"pull_request": {},
|
||||
"push": {
|
||||
"branches": [
|
||||
"main"
|
||||
],
|
||||
"paths": [
|
||||
"db/**",
|
||||
"pom.xml"
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -222,6 +212,10 @@
|
||||
"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' }}"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -262,11 +256,6 @@
|
||||
"main"
|
||||
]
|
||||
},
|
||||
"schedule": [
|
||||
{
|
||||
"cron": "17 6 * * *"
|
||||
}
|
||||
],
|
||||
"workflow_dispatch": null
|
||||
},
|
||||
"permissions": {
|
||||
@@ -274,7 +263,7 @@
|
||||
},
|
||||
"concurrency": {
|
||||
"group": "e2e-${{ github.ref }}",
|
||||
"cancel-in-progress": true
|
||||
"cancel-in-progress": "${{ github.event_name == 'pull_request' }}"
|
||||
},
|
||||
"jobs": {
|
||||
"validate": {
|
||||
@@ -318,7 +307,7 @@
|
||||
"smoke_evidence": {
|
||||
"description": "Evidence provider; github preserves the original Smoke workflow validation",
|
||||
"type": "choice",
|
||||
"default": "github",
|
||||
"default": "circle",
|
||||
"options": [
|
||||
"github",
|
||||
"circle"
|
||||
@@ -407,5 +396,36 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
"name": "build-and-test",
|
||||
"node_version": "22",
|
||||
"package_manager": "npm",
|
||||
"test_commands": "[ \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\" ]",
|
||||
"test_commands": "[\"npm run lint\", \"npm run build\", \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\"]",
|
||||
"context": [
|
||||
"github"
|
||||
],
|
||||
@@ -137,7 +137,7 @@
|
||||
"name": "build-and-test",
|
||||
"node_version": "22",
|
||||
"package_manager": "npm",
|
||||
"test_commands": "[ \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\" ]",
|
||||
"test_commands": "[\"npm run lint\", \"npm run build\", \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\"]",
|
||||
"context": [
|
||||
"github"
|
||||
],
|
||||
@@ -252,7 +252,7 @@
|
||||
"name": "build-and-test",
|
||||
"node_version": "22",
|
||||
"package_manager": "npm",
|
||||
"test_commands": "[ \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\" ]",
|
||||
"test_commands": "[\"npm run lint\", \"npm run build\", \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\"]",
|
||||
"context": [
|
||||
"github"
|
||||
],
|
||||
@@ -367,7 +367,7 @@
|
||||
"name": "build-and-test",
|
||||
"node_version": "22",
|
||||
"package_manager": "npm",
|
||||
"test_commands": "[ \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\" ]",
|
||||
"test_commands": "[\"npm run lint\", \"npm run build\", \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\"]",
|
||||
"context": [
|
||||
"github"
|
||||
],
|
||||
@@ -514,7 +514,7 @@
|
||||
"name": "build-and-test",
|
||||
"node_version": "22",
|
||||
"package_manager": "npm",
|
||||
"test_commands": "[ \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\" ]",
|
||||
"test_commands": "[\"npm run lint\", \"npm run build\", \"npx playwright install chromium --with-deps\", \"npm run test:chromium\", \"npm run lighthouse\"]",
|
||||
"context": [
|
||||
"github"
|
||||
],
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
{
|
||||
"run": {
|
||||
"name": "Validate pattern files",
|
||||
"command": "python3 << 'EOF'\nimport yaml\nimport sys\nfrom pathlib import Path\n\nerrors = []\npattern_count = 0\n\nfor yaml_file in Path('.').rglob('*.yaml'):\n if any(part.startswith('.') for part in yaml_file.parts):\n continue\n\n try:\n with open(yaml_file) as f:\n data = yaml.safe_load(f)\n\n if 'patterns/' in str(yaml_file):\n required = ['id', 'title', 'category', 'description', 'content']\n missing = [f for f in required if f not in data]\n if missing:\n errors.append(f\"{yaml_file}: Missing fields: {missing}\")\n pattern_count += 1\n\n except yaml.YAMLError as e:\n errors.append(f\"{yaml_file}: YAML parse error: {e}\")\n except Exception as e:\n errors.append(f\"{yaml_file}: Error: {e}\")\n\nprint(f\"Validated {pattern_count} pattern files\")\n\nif errors:\n print(\"\\nErrors found:\")\n for e in errors:\n print(f\" - {e}\")\n sys.exit(1)\nelse:\n print(\"All patterns valid\")\nEOF\n"
|
||||
"command": "python3 \\<< 'EOF'\nimport yaml\nimport sys\nfrom pathlib import Path\n\nerrors = []\npattern_count = 0\n\nfor yaml_file in Path('.').rglob('*.yaml'):\n if any(part.startswith('.') for part in yaml_file.parts):\n continue\n\n try:\n with open(yaml_file) as f:\n data = yaml.safe_load(f)\n\n if 'patterns/' in str(yaml_file):\n required = ['id', 'title', 'category', 'description', 'content']\n missing = [f for f in required if f not in data]\n if missing:\n errors.append(f\"{yaml_file}: Missing fields: {missing}\")\n pattern_count += 1\n\n except yaml.YAMLError as e:\n errors.append(f\"{yaml_file}: YAML parse error: {e}\")\n except Exception as e:\n errors.append(f\"{yaml_file}: Error: {e}\")\n\nprint(f\"Validated {pattern_count} pattern files\")\n\nif errors:\n print(\"\\nErrors found:\")\n for e in errors:\n print(f\" - {e}\")\n sys.exit(1)\nelse:\n print(\"All patterns valid\")\nEOF\n"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -122,43 +122,39 @@
|
||||
"machine": {
|
||||
"image": "ubuntu-2204:current"
|
||||
},
|
||||
"resource_class": "large",
|
||||
"resource_class": "medium",
|
||||
"steps": [
|
||||
"checkout",
|
||||
{
|
||||
"qqq-orb/install_java": {
|
||||
"java_version": "21"
|
||||
"attach_workspace": {
|
||||
"at": "."
|
||||
}
|
||||
},
|
||||
"qqq-orb/mvn_cache_restore",
|
||||
{
|
||||
"restore_cache": {
|
||||
"keys": [
|
||||
"owasp-nvd-v1-{{ .Branch }}",
|
||||
"owasp-nvd-v1-develop",
|
||||
"owasp-nvd-v1-"
|
||||
"voyage-trivy-v0760-"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"run": {
|
||||
"name": "OWASP Dependency Check",
|
||||
"no_output_timeout": "20m",
|
||||
"command": "mkdir -p ~/.dependency-check\nfor attempt in 1 2 3; do\n echo \"=== Attempt $attempt of 3 ===\"\n if mvn org.owasp:dependency-check-maven:check -B \\\n -DnvdApiKey=${NVD_API_KEY:-} \\\n -DfailBuildOnCVSS=7 \\\n -DsuppressionFile=.config/owasp/suppressions.xml \\\n -DdataDirectory=${HOME}/.dependency-check \\\n -DnvdMaxRetryCount=3; then\n echo \"OWASP check succeeded\"\n exit 0\n fi\n if [ $attempt -lt 3 ]; then\n echo \"Cleaning corrupted H2 database...\"\n rm -rf ~/.dependency-check/nvdcve* ~/.dependency-check/*.lock 2>/dev/null || true\n sleep 10\n fi\ndone\necho \"OWASP check failed after 3 attempts (non-blocking on develop)\"\nif [ \"${CIRCLE_BRANCH}\" = \"develop\" ]; then\n echo \"WARNING: Continuing despite OWASP failure on develop branch\"\n exit 0\nfi\nexit 1\n"
|
||||
"name": "Scan verified application dependencies",
|
||||
"no_output_timeout": "15m",
|
||||
"command": "set -euo pipefail\ntest -s target/voyage.jar\nmkdir -p \"$HOME/.cache/trivy\" target/security-reports\ndocker run --rm \\\n -v \"$PWD/target/voyage.jar:/scan/voyage.jar:ro\" \\\n -v \"$PWD/target/security-reports:/reports\" \\\n -v \"$HOME/.cache/trivy:/root/.cache/\" \\\n aquasec/trivy:0.76.0@sha256:2416d1f74045b57274df1a340eee6b510cacd73c66a6ccb8da092b117eb7d222 rootfs \\\n --scanners vuln --severity HIGH,CRITICAL --exit-code 1 \\\n --list-all-pkgs --format json --output /reports/dependencies.json /scan\n"
|
||||
}
|
||||
},
|
||||
{
|
||||
"save_cache": {
|
||||
"key": "owasp-nvd-v1-{{ .Branch }}-{{ epoch }}",
|
||||
"key": "voyage-trivy-v0760-{{ epoch }}",
|
||||
"paths": [
|
||||
"~/.dependency-check"
|
||||
"~/.cache/trivy"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"store_artifacts": {
|
||||
"path": "target/dependency-check-report.html",
|
||||
"destination": "owasp-report"
|
||||
"path": "target/security-reports",
|
||||
"destination": "dependency-security"
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -379,9 +375,6 @@
|
||||
},
|
||||
{
|
||||
"security-scan": {
|
||||
"context": [
|
||||
"nvd"
|
||||
],
|
||||
"requires": [
|
||||
"build-and-test"
|
||||
],
|
||||
@@ -430,7 +423,8 @@
|
||||
"requires": [
|
||||
"build-and-test",
|
||||
"secrets-scan",
|
||||
"sast-scan"
|
||||
"sast-scan",
|
||||
"security-scan"
|
||||
],
|
||||
"filters": {
|
||||
"branches": {
|
||||
@@ -481,9 +475,6 @@
|
||||
},
|
||||
{
|
||||
"security-scan": {
|
||||
"context": [
|
||||
"nvd"
|
||||
],
|
||||
"requires": [
|
||||
"build-and-test"
|
||||
],
|
||||
@@ -541,7 +532,8 @@
|
||||
"requires": [
|
||||
"build-and-test",
|
||||
"secrets-scan",
|
||||
"sast-scan"
|
||||
"sast-scan",
|
||||
"security-scan"
|
||||
],
|
||||
"filters": {
|
||||
"branches": {
|
||||
|
||||
@@ -86,9 +86,12 @@ class NoRedirect(urllib.request.HTTPRedirectHandler):
|
||||
|
||||
def circle(path):
|
||||
token = os.environ.get('CIRCLECI_TOKEN')
|
||||
require(token, 'CIRCLECI_TOKEN is required for Circle evidence mode')
|
||||
# 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={'Circle-Token': token, 'Accept': 'application/json'})
|
||||
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')
|
||||
|
||||
@@ -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')]:
|
||||
for name, kind in [('qqq-mcp-rag', 'mcp-rag'), ('qqq-business-platform', 'business-db'), ('.github', 'github-workflow-lint'), ('marketing-website-cd', 'gitops')]:
|
||||
entry = dict(ENTRY, name=name, nameWithOwner='QRun-IO/' + name)
|
||||
definition = audit.auxiliary.BRIDGES[kind]
|
||||
missing = audit.audit(entry, Snapshot({}), VERSION, SHA, {})
|
||||
@@ -177,7 +177,7 @@ class AuditTests(unittest.TestCase):
|
||||
self.assertEqual('unknown', report['status'])
|
||||
self.assertNotIn('missing_manifest', [f['code'] for f in report['findings']])
|
||||
for path, old, new in [('.circleci/config.yml', 'orb-tools/pack', 'disabled-pack'),
|
||||
('.circleci/test-deploy.yml', 'requires: [command-test, pipeline-contract-test]', 'requires: []'),
|
||||
('.circleci/test-deploy.yml', 'requires: [command-test, pipeline-contract-test, maven-publication-contract]', 'requires: [command-test, pipeline-contract-test]'),
|
||||
('.circleci/test-deploy.yml', 'circleci orb validate ', 'echo skipped ')]:
|
||||
self.assertIn(old, files[path])
|
||||
changed = dict(files, **{path: files[path].replace(old, new)})
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import copy
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -14,6 +17,40 @@ 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'))
|
||||
@@ -21,12 +58,14 @@ 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_job_and_path_filters_are_unchanged(self):
|
||||
def test_business_database_gate_reports_for_every_pr_and_preserves_validation(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'], original['events'])
|
||||
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(set(worker['jobs']), {'empty-database-migration'})
|
||||
self.assertNotIn('secrets', caller['jobs']['validate'])
|
||||
self.assertNotIn('schedule', caller['on'])
|
||||
@@ -51,7 +90,8 @@ class SpecialistNativeTests(unittest.TestCase):
|
||||
self.assertEqual(steps[3], original['jobs']['build-and-test']['steps'][3])
|
||||
self.assertEqual(steps[4]['if'], 'always()')
|
||||
caller = bridge.canonical('mcp-rag', SHA)
|
||||
self.assertEqual(caller['on']['push'], {'branches': ['**']})
|
||||
# Feature branches run once through the PR event, not also on push.
|
||||
self.assertEqual(caller['on']['push'], {'branches': ['main']})
|
||||
self.assertEqual(caller['on']['pull_request'], {'branches': ['main']})
|
||||
self.assertEqual(caller['jobs']['validate']['secrets'], {
|
||||
'QQQ_MCP_VOYAGE_API_KEY': '${{ secrets.QQQ_MCP_VOYAGE_API_KEY }}'})
|
||||
|
||||
@@ -29,11 +29,14 @@ 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_events_permissions_path_and_single_concurrency_owner_preserved(self):
|
||||
self.assertEqual(self.original['events'], self.caller['on'])
|
||||
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'])
|
||||
self.assertEqual(self.original['workflow']['permissions'], self.caller['permissions'])
|
||||
self.assertEqual(self.caller['permissions'], self.worker['permissions'])
|
||||
self.assertEqual(self.original['workflow']['concurrency'], self.caller['concurrency'])
|
||||
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.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'])
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env bash
|
||||
# Execute the real release script with offline curl/git fixtures.
|
||||
set -euo pipefail
|
||||
root=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
|
||||
scratch=$(mktemp -d)
|
||||
trap 'rm -rf "$scratch"' EXIT
|
||||
mkdir -p "$scratch/bin" "$scratch/work"
|
||||
cat > "$scratch/work/pom.xml" <<'EOF'
|
||||
<project>
|
||||
<groupId>example.fixture</groupId>
|
||||
<artifactId>release-test</artifactId>
|
||||
<revision>1.2.3</revision>
|
||||
</project>
|
||||
EOF
|
||||
cat > "$scratch/bin/git" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
[[ "$*" == "tag --list" ]] || exit 92
|
||||
printf 'v1.2.3\n'
|
||||
EOF
|
||||
cat > "$scratch/bin/sleep" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
exit 0
|
||||
EOF
|
||||
cat > "$scratch/bin/curl" <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
count=$(cat "$MOCK_COUNT")
|
||||
count=$((count + 1))
|
||||
printf '%s' "$count" > "$MOCK_COUNT"
|
||||
method=POST
|
||||
while (($#)); do
|
||||
if [[ "$1" == "-X" ]]; then method=$2; shift; fi
|
||||
shift
|
||||
done
|
||||
existing='{"errors":[{"resource":"Release","field":"tag_name","code":"already_exists"}]}'
|
||||
valid='{"tag_name":"v1.2.3","draft":false,"html_url":"https://github.com/example/fixture/releases/tag/v1.2.3"}'
|
||||
case "$MOCK_CASE" in
|
||||
created) printf '%s\n201' "$valid" ;;
|
||||
unauthorized) printf '{"message":"BODY_MUST_NOT_LEAK"}\n401' ;;
|
||||
forbidden) printf '{"message":"BODY_MUST_NOT_LEAK"}\n403' ;;
|
||||
invalid) printf '{"message":"BODY_MUST_NOT_LEAK","errors":[{"code":"invalid"}]}\n422' ;;
|
||||
misleading) printf '{"message":"already_exists BODY_MUST_NOT_LEAK"}\n422' ;;
|
||||
server) printf '{"message":"BODY_MUST_NOT_LEAK"}\n503' ;;
|
||||
recover)
|
||||
if [[ "$count" == 1 ]]; then printf '{}\n503'; else printf '%s\n201' "$valid"; fi ;;
|
||||
transport) exit 7 ;;
|
||||
malformed) printf 'BODY_MUST_NOT_LEAK\nnot-http' ;;
|
||||
existing|wrong-tag|draft|lookup-unauthorized)
|
||||
if [[ "$method" == POST ]]; then
|
||||
printf '%s\n422' "$existing"
|
||||
elif [[ "$MOCK_CASE" == wrong-tag ]]; then
|
||||
printf '{"tag_name":"v9.9.9","draft":false}\n200'
|
||||
elif [[ "$MOCK_CASE" == draft ]]; then
|
||||
printf '{"tag_name":"v1.2.3","draft":true}\n200'
|
||||
elif [[ "$MOCK_CASE" == lookup-unauthorized ]]; then
|
||||
printf '{"message":"BODY_MUST_NOT_LEAK"}\n401'
|
||||
else
|
||||
printf '%s\n200' "$valid"
|
||||
fi ;;
|
||||
*) exit 93 ;;
|
||||
esac
|
||||
EOF
|
||||
chmod +x "$scratch/bin/"*
|
||||
export PATH="$scratch/bin:$PATH" PROJECT_TYPE=maven
|
||||
export GITHUB_TOKEN=fixture-token-must-not-leak
|
||||
export CIRCLE_PROJECT_USERNAME=example CIRCLE_PROJECT_REPONAME=fixture
|
||||
export MOCK_COUNT="$scratch/count"
|
||||
cd "$scratch/work"
|
||||
check() {
|
||||
export MOCK_CASE=$1
|
||||
local expected=$2 calls=$3 status=0
|
||||
printf 0 > "$MOCK_COUNT"
|
||||
bash "$root/src/scripts/create_github_release.sh" > "$scratch/output" 2>&1 || status=$?
|
||||
if [[ "$expected" == pass && "$status" != 0 ]] || [[ "$expected" == fail && "$status" == 0 ]]; then
|
||||
printf 'FAIL: %s returned %s (expected %s)\n' "$MOCK_CASE" "$status" "$expected" >&2
|
||||
exit 1
|
||||
fi
|
||||
[[ "$(cat "$MOCK_COUNT")" == "$calls" ]]
|
||||
if grep -Eq 'BODY_MUST_NOT_LEAK|fixture-token-must-not-leak|artifacts are published|Artifacts are published' "$scratch/output"; then
|
||||
printf 'FAIL: unsafe or unverified output in %s\n' "$MOCK_CASE" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf 'PASS: %s\n' "$MOCK_CASE"
|
||||
}
|
||||
# First assertion reproduces the hosted HTTP401 false success before the fix.
|
||||
check unauthorized fail 1
|
||||
check forbidden fail 1
|
||||
check invalid fail 1
|
||||
check misleading fail 1
|
||||
check server fail 2
|
||||
check transport fail 1
|
||||
check malformed fail 1
|
||||
check created pass 1
|
||||
check recover pass 2
|
||||
check existing pass 2
|
||||
check wrong-tag fail 2
|
||||
check draft fail 2
|
||||
check lookup-unauthorized fail 2
|
||||
export DRY_RUN=true
|
||||
check created pass 0
|
||||
@@ -35,7 +35,8 @@ class AllReleaseCallerTests(unittest.TestCase):
|
||||
for name in inputs:
|
||||
self.assertEqual('${{ inputs.' + name + ' }}', passed[name])
|
||||
self.assertEqual('string', self.contract['inputs'][name]['type'])
|
||||
self.assertEqual('github', inputs['smoke_evidence']['default'])
|
||||
# Migrated consumers no longer own a separate GitHub Smoke workflow.
|
||||
self.assertEqual('circle', inputs['smoke_evidence']['default'])
|
||||
self.assertEqual(['github', 'circle'], inputs['smoke_evidence']['options'])
|
||||
self.assertFalse(inputs['smoke_run_id']['required'])
|
||||
self.assertFalse(inputs['circle_workflow_id']['required'])
|
||||
|
||||
@@ -29,8 +29,17 @@ MANIFEST = {"profile": "qbit", "orb_version": "0.7.0", "default_branch": "develo
|
||||
|
||||
|
||||
class MarketingContractTests(unittest.TestCase):
|
||||
def test_exact_munitor_render_and_single_continuation(self):
|
||||
def test_munitor_render_with_explicit_build_and_single_continuation(self):
|
||||
baseline = yaml.safe_load((ROOT / "tests/fixtures/marketing-munitor-0311-rendered.yml").read_text(encoding="utf-8"))
|
||||
# The original delegated job never builds: require the shared profile
|
||||
# to prepare the standalone artifact before browser/Lighthouse checks.
|
||||
for workflow in baseline["workflows"].values():
|
||||
for entry in workflow["jobs"]:
|
||||
if "munitor/node_build_and_test" in entry:
|
||||
build = entry["munitor/node_build_and_test"]
|
||||
build["test_commands"] = json.dumps([
|
||||
"npm run lint", "npm run build",
|
||||
*json.loads(build["test_commands"])])
|
||||
for branch in ("feature/example", "main", "develop", "staging", "release/1"):
|
||||
result = pipeline.marketing_template({}, branch, "")
|
||||
self.assertEqual(result, baseline)
|
||||
@@ -46,6 +55,7 @@ class MarketingContractTests(unittest.TestCase):
|
||||
build = jobs["munitor/node_build_and_test"]
|
||||
self.assertEqual(build["node_version"], "22")
|
||||
self.assertEqual(json.loads(build["test_commands"]), [
|
||||
"npm run lint", "npm run build",
|
||||
"npx playwright install chromium --with-deps",
|
||||
"npm run test:chromium", "npm run lighthouse"])
|
||||
if name == "production":
|
||||
|
||||
@@ -63,6 +63,17 @@ class MavenCiContract(unittest.TestCase):
|
||||
self.assertIn("-Dgpg.keyname=", deploy)
|
||||
self.assertIn("-DskipTests", deploy)
|
||||
|
||||
def test_publication_wait_outlives_central_native_timeout(self):
|
||||
steps = read("src/commands/mvn_jar_deploy.yml")["steps"]
|
||||
publish = next(s["run"] for s in steps if "mvn_jar_deploy.sh" in str(s))
|
||||
# Central 0.8.x waits silently up to 1800 seconds; the default Circle
|
||||
# ten-minute inactivity limit killed an already-uploaded RC in production.
|
||||
timeout = publish["no_output_timeout"]
|
||||
self.assertTrue(timeout.endswith("m"))
|
||||
self.assertGreater(int(timeout[:-1]), 30)
|
||||
self.assertLessEqual(int(timeout[:-1]), 40)
|
||||
self.assertNotIn("max_auto_reruns", publish)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,107 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Real Maven publication contract. Requires Java/Maven; no remote deploy or secrets.
|
||||
|
||||
Run explicitly with make test-publication-poms. Public plugins are downloaded to
|
||||
an isolated temporary local repository; nothing is installed to the user's m2.
|
||||
"""
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
GOAL = 'org.codehaus.mojo:flatten-maven-plugin:1.7.3:flatten'
|
||||
FLAGS = ['-Dflatten.mode=resolveCiFriendliesOnly', '-DupdatePomFile=true']
|
||||
NS = {'m': 'http://maven.apache.org/POM/4.0.0'}
|
||||
|
||||
|
||||
def pom(body):
|
||||
return '<project xmlns="http://maven.apache.org/POM/4.0.0"><modelVersion>4.0.0</modelVersion>' + body + '</project>'
|
||||
|
||||
|
||||
def run_case(base, repository, lifecycle):
|
||||
project = base / ('bound' if lifecycle else 'plain')
|
||||
project.mkdir()
|
||||
group = 'example.bound' if lifecycle else 'example.plain'
|
||||
flatten = ("<plugin><groupId>org.codehaus.mojo</groupId><artifactId>flatten-maven-plugin</artifactId>"
|
||||
"<version>1.7.3</version><configuration><updatePomFile>true</updatePomFile>"
|
||||
"<flattenMode>resolveCiFriendliesOnly</flattenMode></configuration><executions>"
|
||||
"<execution><id>flatten</id><phase>process-resources</phase><goals><goal>flatten</goal>"
|
||||
"</goals></execution></executions></plugin>") if lifecycle else ''
|
||||
(project / 'pom.xml').write_text(pom(f"""
|
||||
<groupId>{group}</groupId><artifactId>parent</artifactId><version>${{revision}}</version><packaging>pom</packaging>
|
||||
<name>Publication fixture</name><description>Inherited release metadata</description><url>https://example.invalid/fixture</url>
|
||||
<licenses><license><name>Fixture license</name><url>https://example.invalid/license</url></license></licenses>
|
||||
<properties><revision>1.2.3</revision><maven.compiler.release>17</maven.compiler.release></properties>
|
||||
<modules><module>library</module><module>application</module></modules>
|
||||
<dependencyManagement><dependencies><dependency><groupId>{group}</groupId><artifactId>library</artifactId>
|
||||
<version>${{revision}}</version></dependency></dependencies></dependencyManagement>
|
||||
<build><pluginManagement><plugins><plugin><groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId><version>3.13.0</version><configuration><release>17</release></configuration>
|
||||
</plugin></plugins></pluginManagement><plugins>{flatten}</plugins></build>
|
||||
"""), encoding='utf-8')
|
||||
for artifact in ('library', 'application'):
|
||||
child = project / artifact
|
||||
child.mkdir()
|
||||
dependencies = (f'<dependencies><dependency><groupId>{group}</groupId><artifactId>library</artifactId></dependency></dependencies>'
|
||||
if artifact == 'application' else '')
|
||||
(child / 'pom.xml').write_text(pom(f'<parent><groupId>{group}</groupId><artifactId>parent</artifactId>'
|
||||
'<version>${revision}</version></parent>' + f'<artifactId>{artifact}</artifactId>' + dependencies), encoding='utf-8')
|
||||
sources = {path: hashlib.sha256(path.read_bytes()).hexdigest() for path in project.rglob('pom.xml')}
|
||||
settings = base / 'settings.xml'
|
||||
settings.write_text('<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"/>', encoding='utf-8')
|
||||
maven = shutil.which('mvn') or shutil.which('mvn.cmd')
|
||||
if not maven:
|
||||
raise RuntimeError('Maven is required for this explicit integration gate')
|
||||
command = [maven, '-B', '-ntp', '-s', str(settings), '-gs', str(settings), '-Dmaven.repo.local=' + str(repository)]
|
||||
def execute(directory, goals):
|
||||
subprocess.run(command + goals, cwd=directory, check=True, timeout=600)
|
||||
execute(project, FLAGS + [GOAL, 'install'])
|
||||
for path, digest in sources.items():
|
||||
assert hashlib.sha256(path.read_bytes()).hexdigest() == digest, 'Source POM was rewritten'
|
||||
installed = repository / group.replace('.', '/')
|
||||
for artifact in ('parent', 'library', 'application'):
|
||||
tree = ET.parse(installed / artifact / '1.2.3' / (artifact + '-1.2.3.pom'))
|
||||
for node in tree.findall('m:version', NS) + tree.findall('m:parent/m:version', NS):
|
||||
assert node.text == '1.2.3', 'Unresolved deployed coordinate: ' + artifact
|
||||
parent = ET.parse(installed / 'parent/1.2.3/parent-1.2.3.pom')
|
||||
assert parent.findtext('m:licenses/m:license/m:name', namespaces=NS) == 'Fixture license'
|
||||
assert parent.find('m:dependencyManagement', NS) is not None
|
||||
assert parent.find('m:build/m:pluginManagement', NS) is not None, 'Parent build contract was stripped'
|
||||
# Remove reactor availability: cold consumer can use only installed artifacts.
|
||||
hidden = project.with_name(project.name + '-unavailable')
|
||||
project.rename(hidden)
|
||||
consumer = base / ('consumer-bound' if lifecycle else 'consumer-plain')
|
||||
consumer.mkdir()
|
||||
(consumer / 'pom.xml').write_text(pom(f'<parent><groupId>{group}</groupId><artifactId>parent</artifactId>'
|
||||
'<version>1.2.3</version><relativePath/></parent><artifactId>cold-consumer</artifactId>'
|
||||
f'<dependencies><dependency><groupId>{group}</groupId><artifactId>application</artifactId>'
|
||||
'<version>1.2.3</version></dependency></dependencies>'), encoding='utf-8')
|
||||
execute(consumer, ['validate', 'org.apache.maven.plugins:maven-help-plugin:3.5.1:effective-pom', '-Doutput=effective.xml',
|
||||
'org.apache.maven.plugins:maven-dependency-plugin:3.7.1:build-classpath', '-Dmdep.outputFile=classpath.txt'])
|
||||
effective = ET.parse(consumer / 'effective.xml')
|
||||
assert effective.findtext('m:licenses/m:license/m:name', namespaces=NS) == 'Fixture license'
|
||||
managed = effective.find('m:dependencyManagement/m:dependencies/m:dependency', NS)
|
||||
assert managed.findtext('m:version', namespaces=NS) == '1.2.3'
|
||||
plugins = effective.findall('m:build/m:pluginManagement/m:plugins/m:plugin', NS)
|
||||
compiler = next(p for p in plugins if p.findtext('m:artifactId', namespaces=NS) == 'maven-compiler-plugin')
|
||||
assert compiler.findtext('m:configuration/m:release', namespaces=NS) == '17'
|
||||
classpath = (consumer / 'classpath.txt').read_text()
|
||||
assert 'application-1.2.3.jar' in classpath and 'library-1.2.3.jar' in classpath
|
||||
print('PASS real resolved publication + cold consumer: ' + ('lifecycle-bound' if lifecycle else 'no-existing-flatten'))
|
||||
|
||||
|
||||
def main():
|
||||
deployment = (ROOT / 'src/scripts/mvn_jar_deploy.sh').read_text()
|
||||
for flag in FLAGS:
|
||||
assert flag in deployment, 'Deployment missing tested flatten configuration'
|
||||
assert GOAL + ' deploy' in deployment, 'Flatten and deploy must share a Maven process'
|
||||
with tempfile.TemporaryDirectory(prefix='qqq-publication-') as directory:
|
||||
base = Path(directory)
|
||||
for lifecycle in (False, True):
|
||||
run_case(base, base / 'repository', lifecycle)
|
||||
|
||||
|
||||
if __name__ == '__main__': main()
|
||||
@@ -49,7 +49,26 @@ release
|
||||
-DskipTests
|
||||
-Dgpg.keyname=test-key
|
||||
-Dgpg.passphrase=test-passphrase
|
||||
-DwaitForPublishCompletion=true
|
||||
-Dflatten.mode=resolveCiFriendliesOnly
|
||||
-DupdatePomFile=true
|
||||
org.codehaus.mojo:flatten-maven-plugin:1.7.3:flatten
|
||||
deploy
|
||||
EOF
|
||||
diff -u "$test_dir/expected-args" "$test_dir/mvn-args"
|
||||
# A Central validation failure or publication timeout must fail this wrapper.
|
||||
cat > "$test_dir/bin/mvn" <<'EOF'
|
||||
#!/bin/bash
|
||||
exit 42
|
||||
EOF
|
||||
set +e
|
||||
PATH="$test_dir/bin:$PATH" GPG_KEYNAME=test-key GPG_PASSPHRASE=test-passphrase \
|
||||
bash "$test_dir/deploy.sh" > "$test_dir/failure-output" 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
if [ "$status" -ne 42 ]; then
|
||||
echo 'Deploy did not preserve Maven publication failure' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Maven settings setup and deploy output are safe; deploy arguments preserved'
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
# Exercise the actual collector with colliding suites, spaces and non-JUnit XML.
|
||||
set -euo pipefail
|
||||
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../src/scripts" && pwd)
|
||||
scratch=$(mktemp -d)
|
||||
trap 'rm -rf "$scratch"' EXIT
|
||||
export HOME="$scratch/home"
|
||||
mkdir -p "$scratch/repo"
|
||||
cd "$scratch/repo"
|
||||
|
||||
# A repository with no tests is valid.
|
||||
bash "$script_dir/mvn_verify_save_test_results.sh"
|
||||
[[ -d "$HOME/test-results/junit" ]]
|
||||
[[ -z "$(find "$HOME/test-results/junit" -type f -print)" ]]
|
||||
|
||||
for module in 'module one' 'module two'; do
|
||||
for runner in surefire failsafe; do
|
||||
report="$module/target/$runner-reports/TEST-shared.xml"
|
||||
mkdir -p "$(dirname "$report")"
|
||||
printf '<testsuite name="%s %s"/>\n' "$module" "$runner" > "$report"
|
||||
done
|
||||
done
|
||||
printf '<failsafe-summary/>\n' > 'module one/target/failsafe-reports/failsafe-summary.xml'
|
||||
printf '<configuration/>\n' > 'module one/target/surefire-reports/configuration.xml'
|
||||
mkdir -p unrelated
|
||||
printf '<testsuite/>\n' > unrelated/TEST-ignore.xml
|
||||
bash "$script_dir/mvn_verify_save_test_results.sh"
|
||||
[[ "$(find "$HOME/test-results/junit" -type f | wc -l)" -eq 4 ]]
|
||||
for module in 'module one' 'module two'; do
|
||||
for runner in surefire failsafe; do
|
||||
report="$module/target/$runner-reports/TEST-shared.xml"
|
||||
cmp "$report" "$HOME/test-results/junit/$report"
|
||||
done
|
||||
done
|
||||
printf 'PASS: unit/integration reports, module collisions, spaces, exclusions and no tests\n'
|
||||
@@ -2,7 +2,10 @@
|
||||
import contextlib
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path, PurePosixPath
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest import mock
|
||||
|
||||
@@ -17,23 +20,84 @@ class MobilePolicyTests(unittest.TestCase):
|
||||
after = json.loads((ROOT / "src/scripts/templates/android.json").read_text())
|
||||
self.assertEqual(after["orbs"], before["orbs"])
|
||||
self.assertEqual(set(after["jobs"]), {"unit-test", "android-test", "maven-deploy"})
|
||||
for name, job in after["jobs"].items():
|
||||
self.assertEqual(job, before["jobs"][name])
|
||||
for name in ("unit-test", "android-test"):
|
||||
self.assertEqual(after["jobs"][name], before["jobs"][name])
|
||||
self.assertEqual(after["jobs"]["maven-deploy"]["executor"], before["jobs"]["maven-deploy"]["executor"])
|
||||
self.assertEqual(after["jobs"]["maven-deploy"]["steps"][:2], before["jobs"]["maven-deploy"]["steps"][:2])
|
||||
entries = after["workflows"]["test-and-build"]["jobs"]
|
||||
self.assertEqual(entries[0], "unit-test")
|
||||
self.assertEqual(entries[1], {"android-test": {}})
|
||||
publish = entries[2]["maven-deploy"]
|
||||
self.assertEqual(publish["context"], ["qqq-maven-registry-credentials"])
|
||||
self.assertEqual(publish["requires"], ["unit-test", "android-test"])
|
||||
self.assertEqual(publish["filters"], {"branches": {"only": "main"}})
|
||||
# No new dormant Firebase benchmark or nonexistent app module build.
|
||||
self.assertNotIn("benchmarks-ftl", after["jobs"])
|
||||
|
||||
def test_android_publication_uses_shared_credentials_without_persisting_them(self):
|
||||
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("\\<<", "<<")
|
||||
with tempfile.TemporaryDirectory() as folder:
|
||||
root = Path(folder)
|
||||
runner = root / "gradlew"
|
||||
runner.write_text('''#!/bin/bash
|
||||
set -eu
|
||||
test "$1" = --console=plain
|
||||
test "$2" = publishMavenPublicationToGithubQqqMavenRegistryRepository
|
||||
test "$ORG_GRADLE_PROJECT_githubQqqMavenRegistryUsername" = fixture-user
|
||||
test "$ORG_GRADLE_PROJECT_githubQqqMavenRegistryPassword" = fixture-password
|
||||
touch invoked
|
||||
''')
|
||||
runner.chmod(0o755)
|
||||
python = root / "python3"
|
||||
python.write_text("#!/bin/bash\ncat >/dev/null\n[[ ${DENY_ACCESS:-0} == 0 ]] || exit 1\necho fixture-user\n")
|
||||
python.chmod(0o755)
|
||||
base = {**os.environ, "GITHUB_TOKEN": "fixture-password",
|
||||
"PATH": str(root) + os.pathsep + os.environ["PATH"]}
|
||||
for mode in ("missing", "denied", "success"):
|
||||
env = dict(base)
|
||||
if mode == "missing":
|
||||
env.pop("GITHUB_TOKEN")
|
||||
elif mode == "denied":
|
||||
env["DENY_ACCESS"] = "1"
|
||||
result = subprocess.run(["bash", "-c", command], cwd=root, env=env, capture_output=True, text=True)
|
||||
self.assertEqual(result.returncode == 0, mode == "success")
|
||||
self.assertEqual((root / "invoked").exists(), mode == "success")
|
||||
self.assertFalse((root / "gradle.properties").exists())
|
||||
self.assertNotIn("fixture-password", result.stdout + result.stderr)
|
||||
|
||||
def test_android_registry_preflight_fails_closed(self):
|
||||
data = json.loads((ROOT / "src/scripts/templates/android.json").read_text())
|
||||
command = data["jobs"]["maven-deploy"]["steps"][2]["run"]["command"]
|
||||
script = command.split("<<'PYTHON'\n", 1)[1].split("\nPYTHON", 1)[0]
|
||||
for identity, permissions, allowed in (({"login": "fixture-user"}, {"push": True}, True),
|
||||
({"login": "fixture-user"}, {"push": False}, False),
|
||||
({}, {"push": True}, False)):
|
||||
opener = mock.Mock()
|
||||
responses = [json.dumps(identity), json.dumps({"permissions": permissions})]
|
||||
opener.open.side_effect = lambda *args, **kwargs: io.StringIO(responses.pop(0))
|
||||
with mock.patch("urllib.request.build_opener", return_value=opener), \
|
||||
mock.patch.dict(os.environ, {"GITHUB_TOKEN": "fixture-password"}), \
|
||||
contextlib.redirect_stdout(io.StringIO()) as output:
|
||||
if allowed:
|
||||
exec(compile(script, "registry-preflight", "exec"), {})
|
||||
self.assertEqual(output.getvalue().strip(), "fixture-user")
|
||||
else:
|
||||
with self.assertRaises(SystemExit):
|
||||
exec(compile(script, "registry-preflight", "exec"), {})
|
||||
self.assertNotIn("fixture-password", output.getvalue())
|
||||
|
||||
def test_policy_stays_small_and_validates_actual_pattern_content(self):
|
||||
data = json.loads((ROOT / "src/scripts/templates/mcp-policy.json").read_text())
|
||||
job = data["jobs"]["validate-patterns"]
|
||||
self.assertEqual(job["resource_class"], "small")
|
||||
self.assertIn("PyYAML==6.0.3", job["steps"][1]["run"]["command"])
|
||||
command = job["steps"][2]["run"]["command"]
|
||||
self.assertTrue(command.startswith("python3 \\<< 'EOF'\n"), "CircleCI requires escaped heredoc interpolation markers")
|
||||
script = command.split("\n", 1)[1].rsplit("\nEOF", 1)[0]
|
||||
valid = "id: example\ntitle: Example\ncategory: test\ndescription: test\ncontent: test\n"
|
||||
for text, expected in ((valid, 0), ("id: incomplete\n", 1), ("[invalid", 1)):
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Run the workflow's publication shell with a recording CLI, never GitHub."""
|
||||
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
import yaml
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def workflow_shell(name):
|
||||
worker = yaml.safe_load((ROOT / ".github/workflows/qqq-all-release.yml").read_text())
|
||||
return next(step["run"] for step in worker["jobs"]["release"]["steps"]
|
||||
if step.get("name") == name)
|
||||
|
||||
|
||||
class ReleaseWorkflowTest(unittest.TestCase):
|
||||
def test_rc_is_prerelease_never_latest_and_ga_keeps_existing_release_behavior(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
gh = root / "gh"
|
||||
gh.write_text("#!/usr/bin/env python3\nimport json, os, sys\n"
|
||||
"with open(os.environ['CALLS'], 'w') as f: json.dump(sys.argv[1:], f)\n")
|
||||
gh.chmod(0o755)
|
||||
calls = root / "calls.json"
|
||||
for version in ("4.1.0", "4.1.0-RC.1", "4.1.0-RC.2"):
|
||||
calls.unlink(missing_ok=True)
|
||||
environment = {**os.environ, "PATH": directory + os.pathsep + os.environ["PATH"],
|
||||
"CALLS": str(calls), "VERSION": version, "TAG": version,
|
||||
"RUNNER_TEMP": directory, "GITHUB_REPOSITORY": "QRun-IO/qqq-all"}
|
||||
result = subprocess.run(["bash", "-c", workflow_shell("Publish GitHub release with Compose bundle")],
|
||||
env=environment, capture_output=True, text=True)
|
||||
if version == "4.1.0-RC.2":
|
||||
self.assertNotEqual(0, result.returncode)
|
||||
self.assertFalse(calls.exists())
|
||||
continue
|
||||
self.assertEqual(0, result.returncode, result.stderr)
|
||||
args = json.loads(calls.read_text())
|
||||
self.assertEqual(["release", "create", version], args[:3])
|
||||
self.assertIn(str(root / ("qqq-all-" + version + ".tar.gz")), args)
|
||||
self.assertIn("--verify-tag", args)
|
||||
if version == "4.1.0-RC.1":
|
||||
self.assertIn("--prerelease", args)
|
||||
self.assertIn("--latest=false", args)
|
||||
else:
|
||||
self.assertNotIn("--prerelease", args)
|
||||
self.assertNotIn("--latest=false", args)
|
||||
@@ -0,0 +1,109 @@
|
||||
"""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,7 +1,11 @@
|
||||
import copy
|
||||
import importlib.util
|
||||
import io
|
||||
import os
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
from unittest import mock
|
||||
import urllib.error
|
||||
import yaml
|
||||
|
||||
ROOT = Path(__file__).parents[1]
|
||||
@@ -25,6 +29,27 @@ def fixture():
|
||||
|
||||
|
||||
class EvidenceTests(unittest.TestCase):
|
||||
def test_public_evidence_needs_no_credential_and_optional_token_stays_on_circle(self):
|
||||
for token in ('', 'fixture-token'):
|
||||
opener = mock.Mock()
|
||||
opener.open.return_value = io.BytesIO(b'{"status":"success"}')
|
||||
with mock.patch.dict(os.environ, {'CIRCLECI_TOKEN': token}), \
|
||||
mock.patch.object(v.urllib.request, 'build_opener', return_value=opener):
|
||||
self.assertEqual(v.circle('workflow/' + W), {'status': 'success'})
|
||||
request = opener.open.call_args.args[0]
|
||||
self.assertEqual(request.full_url, 'https://circleci.com/api/v2/workflow/' + W)
|
||||
self.assertEqual(request.get_header('Circle-token'), token or None)
|
||||
|
||||
def test_unavailable_public_evidence_is_not_a_success(self):
|
||||
opener = mock.Mock()
|
||||
opener.open.side_effect = urllib.error.HTTPError('https://circleci.com', 403, 'Forbidden', {}, None)
|
||||
with mock.patch.dict(os.environ, {'CIRCLECI_TOKEN': ''}), \
|
||||
mock.patch.object(v.urllib.request, 'build_opener', return_value=opener), \
|
||||
self.assertRaises(OSError):
|
||||
v.circle('workflow/' + W)
|
||||
with self.assertRaises(v.EvidenceError):
|
||||
v.NoRedirect().redirect_request(None, None, 302, '', {}, 'https://other.example/')
|
||||
|
||||
def test_success_returns_real_circle_evidence_not_fake_github_run(self):
|
||||
evidence = v.validate(SHA, W, *fixture())
|
||||
self.assertEqual('qqq-all-circle-smoke/v1', evidence['schema'])
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
"""Voyage's authoritative CI contracts, extracted from source 9f598cc105ef."""
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
import re
|
||||
import unittest
|
||||
@@ -75,7 +78,29 @@ class VoyageContract(unittest.TestCase):
|
||||
main = {n: o for _, n, o in selected("main")}
|
||||
self.assertEqual(main["update-cd-repo"]["requires"], ["docker-build"])
|
||||
self.assertEqual(main["release-please"]["requires"], ["docker-build"])
|
||||
self.assertEqual(main["docker-build"]["requires"], ["build-and-test", "secrets-scan", "sast-scan"])
|
||||
self.assertEqual(main["docker-build"]["requires"], ["build-and-test", "secrets-scan", "sast-scan", "security-scan"])
|
||||
|
||||
def test_dependency_scan_propagates_findings_and_operational_errors(self):
|
||||
command = next(s["run"]["command"] for s in TEMPLATE["jobs"]["security-scan"]["steps"]
|
||||
if isinstance(s, dict) and "run" in s)
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory)
|
||||
(root / "bin").mkdir()
|
||||
docker = root / "bin/docker"
|
||||
docker.write_text('#!/bin/sh\nexit "$SCANNER_RESULT"\n')
|
||||
docker.chmod(0o755)
|
||||
(root / "target").mkdir()
|
||||
(root / "target/voyage.jar").write_bytes(b"artifact")
|
||||
env = {**os.environ, "HOME": directory, "PATH": str(root / "bin") + os.pathsep + os.environ["PATH"],
|
||||
"CIRCLE_BRANCH": "develop"}
|
||||
for code in (0, 1, 2):
|
||||
result = subprocess.run(["bash", "-c", command], cwd=root,
|
||||
env={**env, "SCANNER_RESULT": str(code)}, capture_output=True)
|
||||
self.assertEqual(result.returncode, code)
|
||||
(root / "target/voyage.jar").unlink()
|
||||
result = subprocess.run(["bash", "-c", command], cwd=root,
|
||||
env={**env, "SCANNER_RESULT": "0"}, capture_output=True)
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
|
||||
def test_security_policies_and_destinations_preserved(self):
|
||||
jobs = TEMPLATE["jobs"]
|
||||
@@ -84,9 +109,18 @@ class VoyageContract(unittest.TestCase):
|
||||
self.assertIn('ghcr.io/qrun-io/voyage', json.dumps(jobs["docker-build"]))
|
||||
self.assertIn('overlays/production/kustomization.yaml', json.dumps(jobs["update-cd-repo"]))
|
||||
owasp = '\n'.join(s["run"]["command"] for s in jobs["security-scan"]["steps"] if isinstance(s, dict) and "run" in s)
|
||||
self.assertIn('-DfailBuildOnCVSS=7', owasp)
|
||||
self.assertIn('"${CIRCLE_BRANCH}" = "develop"', owasp)
|
||||
self.assertIn('exit 1', owasp)
|
||||
self.assertIn('--severity HIGH,CRITICAL --exit-code 1', owasp)
|
||||
self.assertIn('target/voyage.jar:/scan/voyage.jar:ro', owasp)
|
||||
self.assertIn('aquasec/trivy:0.76.0@sha256:', owasp)
|
||||
self.assertNotIn('--ignore-unfixed', owasp)
|
||||
self.assertNotIn('NVD_API_KEY', owasp)
|
||||
self.assertNotIn('mvn ', owasp)
|
||||
self.assertIn('set -euo pipefail', owasp)
|
||||
self.assertEqual(jobs["security-scan"]["resource_class"], "medium")
|
||||
for workflow in TEMPLATE["workflows"].values():
|
||||
for invocation in workflow["jobs"]:
|
||||
if "security-scan" in invocation:
|
||||
self.assertNotIn("context", invocation["security-scan"])
|
||||
self.assertIn('./gitleaks detect', json.dumps(jobs["secrets-scan"]))
|
||||
self.assertIn('|| true', json.dumps(jobs["sast-scan"]))
|
||||
self.assertIn('makeAggregateBom', json.dumps(jobs["sbom"]))
|
||||
|
||||
@@ -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'}
|
||||
'qqq-orb': 'owner-bootstrap', 'marketing-website-cd': 'native-gitops'}
|
||||
NO_CI = json.loads((ROOT / 'tools/no-ci-policy.json').read_text(encoding='utf-8'))
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ def owner_gate_errors(snapshot):
|
||||
if not gates.issubset(set(lint.get('orb-tools/continue', {}).get('requires', []))):
|
||||
errors.append('continuation must depend on every lint/pack/review/shellcheck gate')
|
||||
tests = invocations(deploy, 'test-deploy')
|
||||
required = {'command-test', 'pipeline-contract-test'}
|
||||
required = {'command-test', 'pipeline-contract-test', 'maven-publication-contract'}
|
||||
for test in required:
|
||||
definition = deploy.get('jobs', {}).get(test, {})
|
||||
if test not in tests or not definition.get('steps') or not any(isinstance(step, dict) and 'run' in step for step in definition['steps']):
|
||||
@@ -146,7 +146,7 @@ def owner_gate_errors(snapshot):
|
||||
for name, branch in [('publish-dev-snapshot', 'develop'), ('publish-production', 'main')]:
|
||||
invocation = tests.get(name, {})
|
||||
if not required.issubset(set(invocation.get('requires', []))):
|
||||
errors.append(name + ' must require both test gates')
|
||||
errors.append(name + ' must require all test gates')
|
||||
if invocation.get('filters', {}).get('branches', {}).get('only') != [branch]:
|
||||
errors.append(name + ' branch filter')
|
||||
commands = []
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
#!/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,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 human review.
|
||||
publication remain separate. Unknown jobs/options fail closed for central profile resolution.
|
||||
"""
|
||||
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 the version rollout operation")
|
||||
raise ValueError("Already has a manifest; use tools/rollout_version.py")
|
||||
manifest = infer_manifest(config, args.orb_version, args.default_branch)
|
||||
caller = canonical_caller(args.orb_version, manifest["release_tag_policy"])
|
||||
if args.write:
|
||||
|
||||
Reference in new issue
Block a user