Skip to content

CI: [BIPS-28458] Automation tests workflow added#147

Closed
ivgonzalezc wants to merge 49 commits into
mainfrom
BIPS-28458-automation-tests
Closed

CI: [BIPS-28458] Automation tests workflow added#147
ivgonzalezc wants to merge 49 commits into
mainfrom
BIPS-28458-automation-tests

Conversation

@ivgonzalezc
Copy link
Copy Markdown
Contributor

@ivgonzalezc ivgonzalezc commented Aug 28, 2025

Purpose of the PR

Add Automation tests to Integrations lifecycle

According to ticket

BIPS-28458

Summary of changes:

  • Automation tests workflow added

@ivgonzalezc ivgonzalezc requested a review from a team as a code owner August 28, 2025 14:40
Comment thread .github/workflows/automation-tests.yml Fixed
Comment thread .github/workflows/automation-tests.yml Fixed
…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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 28, 2025

Automation tests Checked

Automation tests failed

Please check the Automation tests run here

@RanjitMishraBT RanjitMishraBT requested a review from Copilot August 28, 2025 18:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +50 to +59
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;
}
Copy link

Copilot AI Aug 28, 2025

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.
Comment on lines +50 to +55
while(status != 'completed'){
const workflow = await github.request('GET /repos/{owner}/{repo}/actions/runs', {
owner: 'BeyondTrust',
repo: 'ps-integration-test-automation',
event: 'workflow_dispatch'
});
Copy link

Copilot AI Aug 28, 2025

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.
Comment thread .github/workflows/automation-tests.yml Outdated
} else {
output = `## Automation tests Checked

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

Copilot AI Aug 28, 2025

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.
Comment thread .github/workflows/automation-tests.yml Outdated
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',
Copy link

Copilot AI Aug 28, 2025

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.
Comment on lines +100 to +102
fs.writeFile('message.txt', output, (err) => {
if (err) throw err;
});
Copy link

Copilot AI Aug 28, 2025

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.
Comment thread .github/workflows/automation-tests.yml Outdated
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 ?

Comment thread .github/workflows/automation-tests.yml Outdated
await github.rest.actions.createWorkflowDispatch({
owner: 'BeyondTrust',
repo: 'ps-integration-test-automation',
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.

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.

Comment thread .github/workflows/automation-tests.yml Outdated
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',
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.

@github-actions
Copy link
Copy Markdown

👍 Frogbot scanned this pull request and did not find any new security issues.


@ivgonzalezc ivgonzalezc deleted the BIPS-28458-automation-tests branch October 16, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants