Skip to content
Closed
Changes from 19 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
32bbd03
CI: testing automation tests
ivgonzalezc Aug 19, 2025
338fba7
CI: testing automation tests
ivgonzalezc Aug 20, 2025
f13bdaf
CI: testing automation tests
ivgonzalezc Aug 25, 2025
69bd563
CI: testing automation tests
ivgonzalezc Aug 27, 2025
c0b7c6d
CI: testing automation tests
ivgonzalezc Aug 27, 2025
cee199a
CI: testing automation tests
ivgonzalezc Aug 27, 2025
8b678bc
CI: testing automation tests
ivgonzalezc Aug 27, 2025
1122a4f
CI: testing automation tests
ivgonzalezc Aug 27, 2025
313bd71
CI: testing automation tests
ivgonzalezc Aug 27, 2025
6d29e2f
CI: testing automation tests
ivgonzalezc Aug 27, 2025
fee68fc
CI: testing automation tests
ivgonzalezc Aug 27, 2025
fde57dd
CI: testing automation tests
ivgonzalezc Aug 28, 2025
ea23ee9
CI: testing automation tests
ivgonzalezc Aug 28, 2025
1906941
CI: testing automation tests
ivgonzalezc Aug 28, 2025
e8c9b31
CI: testing automation tests
ivgonzalezc Aug 28, 2025
0846500
CI: testing automation tests
ivgonzalezc Aug 28, 2025
703d5a0
CI: testing automation tests
ivgonzalezc Aug 28, 2025
943ef49
CI: Automation tests workflow added
ivgonzalezc Aug 28, 2025
6c66983
CI: Cleaning workflows
ivgonzalezc Aug 28, 2025
17de55d
CI: Potential fix for code scanning alert no. 8: Workflow does not co…
ivgonzalezc Aug 28, 2025
79a370d
CI: fixing issue on PR
ivgonzalezc Aug 28, 2025
bbed6fe
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
0d3da74
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
a229087
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
13e1bd3
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
f1e758b
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
f41e310
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
b7d0531
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
68acb1a
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
4056639
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
22163f7
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
a7281f3
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
2647725
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
b72faed
CI: updating resolving comments
ivgonzalezc Sep 1, 2025
7765d07
CI: Automation tests workflow added
ivgonzalezc Sep 2, 2025
936b7ad
CI: Fixing security findings
ivgonzalezc Sep 3, 2025
8cc3f9b
CI: testing env vars
ivgonzalezc Sep 12, 2025
ddb87d0
CI: testing env vars
ivgonzalezc Sep 12, 2025
1d25ee5
CI: testing env vars
ivgonzalezc Sep 12, 2025
f9a8894
CI: frogbot updated
ivgonzalezc Sep 17, 2025
b398b61
CI: frogbot updated
ivgonzalezc Sep 17, 2025
c2dd87b
CI: frogbot updated
ivgonzalezc Sep 17, 2025
8784375
CI: Automation tests updated
ivgonzalezc Oct 16, 2025
658d1e3
CI: Automation tests updated
ivgonzalezc Oct 16, 2025
7caecc3
CI: Merge branch main into BIPS-28458-automation-tests
ivgonzalezc Oct 16, 2025
2259d4d
CI: Merge branch main into BIPS-28458-automation-tests
ivgonzalezc Oct 16, 2025
555c2d7
CI: Automation tests updated
ivgonzalezc Oct 16, 2025
0d4d8c4
CI: Automation tests updated
ivgonzalezc Oct 16, 2025
06481bc
CI: Trigger workflows
ivgonzalezc Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions .github/workflows/automation-tests.yml
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',

Copy link
Copy Markdown

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 ?

workflow_id: 'existing-instance-trigger.yml',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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',

Copilot AI Aug 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded version '1.0.5' and specific file path should be parameterized or made configurable to avoid manual updates when versions change.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove hardcoded values.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all hardcoded value.

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',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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

Copilot AI Aug 28, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 uses AI. Check for mistakes.
status = workflow.data.workflow_runs[0].status;
conclusion = workflow.data.workflow_runs[0].conclusion;
url = workflow.data.workflow_runs[0].html_url;
}
Comment on lines +165 to +182

Copilot AI Aug 28, 2025

Copy link

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 uses AI. Check for mistakes.

core.setOutput("conclusion", conclusion);
core.setOutput("url", url);

automation-test-PR:
Comment thread Fixed
name: Automation test result publish on PR
needs: [automation-test-run]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
pull-requests: write
actions: read
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Make comment
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
var output;
var url = '${{ needs.automation-test-run.outputs.url }}';
var conclusion = '${{ needs.automation-test-run.outputs.conclusion }}';

if (conclusion === 'success') {
output = `## Automation tests Checked

### Automation tests are **successful**
`;
} else {
output = `## Automation tests Checked

### Automation tests are **failure**`;

Copilot AI Aug 28, 2025

Copy link

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.

Suggested change
### Automation tests are **failure**`;
### Automation tests are **failed**`;

Copilot uses AI. Check for mistakes.
output+="\nPlease check the Automation tests run [here]("+url+")";
}

const fs = require('fs');
fs.writeFile('message.txt', output, (err) => {
if (err) throw err;
});
Comment on lines +223 to +225

Copilot AI Aug 28, 2025

Copy link

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.

Suggested change
fs.writeFile('message.txt', output, (err) => {
if (err) throw err;
});
fs.writeFileSync('message.txt', output);

Copilot uses AI. Check for mistakes.

- name: Post Comment
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2.8.2
with:
message-path: |
message.txt

- name: Set state for Automation test workflow
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
if (conclusion != 'success') {
core.setFailed(`Automation tests fail, please refer to PR comment for details`);
}

automation-test-dispatch:
name: Automation test result publish on Workflow Dispatch
needs: [automation-test-run]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Set state for Automation test workflow
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
var output;
var url = '${{ needs.automation-test-run.outputs.url }}';
var conclusion = '${{ needs.automation-test-run.outputs.conclusion }}';
if (conclusion != 'success') {
output = "Automation tests fail, please check the Automation tests run here: "+url;
core.setFailed(output);
}
Comment thread Fixed
Loading