-
Notifications
You must be signed in to change notification settings - Fork 6
feat(wg-easy): add weekly automated chart validation tests #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adamancini
wants to merge
8
commits into
main
Choose a base branch
from
add-wg-easy-weekly-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0ac86ff
feat(wg-easy): add weekly automated chart validation tests
adamancini 44abe21
test: add temporary PR trigger for weekly test workflow
adamancini e748b59
fix: correct namespace in health check from default to wg-easy
adamancini 46238e8
chore: remove temporary PR trigger after successful testing
adamancini 094bee9
feat(wg-easy): add automated README status updates from test results
adamancini 21df983
refactor(wg-easy): reduce duplication by making pr-validation a reusa…
adamancini 97e37e9
fix(wg-easy): address Copilot review feedback on weekly test workflow
adamancini a2319e2
fix(wg-easy): anchor README status update on markers, not line number
adamancini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,212 @@ | ||
| --- | ||
| name: WG-Easy Weekly Test - Verify Chart Installation | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run every Monday at 9:00 AM UTC (1:00 AM PST / 4:00 AM EST) | ||
| - cron: '0 9 * * 1' | ||
| workflow_dispatch: | ||
| inputs: | ||
| notify_on_success: | ||
| description: 'Send notification even on success' | ||
| required: false | ||
| default: 'false' | ||
| type: boolean | ||
|
|
||
| concurrency: | ||
| group: wg-easy-weekly-test | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| run-tests: | ||
| uses: ./.github/workflows/wg-easy-pr-validation.yaml | ||
| with: | ||
| channel-name: weekly-test | ||
| customer-name: weekly-test-customer | ||
| cleanup-cluster: true | ||
| secrets: | ||
| WG_EASY_REPLICATED_API_TOKEN: ${{ secrets.WG_EASY_REPLICATED_API_TOKEN }} | ||
|
|
||
| notify-on-failure: | ||
| runs-on: ubuntu-24.04 | ||
| needs: run-tests | ||
| if: failure() | ||
| permissions: | ||
| issues: write | ||
| steps: | ||
| - name: Create GitHub Issue on Failure | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | ||
| const issueTitle = `[Weekly Test Failure] WG-Easy chart installation failed - ${new Date().toISOString().split('T')[0]}`; | ||
| const issueBody = `## Weekly Test Failure Report | ||
|
|
||
| The weekly automated test for the WG-Easy Helm chart has failed. | ||
|
|
||
| **Workflow Run:** ${runUrl} | ||
| **Date:** ${new Date().toISOString()} | ||
| **Trigger:** ${context.eventName === 'schedule' ? 'Scheduled weekly test' : 'Manual workflow dispatch'} | ||
|
|
||
| ### Failed Jobs | ||
| Check the workflow run for detailed logs and failure information. | ||
|
|
||
| ### Next Steps | ||
| 1. Review the workflow logs at the link above | ||
| 2. Investigate the root cause of the failure | ||
| 3. Fix any issues with the chart or dependencies | ||
| 4. Re-run the workflow to verify the fix | ||
|
|
||
| ### Related Files | ||
| - Chart: \`applications/wg-easy/charts/wg-easy/\` | ||
| - Workflow: \`.github/workflows/wg-easy-weekly-test.yaml\` | ||
|
|
||
| --- | ||
| *This issue was automatically created by the weekly test workflow.*`; | ||
|
|
||
| // Check if there's already an open issue for today | ||
| const issues = await github.rest.issues.listForRepo({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| state: 'open', | ||
| labels: 'automated-test,wg-easy', | ||
| per_page: 10 | ||
| }); | ||
|
|
||
| const existingIssue = issues.data.find(issue => | ||
| issue.title.includes('[Weekly Test Failure]') && | ||
| issue.title.includes(new Date().toISOString().split('T')[0]) | ||
| ); | ||
|
|
||
| if (existingIssue) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: existingIssue.number, | ||
| body: `Another test failure occurred in the same day.\n\n**Latest Run:** ${runUrl}` | ||
| }); | ||
| console.log(`Updated existing issue #${existingIssue.number}`); | ||
| } else { | ||
| const issue = await github.rest.issues.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: issueTitle, | ||
| body: issueBody, | ||
| labels: ['automated-test', 'wg-easy', 'bug'] | ||
| }); | ||
| console.log(`Created issue #${issue.data.number}`); | ||
| } | ||
|
|
||
| notify-on-success: | ||
| runs-on: ubuntu-24.04 | ||
| needs: run-tests | ||
| if: success() && (github.event.inputs.notify_on_success == 'true' || github.event_name == 'schedule') | ||
| permissions: | ||
| issues: write | ||
| steps: | ||
| - name: Comment on latest open issue if exists | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | ||
|
|
||
| const issues = await github.rest.issues.listForRepo({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| state: 'open', | ||
| labels: 'automated-test,wg-easy', | ||
| sort: 'created', | ||
| direction: 'desc', | ||
| per_page: 10 | ||
| }); | ||
|
|
||
| // Only comment on issues that are weekly test failure reports | ||
| const failureIssue = issues.data.find(issue => | ||
| issue.title.includes('[Weekly Test Failure]') | ||
| ); | ||
|
|
||
| if (failureIssue) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: failureIssue.number, | ||
| body: `✅ **Weekly test passed!**\n\nThe WG-Easy chart is now installing and working correctly.\n\n**Successful Run:** ${runUrl}\n\nConsider closing this issue if the problem is resolved.` | ||
| }); | ||
adamancini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| console.log(`Added success comment to issue #${failureIssue.number}`); | ||
| } else { | ||
| console.log('No open weekly test failure issues found - weekly test passed successfully!'); | ||
| } | ||
|
|
||
| update-readme-status: | ||
| runs-on: ubuntu-24.04 | ||
| needs: run-tests | ||
| if: always() && github.event_name == 'schedule' | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Update README with test results | ||
| run: | | ||
| README_PATH="applications/wg-easy/README.md" | ||
|
|
||
| if [ "${{ needs.run-tests.outputs.test-result }}" == "success" ]; then | ||
| STATUS="✅ Passing" | ||
| else | ||
| STATUS="❌ Failed" | ||
| fi | ||
|
|
||
| TEST_DATE=$(date -u +"%Y-%m-%d %H:%M UTC") | ||
| RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
|
|
||
| # Write only the inner content (the markers remain in place as anchors) | ||
| cat > /tmp/status_inner.md <<EOF | ||
|
|
||
| ## Test Status | ||
|
|
||
| | Component | Status | Last Tested | Kubernetes Version | Details | | ||
| |-----------|--------|-------------|--------------------|---------| | ||
| | Chart Installation | ${STATUS} | ${TEST_DATE} | v1.33 / v1.34 / v1.35 | [View Run](${RUN_URL}) | | ||
|
|
||
| *Status automatically updated by [weekly test workflow](${RUN_URL})* | ||
|
|
||
| EOF | ||
|
|
||
| # Replace content between the marker comments, keeping the markers as anchors | ||
| sed -i.bak '/<!-- TEST_STATUS_START -->/,/<!-- TEST_STATUS_END -->/{ | ||
| /<!-- TEST_STATUS_START -->/{ | ||
| r /tmp/status_inner.md | ||
| } | ||
| /<!-- TEST_STATUS_START -->/!{/<!-- TEST_STATUS_END -->/!d} | ||
| }' "$README_PATH" | ||
| rm -f "${README_PATH}.bak" | ||
|
|
||
| echo "Updated README with test status: ${STATUS}" | ||
|
|
||
| - name: Check for changes | ||
| id: check_changes | ||
| run: | | ||
| if git diff --quiet applications/wg-easy/README.md; then | ||
| echo "changed=false" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "changed=true" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Commit and push changes | ||
| if: steps.check_changes.outputs.changed == 'true' | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| git add applications/wg-easy/README.md | ||
| git commit -m "chore(wg-easy): update test status in README [skip ci] | ||
|
|
||
| Automated test status update from weekly test workflow. | ||
|
|
||
| Status: ${{ needs.run-tests.outputs.test-result }} | ||
| Run: ${{ github.run_id }}" | ||
|
|
||
| git push | ||
adamancini marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.