diff --git a/.github/actions/frontend/runtime/e2e_status/action.yml b/.github/actions/frontend/runtime/e2e_status/action.yml index 3e5569b7..b6c874e2 100644 --- a/.github/actions/frontend/runtime/e2e_status/action.yml +++ b/.github/actions/frontend/runtime/e2e_status/action.yml @@ -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/set-commit-status-action@v2.0.0 if: ${{ fromJSON(inputs.e2e_pass_on_error) }} with: diff --git a/.github/actions/frontend/runtime/e2e_status/mocks.ts b/.github/actions/frontend/runtime/e2e_status/mocks.ts index c4ce4d55..f9d5512c 100644 --- a/.github/actions/frontend/runtime/e2e_status/mocks.ts +++ b/.github/actions/frontend/runtime/e2e_status/mocks.ts @@ -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' }, ]; diff --git a/.github/actions/frontend/runtime/e2e_status/test/action.test.ts b/.github/actions/frontend/runtime/e2e_status/test/action.test.ts index 89868eed..472adeff 100644 --- a/.github/actions/frontend/runtime/e2e_status/test/action.test.ts +++ b/.github/actions/frontend/runtime/e2e_status/test/action.test.ts @@ -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(); @@ -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(); @@ -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(); }); diff --git a/.github/actions/frontend/runtime/magic_url/README.md b/.github/actions/frontend/runtime/magic_url/README.md index 9ff95cec..971d7522 100644 --- a/.github/actions/frontend/runtime/magic_url/README.md +++ b/.github/actions/frontend/runtime/magic_url/README.md @@ -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 diff --git a/.github/actions/frontend/runtime/magic_url/mocks.ts b/.github/actions/frontend/runtime/magic_url/mocks.ts index 47f70374..ab810613 100644 --- a/.github/actions/frontend/runtime/magic_url/mocks.ts +++ b/.github/actions/frontend/runtime/magic_url/mocks.ts @@ -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' }, ]; diff --git a/.github/workflows/frontend_runtime_application_manual_e2e_run.yml b/.github/workflows/frontend_runtime_application_manual_e2e_run.yml index e45bde3f..dbb95d7f 100644 --- a/.github/workflows/frontend_runtime_application_manual_e2e_run.yml +++ b/.github/workflows/frontend_runtime_application_manual_e2e_run.yml @@ -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 @@ -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 diff --git a/.github/workflows/frontend_runtime_application_pr.yml b/.github/workflows/frontend_runtime_application_pr.yml index 028fbfbf..2558dfd1 100644 --- a/.github/workflows/frontend_runtime_application_pr.yml +++ b/.github/workflows/frontend_runtime_application_pr.yml @@ -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 diff --git a/.github/workflows/frontend_runtime_utility_pr.yml b/.github/workflows/frontend_runtime_utility_pr.yml index e1914306..99d57e2d 100644 --- a/.github/workflows/frontend_runtime_utility_pr.yml +++ b/.github/workflows/frontend_runtime_utility_pr.yml @@ -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 diff --git a/.github/workflows/test/frontend_runtime_application_manual_e2e_run.test.ts b/.github/workflows/test/frontend_runtime_application_manual_e2e_run.test.ts index eec94e52..22cf938c 100644 --- a/.github/workflows/test/frontend_runtime_application_manual_e2e_run.test.ts +++ b/.github/workflows/test/frontend_runtime_application_manual_e2e_run.test.ts @@ -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: [ diff --git a/.github/workflows/test/frontend_runtime_e2e_trigger_response.test.ts b/.github/workflows/test/frontend_runtime_e2e_trigger_response.test.ts index 090fbb3e..fb752076 100644 --- a/.github/workflows/test/frontend_runtime_e2e_trigger_response.test.ts +++ b/.github/workflows/test/frontend_runtime_e2e_trigger_response.test.ts @@ -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: [ diff --git a/README.md b/README.md index 9a385d82..ffca3472 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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)