CI: [BIPS-28458] Automation tests workflow added#147
Conversation
…ntain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Signed-off-by: Ivan Gonzalez <135244609+ivgonzalezc@users.noreply.github.com>
Automation tests CheckedAutomation tests failedPlease check the Automation tests run here |
There was a problem hiding this comment.
Pull Request Overview
This PR adds a GitHub Actions workflow for running automation tests in the integrations lifecycle. The workflow triggers external automation tests and reports results back to pull requests or workflow dispatch events.
- Automation workflow integration with external test repository
- PR comment generation for test results
- Support for both pull request and manual workflow dispatch triggers
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| while(status != 'completed'){ | ||
| const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', { | ||
| owner: 'BeyondTrust', | ||
| repo: 'ps-integration-test-automation', | ||
| event: 'workflow_dispatch' | ||
| }); | ||
| status = workflow.data.workflow_runs[0].status; | ||
| conclusion = workflow.data.workflow_runs[0].conclusion; | ||
| url = workflow.data.workflow_runs[0].html_url; | ||
| } |
There was a problem hiding this comment.
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.
| while(status != 'completed'){ | ||
| const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', { | ||
| owner: 'BeyondTrust', | ||
| repo: 'ps-integration-test-automation', | ||
| event: 'workflow_dispatch' | ||
| }); |
There was a problem hiding this comment.
Accessing workflow_runs[0] without checking if the array is empty could cause a runtime error. The API response might not contain any workflow runs, especially immediately after triggering the workflow.
| 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; | |
| } |
| } else { | ||
| output = `## Automation tests Checked | ||
|
|
||
| ### Automation tests are **failure**`; |
There was a problem hiding this comment.
The word 'failure' should be 'failed' for grammatical correctness in this context.
| ### Automation tests are **failure**`; | |
| ### Automation tests are **failed**`; |
| 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', |
There was a problem hiding this comment.
The hardcoded version '1.0.5' and specific file path should be parameterized or made configurable to avoid manual updates when versions change.
| fs.writeFile('message.txt', output, (err) => { | ||
| if (err) throw err; | ||
| }); |
There was a problem hiding this comment.
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); |
| script: | | ||
| await github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'BeyondTrust', | ||
| repo: 'ps-integration-test-automation', |
There was a problem hiding this comment.
Can we use it from environment variable rather then hard coding it here or, showing our private repo name here ?
| await github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'BeyondTrust', | ||
| repo: 'ps-integration-test-automation', | ||
| workflow_id: 'existing-instance-trigger.yml', |
| while(status != 'completed'){ | ||
| const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', { | ||
| owner: 'BeyondTrust', | ||
| repo: 'ps-integration-test-automation', |
| 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', |

Purpose of the PR
Add Automation tests to Integrations lifecycle
According to ticket
BIPS-28458
Summary of changes: