Skip to content

Commit

Permalink
manual-e2e-run -- cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jablonnc committed Oct 27, 2023
1 parent 8831aee commit 7d3054e
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/actions/frontend/runtime/e2e_status/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:
status: ${{ job.status }}
context: 'pr / E2E Status'
# Manually set the commit status to success to allow the PR to be merged
- name: override_commit_status
- name: force_status_as_success
uses: myrotvorets/[email protected]
if: ${{ fromJSON(inputs.e2e_pass_on_error) }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/frontend/runtime/e2e_status/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const E2E_STATUS_MOCK_STEPS = [
{ name: 'add_result_as_pr_comment' },
{ name: 'get_branch_of_pr' },
{ name: 'set_commit_status' },
{ name: 'override_commit_status' },
{ name: 'force_status_as_success' },
];
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ afterEach(async () => {
await mockGithub.teardown();
});

test('pass_with_failures is not called when e2e_passed is false', async () => {
test('force_status_as_success is not called when e2e_passed is false', async () => {
mockGithub = new MockGithub(getCompositeActionConfig({ directory: __dirname, repoName, actionTriggeringComposite: 'action_test_fail.yml' }));

await mockGithub.setup();
Expand All @@ -22,12 +22,12 @@ test('pass_with_failures is not called when e2e_passed is false', async () => {
originDirectory: __dirname
});

const result = getTestResult({ results, name: 'pass_with_failures' });
const result = getTestResult({ results, name: 'force_status_as_success' });

expect(result).toBeUndefined();
});

test('e2e_pass_on_error allows pass_with_failures to be called when e2e_passed is false', async () => {
test('e2e_pass_on_error allows force_status_as_success to be called when e2e_passed is false', async () => {
mockGithub = new MockGithub(getCompositeActionConfig({ directory: __dirname, repoName, actionTriggeringComposite: 'action_test_pass.yml' }));

await mockGithub.setup();
Expand All @@ -38,7 +38,7 @@ test('e2e_pass_on_error allows pass_with_failures to be called when e2e_passed i
originDirectory: __dirname
});

const result = getTestResult({ results, name: 'pass_with_failures' });
const result = getTestResult({ results, name: 'force_status_as_success' });

expect(result).not.toBeUndefined();
});
5 changes: 3 additions & 2 deletions .github/actions/frontend/runtime/magic_url/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ No outputs provided.
```yaml
permissions:
id-token: write
contents: read
pull-requests: write
statuses: write
contents: read
issues: read
pull-requests: read
steps:
- name: magic_url
uses: jupiterone/.github/.github/actions/frontend/runtime/magic_url
Expand Down
1 change: 1 addition & 0 deletions .github/actions/frontend/runtime/magic_url/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export const MAGIC_URL_MOCK_STEPS = [
{ name: 'npm_build' },
{ name: 'configure_aws_credentials' },
{ name: 'deploy_artifacts_to_s3' },
{ name: 'get_branch_of_pr' },
{ name: 'show_magic_url_in_pr' },
];
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ jobs:
needs: [migration_number]
permissions:
id-token: write
contents: read
pull-requests: write
statuses: write
contents: read
issues: read
pull-requests: read
steps:
- uses: actions/checkout@v3
- name: setup_env
Expand Down Expand Up @@ -136,7 +137,7 @@ jobs:
password: ${{ secrets.DOCKER_HUB_SRE }}
continue-on-error: ${{ inputs.e2e_pass_on_error }}
permissions: write-all
needs: [e2e_prepare, magic_url]
needs: [e2e_prepare, migration_number, magic_url]
strategy:
# when one test fails, DO NOT cancel the other containers, because this will kill Cypress processes
# leaving Cypress Cloud hanging: https://github.com/cypress-io/github-action/issues/48
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/frontend_runtime_application_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,10 @@ jobs:
needs: [migration_number]
permissions:
id-token: write
contents: read
pull-requests: write
statuses: write
contents: read
issues: read
pull-requests: read
steps:
- uses: actions/checkout@v3
- name: setup_env
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/frontend_runtime_utility_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,10 @@ jobs:
needs: [migration_number]
permissions:
id-token: write
contents: read
pull-requests: write
statuses: write
contents: read
issues: read
pull-requests: read
steps:
- uses: actions/checkout@v3
- name: setup_env
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,8 @@ test('flow with e2e_pass_on_error set to true to make tests non blocking', async
migration_number: [ { name: 'migration_number', mockWith: 'echo ""' } ],
magic_url: [ { name: 'magic_url', mockWith: 'echo ""' } ],
e2e_prepare: [ { name: 'e2e_prepare', mockWith: 'echo ""' } ],

// Purposefully fail to test e2e_pass_on_error
e2e_run: [{
name: 'e2e_run',
mockCompositeSteps: [
{ name: 'get_author_name' },
{ name: 'cypress_run', mockWith: 'exit 1' },
]
}],
e2e_run: [ { name: 'e2e_prepare', mockWith: 'echo "exit 1"' } ],
}});

const jobs_found = getTestResults({ results, names: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ test('validate inputs and secrets', async () => {
test('default flow', async () => {
const act = new Act(mockGithub.repo.getPath(repoName));

act.setSecret('DOCKER_HUB_SRE', 'DOCKER_HUB_SRE');

const results = await runWorkflow({ act, repoName, mockGithub });

const jobs_found = getTestResults({ results, names: [
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The following workflows are for the entire JupiterOne organization.
#### Runtime

- [frontend_runtime_application_pr](.github/workflows/docs/frontend/frontend_runtime_application_pr.md)
- [frontend_runtime_application_manual_e2e_run](.github/workflows/docs/frontend/frontend_runtime_application_manual_e2e_run.md)
- [frontend_runtime_utility_pr](.github/workflows/docs/frontend/frontend_runtime_utility_pr.md)
- [frontend_runtime_e2e_trigger_response](.github/workflows/docs/frontend/frontend_runtime_e2e_trigger_response.md)
- [frontend_runtime_deploy](.github/workflows/docs/frontend/frontend_runtime_deploy.md)
Expand Down Expand Up @@ -42,6 +43,7 @@ The workflows above take advantage of the composite actions listed below, levera

#### Runtime

- [e2e_pending_status](.github/actions/frontend/runtime/e2e_pending_status/README.md)
- [e2e_prepare](.github/actions/frontend/runtime/e2e_prepare/README.md)
- [e2e_run](.github/actions/frontend/runtime/e2e_run/README.md)
- [e2e_status](.github/actions/frontend/runtime/e2e_status/README.md)
Expand Down

0 comments on commit 7d3054e

Please sign in to comment.