-
Notifications
You must be signed in to change notification settings - Fork 2
CI: [BIPS-28458] Automation tests workflow added #147
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
Changes from 19 commits
32bbd03
338fba7
f13bdaf
69bd563
c0b7c6d
cee199a
8b678bc
1122a4f
313bd71
6d29e2f
fee68fc
fde57dd
ea23ee9
1906941
e8c9b31
0846500
703d5a0
943ef49
6c66983
17de55d
79a370d
bbed6fe
0d3da74
a229087
13e1bd3
f1e758b
f41e310
b7d0531
68acb1a
4056639
22163f7
a7281f3
2647725
b72faed
7765d07
936b7ad
8cc3f9b
ddb87d0
1d25ee5
f9a8894
b398b61
c2dd87b
8784375
658d1e3
7caecc3
2259d4d
555c2d7
0d4d8c4
06481bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,137 @@ | ||||||||||||||||||||||||||||||||||||
| name: Automation Tests | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||
| types: [opened, synchronize] | ||||||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||
| automation-test-run: | ||||||||||||||||||||||||||||||||||||
| name: Automation Tests | ||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest # Specify the operating system for the job's virtual machine | ||||||||||||||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||||||||||||||
| conclusion: ${{ steps.check_run.outputs.conclusion }} | ||||||||||||||||||||||||||||||||||||
| url: ${{ steps.check_run.outputs.url }} | ||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||
| - name: 'Triggering Automation workflow: existing-instance-trigger.yml' | ||||||||||||||||||||||||||||||||||||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| github-token: ${{ secrets.AUTOMATION_PAT }} | ||||||||||||||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||||||||||||||
| await github.rest.actions.createWorkflowDispatch({ | ||||||||||||||||||||||||||||||||||||
| owner: 'BeyondTrust', | ||||||||||||||||||||||||||||||||||||
| repo: 'ps-integration-test-automation', | ||||||||||||||||||||||||||||||||||||
| workflow_id: 'existing-instance-trigger.yml', | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||||||||||||||||||||||||||||||||||||
| ref: 'main', | ||||||||||||||||||||||||||||||||||||
| inputs: { | ||||||||||||||||||||||||||||||||||||
| customerkey: 'psqaint', | ||||||||||||||||||||||||||||||||||||
| integration: 'terraform', | ||||||||||||||||||||||||||||||||||||
| allowed_ips: '134.238.247.191,134.238.247.192,10.0.0.0/8', | ||||||||||||||||||||||||||||||||||||
| repo_path: 'eng-tf-provider-dev-local/beyondtrust/passwordsafe/terraform-provider-passwordsafe/v1.0.5/terraform-provider-passwordsafe_1.0.5_linux_amd64.zip', | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
| os_type: 'linux' | ||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Wait until workflow information is available | ||||||||||||||||||||||||||||||||||||
| run: sleep 10s | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Checking Automation tests workflow's status | ||||||||||||||||||||||||||||||||||||
| id: check_run | ||||||||||||||||||||||||||||||||||||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| github-token: ${{ secrets.AUTOMATION_PAT }} | ||||||||||||||||||||||||||||||||||||
| script: | | ||||||||||||||||||||||||||||||||||||
| var status; | ||||||||||||||||||||||||||||||||||||
| var conclusion; | ||||||||||||||||||||||||||||||||||||
| var url; | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| while(status != 'completed'){ | ||||||||||||||||||||||||||||||||||||
| const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', { | ||||||||||||||||||||||||||||||||||||
| owner: 'BeyondTrust', | ||||||||||||||||||||||||||||||||||||
| repo: 'ps-integration-test-automation', | ||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above. |
||||||||||||||||||||||||||||||||||||
| event: 'workflow_dispatch' | ||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+165
to
+170
|
||||||||||||||||||||||||||||||||||||
| while(status != 'completed'){ | |
| const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', { | |
| owner: 'BeyondTrust', | |
| repo: 'ps-integration-test-automation', | |
| event: 'workflow_dispatch' | |
| }); | |
| while (status != 'completed') { | |
| const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', { | |
| owner: 'BeyondTrust', | |
| repo: 'ps-integration-test-automation', | |
| event: 'workflow_dispatch' | |
| }); | |
| if (!workflow.data.workflow_runs || workflow.data.workflow_runs.length === 0) { | |
| // No workflow runs found yet, wait and retry | |
| await new Promise(resolve => setTimeout(resolve, 5000)); | |
| continue; | |
| } |
Copilot
AI
Aug 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This polling loop has no timeout or sleep interval, which could cause excessive API calls and potentially hit GitHub API rate limits. Add a sleep delay between iterations and implement a timeout mechanism.
Copilot
AI
Aug 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The word 'failure' should be 'failed' for grammatical correctness in this context.
| ### Automation tests are **failure**`; | |
| ### Automation tests are **failed**`; |
Copilot
AI
Aug 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using asynchronous fs.writeFile without awaiting it can cause the next step to execute before the file is written. Use fs.writeFileSync or properly await the asynchronous operation.
| fs.writeFile('message.txt', output, (err) => { | |
| if (err) throw err; | |
| }); | |
| fs.writeFileSync('message.txt', output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use it from environment variable rather then hard coding it here or, showing our private repo name here ?