Repository navigation
chore(ci): use yaml config file for e2e credentials - #3031
Conversation
Paco ReviewThe PR moves E2E test configuration from individual GitHub Actions environment variables/secrets into a single YAML config file secret ( Paco found no new confirmed issues in the code reviewed. Note Take this AI review with a grain of salt and use it alongside tests and human review. 2 candidates not published
Reviewed commit: 18de39b. 0 verified findings; 0 summary-only. |
| Secret string `env:"TEST_BITBUCKET_CLOUD_SECRET" json:"secret" yaml:"secret"` | ||
| E2ERepository string `env:"TEST_BITBUCKET_CLOUD_E2E_REPOSITORY" json:"e2e_repository" yaml:"e2e_repository"` | ||
| APIURL string `env:"TEST_BITBUCKET_CLOUD_API_URL" json:"api_url" yaml:"api_url"` | ||
| User string `env:"TEST_BITBUCKET_CLOUD_USER" json:"user" yaml:"user"` |
There was a problem hiding this comment.
[HIGH] The old field Secret string (env tag TEST_BITBUCKET_CLOUD_SECRET) has been renamed to WebhookSecret string (env tag TEST_BITBUCKET_CLOUD_WEBHOOK_SECRET). Any existing call sites that reference cfg.BitbucketCloud.Secret will fail to compile, and any code that set TEST_BITBUCKET_CLOUD_SECRET in the environment will silently receive an empty string instead of the expected value. Confirm all consumers of this field have been updated to use WebhookSecret and that the old env-var name is no longer set anywhere in tests or CI scripts.
e16c6ca to
47eb242
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The migration introduces shell interpretation, missing credentials, older-branch compatibility failures, and incomplete log redaction.
4 open findings
What changed in this PR
Moves E2E test credentials into a YAML configuration supplied through a GitHub Secret.
Changes:
- Replaces job-level credential variables with configuration-file loading.
- Adds GitHub Enterprise fields and aligns Bitbucket Cloud webhook-secret configuration.
- Retains dynamic test values as workflow environment variables.
| File | Description |
|---|---|
test/pkg/configfile/config.go |
Updates provider configuration fields and mappings. |
test/e2e-config.yaml.example |
Documents the additional credential fields. |
.github/workflows/e2e.yaml |
Writes the secret-backed configuration and reduces environment declarations. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # Remove the old label check which is no longer relevant for triggering. | ||
| if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request_target' }} | ||
| env: | ||
| # Dynamic runtime values (override config file) |
| if: ${{ always() }} | ||
| env: | ||
| TEST_GITHUB_SECOND_SMEE_URL: ${{ secrets.TEST_GITHUB_SECOND_SMEE_URL }} | ||
| TEST_GITHUB_SECOND_WEBHOOK_SMEE_URL: ${{ steps.gosmee-ghe-webhook-url.outputs.url }} |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3031 +/- ##
=======================================
Coverage 91.98% 91.98%
=======================================
Files 167 167
Lines 12976 12976
=======================================
Hits 11936 11936
Misses 1039 1039
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| - name: Run gosmee for second controller GHE App | ||
| if: startsWith(matrix.provider, 'github_ghe') || matrix.provider == 'concurrency' | ||
| env: | ||
| TEST_GITHUB_SECOND_SMEE_URL: ${{ secrets.TEST_GITHUB_SECOND_SMEE_URL }} |
There was a problem hiding this comment.
Only this secret needs to be maintained separately in addition to the config file secret
47eb242 to
ac937ec
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Credential masking, secret references, older-PR compatibility, and GitLab overrides need correction before merging.
7 open issues
Mask parsed credentials before running tests · New Preserve GitHub token and host configuration · New Preserve webhook secret configuration · New Remove CI overrides for GitLab configuration · New Preserve compatibility with existing pull request heads · New Restore GHE relay URL secret for log redaction Preserve compatibility exports for older PR heads
2 resolved since last review
Review effort: Balanced
| printf '%s\n' "$E2E_CONFIG_YAML" > /tmp/e2e-config.yaml | ||
| echo "PAC_E2E_CONFIG=/tmp/e2e-config.yaml" >> "$GITHUB_ENV" |
| TEST_GITHUB_TOKEN: ${{ secrets.TEST_GITHUB_TOKEN }} | ||
| TEST_GITHUB_API_URL: ${{ secrets.TEST_GITHUB_API_URL }} |
| VARS_TEST_GITHUB_SECOND_APPLICATION_ID: ${{ vars.TEST_GITHUB_SECOND_APPLICATION_ID }} | ||
| APPLICATION_ID: ${{ vars.APPLICATION_ID }} | ||
| APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | ||
| TEST_EL_WEBHOOK_SECRET: ${{ secrets.TEST_EL_WEBHOOK_SECRET }} |
| run: | | ||
| umask 077 | ||
| printf '%s\n' "$E2E_CONFIG_YAML" > /tmp/e2e-config.yaml | ||
| echo "PAC_E2E_CONFIG=/tmp/e2e-config.yaml" >> "$GITHUB_ENV" |
| run: | | ||
| umask 077 | ||
| printf '%s\n' "$E2E_CONFIG_YAML" > /tmp/e2e-config.yaml | ||
| echo "PAC_E2E_CONFIG=/tmp/e2e-config.yaml" >> "$GITHUB_ENV" |
|
this is fine by me if it workeds :D probably want to keep the secret so we can revert if needed |
Still need to test it so kept it in draft. |
|
/paco review |
Replace hardcoded provider env vars in the e2e workflow with a YAML config file loaded from the E2E_CONFIG_YAML secret and exposed through PAC_E2E_CONFIG. Secrets still needed by shell steps (rate-limit check, startpaac, gosmee, log scrubbing) stay as step-scoped env vars. Add GHE webhook token, webhook secret and application ID to the config schema and rename the Bitbucket Cloud secret to webhook_secret to match the env var the tests read. Update the example config and README. Signed-off-by: Akshay Pant <akpant@redhat.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ac937ec to
18de39b
Compare
|
/paco review |
The e2e workflow still needed eight separate secrets and two variables next to the E2E_CONFIG_YAML secret, for the GitHub App keys, the relay URLs, the webhook secret and the cleanup job tokens. Keeping the same value in two places made it easy for them to drift apart. The GitHub App IDs, private keys and relay URL now live in the config file too. Each workflow step reads the values it needs from the file and exports them for that step only. The cleanup job reads its tokens from the same file instead of the old GH_APPS_TOKEN secret. The step that writes the file now also hides every token, secret, password, key and relay URL in the logs one by one, because GitHub only hides a multi-line secret line by line. The cluster setup also passes the GitHub Enterprise host name from the file again. Without it, the second controller did not trust that host until a GitHub App event happened to arrive first, so webhook tests could fail at random.
|
I tested this on my fork with a single I pushed one commit on top of yours with what I needed to get there:
Before merging we need to create Follow-ups: pipelines-as-code/startpaac#35 to let startpaac read this file directly, and #3076 to clean up the env var naming. |
|
Also tested on upstream. I set the The first attempt had 6 failures because the hook.pipelinesascode.com relay was down for a VM update between 14:06 and 14:13 UTC. Webhook events were lost and those tests timed out. All 6 jobs passed on the rerun. I also checked the logs of both attempts for every token, secret, password, key and smee URL in the config, and none of them showed up unmasked. Merging now. Open PRs need to rebase on main after this so their e2e runs pick up the new config fields. The old secrets stay in place until the release branches are moved over too (backports to release-v0.52.x, release-v0.50.x and release-v0.48.x, each tested on its own branch first). |


📝 Description of the Change
Replace hardcoded provider env vars in the e2e workflow with a YAML
config file loaded from the E2E_CONFIG_YAML secret and exposed through
PAC_E2E_CONFIG.
Secrets still needed by shell steps (rate-limit check, startpaac,
gosmee, log scrubbing) stay as step-scoped env vars. Add GHE webhook
token, webhook secret and application ID to the config schema and
rename the Bitbucket Cloud secret to webhook_secret to match the env
var the tests read. Update the example config and README.
🔗 Linked GitHub Issue
N/A
🧪 Testing Strategy
🤖 AI Assistance
AI assistance can be used for various tasks, such as code generation,
documentation, or testing.
Please indicate whether you have used AI assistance
for this PR and provide details if applicable.
Important
Slop will be simply rejected, if you are using AI assistance you need to make sure you
understand the code generated and that it meets the project's standards. you
need at least know how to run the code and deploy it (if needed). See
startpaac to make it easy
to deploy and test your code changes.
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Claude noreply@anthropic.com
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.