Skip to content

Commit 9ae7380

Browse files
authored
Merge branch 'main' into development
2 parents 30d8fe3 + 6d74500 commit 9ae7380

9 files changed

Lines changed: 551 additions & 278 deletions

.github/workflows/docs-to-issues.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ jobs:
343343
# Removed [skip ci] to allow CI checks to run on PRs
344344
# Infinite loop protection: path filter excludes docs/issues/created/** AND github.actor guard prevents bot loops
345345
git diff --staged --quiet || git commit -m "chore: move processed issue files to created/"
346-
git push
346+
BRANCH="${{ github.event.workflow_run.head_branch || github.ref_name }}"
347+
git push origin HEAD:refs/heads/${BRANCH}
347348
348349
- name: Summary
349350
if: always()

.github/workflows/waf-integration.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ jobs:
4040
- name: Run WAF integration tests
4141
id: waf-test
4242
run: |
43-
chmod +x scripts/coraza_integration.sh
44-
scripts/coraza_integration.sh 2>&1 | tee waf-test-output.txt
43+
chmod +x scripts/waf_integration.sh
44+
scripts/waf_integration.sh 2>&1 | tee waf-test-output.txt
4545
exit "${PIPESTATUS[0]}"
4646
4747
- name: Dump Debug Info on Failure
@@ -53,25 +53,25 @@ jobs:
5353
5454
echo "### Container Status"
5555
echo '```'
56-
docker ps -a --filter "name=charon" --filter "name=coraza" 2>&1 || true
56+
docker ps -a --filter "name=charon" --filter "name=waf" 2>&1 || true
5757
echo '```'
5858
echo ""
5959
6060
echo "### Caddy Admin Config"
6161
echo '```json'
62-
curl -s http://localhost:2019/config 2>/dev/null | head -200 || echo "Could not retrieve Caddy config"
62+
curl -s http://localhost:2119/config/ 2>/dev/null | head -200 || echo "Could not retrieve Caddy config"
6363
echo '```'
6464
echo ""
6565
6666
echo "### Charon Container Logs (last 100 lines)"
6767
echo '```'
68-
docker logs charon-debug 2>&1 | tail -100 || echo "No container logs available"
68+
docker logs charon-waf-test 2>&1 | tail -100 || echo "No container logs available"
6969
echo '```'
7070
echo ""
7171
7272
echo "### WAF Ruleset Files"
7373
echo '```'
74-
docker exec charon-debug sh -c 'ls -la /app/data/caddy/coraza/rulesets/ 2>/dev/null && echo "---" && cat /app/data/caddy/coraza/rulesets/*.conf 2>/dev/null' || echo "No ruleset files found"
74+
docker exec charon-waf-test sh -c 'ls -la /app/data/caddy/coraza/rulesets/ 2>/dev/null && echo "---" && cat /app/data/caddy/coraza/rulesets/*.conf 2>/dev/null' || echo "No ruleset files found"
7575
echo '```'
7676
} >> "$GITHUB_STEP_SUMMARY"
7777
@@ -100,6 +100,6 @@ jobs:
100100
- name: Cleanup
101101
if: always()
102102
run: |
103-
docker rm -f charon-debug || true
104-
docker rm -f coraza-backend || true
103+
docker rm -f charon-waf-test || true
104+
docker rm -f waf-backend || true
105105
docker network rm containers_default || true

.github/workflows/weekly-nightly-promotion.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@ jobs:
4848
- name: Check Nightly Workflow Status
4949
id: check
5050
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
51+
env:
52+
SKIP_WORKFLOW_CHECK: ${{ inputs.skip_workflow_check }}
5153
with:
5254
script: |
53-
const skipCheck = '${{ inputs.skip_workflow_check }}' === 'true';
55+
const skipCheck = process.env.SKIP_WORKFLOW_CHECK === 'true';
5456
5557
if (skipCheck) {
5658
core.info('Skipping workflow health check as requested');
@@ -298,6 +300,8 @@ jobs:
298300
id: create-pr
299301
if: steps.check-diff.outputs.skipped != 'true' && steps.existing-pr.outputs.exists != 'true'
300302
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
303+
env:
304+
TRIGGER_REASON: ${{ inputs.reason }}
301305
with:
302306
script: |
303307
const fs = require('fs');
@@ -307,7 +311,7 @@ jobs:
307311
const filesChanged = '${{ steps.commits.outputs.files_changed }}';
308312
const commitLog = fs.readFileSync('/tmp/commit_log.md', 'utf8');
309313
310-
const triggerReason = '${{ inputs.reason }}' || 'Scheduled weekly promotion';
314+
const triggerReason = process.env.TRIGGER_REASON || 'Scheduled weekly promotion';
311315
312316
const body = `## 🚀 Weekly Nightly to Main Promotion
313317
@@ -484,11 +488,14 @@ jobs:
484488
steps:
485489
- name: Create Failure Issue
486490
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
491+
env:
492+
FAILURE_REASON: ${{ needs.check-nightly-health.outputs.failure_reason }}
493+
LATEST_RUN_URL: ${{ needs.check-nightly-health.outputs.latest_run_url }}
487494
with:
488495
script: |
489496
const isHealthy = '${{ needs.check-nightly-health.outputs.is_healthy }}';
490-
const failureReason = '${{ needs.check-nightly-health.outputs.failure_reason }}';
491-
const latestRunUrl = '${{ needs.check-nightly-health.outputs.latest_run_url }}';
497+
const failureReason = process.env.FAILURE_REASON || '';
498+
const latestRunUrl = process.env.LATEST_RUN_URL || 'N/A';
492499
const prResult = '${{ needs.create-promotion-pr.result }}';
493500
494501
let title, body;
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: "Manual Test Plan - Issue #1022: Apostrophe in Workflow Dispatch Reason Crashes Weekly Promotion"
3+
status: Open
4+
priority: Medium
5+
labels: testing, ci
6+
---
7+
8+
# Test Objective
9+
10+
Confirm that the `weekly-nightly-promotion` workflow completes successfully when the manual trigger `reason` field contains an apostrophe (e.g., `it's`), and that the PR body reflects the reason correctly.
11+
12+
# What Was Fixed
13+
14+
The `Create Promotion PR` step previously injected `${{ inputs.reason }}` directly into a bash heredoc. An apostrophe in the reason value (e.g., `it's an ad-hoc run`) broke the shell quoting and caused the step to fail with a syntax error.
15+
16+
The fix moves `inputs.reason` into a dedicated `TRIGGER_REASON` environment variable, which is then read inside the `actions/github-script` step via `process.env.TRIGGER_REASON`. This isolates the user-supplied string from the shell entirely.
17+
18+
Manual testing is required because this workflow runs against the live GitHub Actions environment and cannot be fully covered by unit or integration tests.
19+
20+
# Prerequisites
21+
22+
- Write access to the repository (to trigger `workflow_dispatch`).
23+
- The `nightly` branch must exist and have at least one commit ahead of `main`, **or** `skip_workflow_check` must be set to `true` to bypass the health gate.
24+
- A GitHub account with permission to view Actions run logs.
25+
26+
# Manual Scenarios
27+
28+
## 1) Apostrophe in reason — primary regression check
29+
30+
- [ ] Navigate to **Actions → Weekly Nightly to Main Promotion → Run workflow**.
31+
- [ ] Set **Why are you running this manually?** to: `it's a manual test run`
32+
- [ ] Set **Skip nightly workflow status check?** to `true` (avoids a failing nightly blocking the test).
33+
- [ ] Click **Run workflow**.
34+
- [ ] Wait for the run to complete.
35+
- [ ] **Expected**: The run completes without a syntax error. All jobs show green (or the run skips the PR-creation job with "No changes to promote" if `nightly` is already up-to-date with `main` — both are acceptable outcomes).
36+
- [ ] Open the run logs for the **Create Promotion PR** step.
37+
- [ ] **Expected**: No `syntax error` or `unexpected token` entries in the log.
38+
- [ ] If a PR was created, open it and confirm the **Trigger** line in the PR body reads: `it's a manual test run`.
39+
40+
## 2) Double apostrophe / multiple special characters
41+
42+
- [ ] Trigger the workflow again with reason: `can't stop, won't stop`
43+
- [ ] Set **Skip nightly workflow status check?** to `true`.
44+
- [ ] **Expected**: Run completes. PR body (if created) or log output contains the reason verbatim.
45+
46+
## 3) Plain-text reason — regression check
47+
48+
- [ ] Trigger the workflow with reason: `Ad-hoc promotion request` (the default value, no special characters).
49+
- [ ] **Expected**: Run behaves identically to before the fix. No regressions introduced.
50+
51+
## 4) Scheduled trigger (no `inputs.reason`)
52+
53+
- [ ] Review a recent scheduled Monday run in the Actions history (or re-run one).
54+
- [ ] **Expected**: The `TRIGGER_REASON` env var falls back to `'Scheduled weekly promotion'` and the PR body reflects that. No errors introduced by the env-var change.
55+
56+
# Expected Results
57+
58+
| Scenario | Expected outcome |
59+
|---|---|
60+
| Reason with apostrophe | Workflow completes; no shell syntax error |
61+
| Reason with multiple special chars | Workflow completes; reason appears verbatim in PR body |
62+
| Plain-text reason | No regression; workflow behaves as before |
63+
| Scheduled run | Fallback reason used; no errors |
64+
65+
# Pass / Fail Criteria
66+
67+
**PASS** — All four scenarios complete without a `syntax error` or `unexpected token` in the logs, and user-supplied reason text appears correctly in the PR body or step output.
68+
69+
**FAIL** — Any scenario produces a shell syntax error, an unexpected token error, or the reason field is garbled/missing in the PR body.
70+
71+
# Related
72+
73+
- Issue #1022 — Apostrophe in `workflow_dispatch` reason causes syntax error in weekly promotion workflow

docs/plans/current_spec.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,8 @@ watchHeartbeat: sess.IsAlive() == false
545545
| `backend/internal/api/handlers/docker_handler_test.go` | Modify | Add orthrus resolver tests |
546546
| `backend/internal/orthrus/proxy_integration_test.go` | Create | Integration test stub (`//go:build integration`) |
547547

548-
---
548+
This is a 5-line change to one file. No scaffolding, no test setup, no
549+
multi-phase implementation. The entire work is one atomic commit.
549550

550551
## 7. Implementation Plan
551552

0 commit comments

Comments
 (0)