Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRE-1504 - Allow remote e2e calls to set containers #152

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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
86 changes: 63 additions & 23 deletions .github/workflows/frontend_runtime_e2e_trigger_response.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,79 @@
# This file is extended by the e2e_trigger.yml in each application repo
name: Default workflow for running tests in an application repo when triggered by an external repo
name:
Default workflow for running tests in an application repo when triggered by an
external repo

on:
workflow_call:
inputs:
fallback_runner:
description: "If true will levarege ubuntu-latest, otherwise will fall back to the J1 in-house runner"
description:
'If true will levarege ubuntu-latest, otherwise will fall back to the
J1 in-house runner'
default: false
type: boolean
spec_to_run:
description: 'Used to determine which test to run'
type: string
default: 'cypress/e2e/**/*.feature'
external_pr_number:
description: 'Used by the e2e_trigger to pass in the PR number associated with the PR that triggered the flow'
description:
'Used by the e2e_trigger to pass in the PR number associated with the
PR that triggered the flow'
type: string
required: true
external_pr_title:
description: 'Used by the e2e_trigger to give builds in Cypress the correct title associated with the PR that triggered the flow'
description:
'Used by the e2e_trigger to give builds in Cypress the correct title
associated with the PR that triggered the flow'
type: string
required: true
external_pr_branch:
description: 'Used by the e2e_trigger to give builds in Cypress the correct branch name'
description:
'Used by the e2e_trigger to give builds in Cypress the correct branch
name'
type: string
required: true
external_pr_author:
description: 'Used by the e2e_trigger to give builds in Cypress the correct author name associated with the owner of the PR'
description:
'Used by the e2e_trigger to give builds in Cypress the correct author
name associated with the owner of the PR'
type: string
required: true
external_pr_sha:
description: 'Used by the e2e_trigger to give builds in Cypress the correct SHA associated with the PR that triggered the flow'
description:
'Used by the e2e_trigger to give builds in Cypress the correct SHA
associated with the PR that triggered the flow'
type: string
required: true
external_pr_repo_name:
description: 'Used by the e2e_trigger to tag builds in Cypress with the appropriate repo name associated with the repo that triggered the flow'
description:
'Used by the e2e_trigger to tag builds in Cypress with the appropriate
repo name associated with the repo that triggered the flow'
type: string
required: true
e2e_containers:
description:
'Used by the e2e_trigger to determine which containers to run the
tests in'
type: string
required: false
default: "['1']"
secrets:
NPM_TOKEN:
description: "A J1 npm.com Publish token"
description: 'A J1 npm.com Publish token'
required: true
CYPRESS_RECORD_KEY:
description: "The record key associated with the project in Cypress"
description: 'The record key associated with the project in Cypress'
required: false
CYPRESS_PROJECT_ID:
description: "The project ID associated with the project in Cypress"
description: 'The project ID associated with the project in Cypress'
required: false
CYPRESS_PASSWORD:
description: "The password of the E2E username"
description: 'The password of the E2E username'
required: false
DOCKER_HUB_SRE:
description: "The password to login to docker hub sre"
description: 'The password to login to docker hub sre'
required: true

env:
Expand All @@ -62,7 +85,9 @@ concurrency:

jobs:
migration_number:
runs-on: ${{ (inputs.fallback_runner && 'ubuntu-latest') || 'scaleset-jupiterone-infra-arm64' }}
runs-on:
${{ (inputs.fallback_runner && 'ubuntu-latest') ||
'scaleset-jupiterone-infra-arm64' }}
outputs:
migration: ${{ steps.migration_number.outputs.migration }}
steps:
Expand All @@ -76,15 +101,19 @@ jobs:
uses: jupiterone/.github/.github/actions/frontend/runtime/[email protected]

e2e_prepare:
runs-on: ${{ (inputs.fallback_runner && 'ubuntu-latest') || 'scaleset-jupiterone-infra-arm64' }}
runs-on:
${{ (inputs.fallback_runner && 'ubuntu-latest') ||
'scaleset-jupiterone-infra-arm64' }}
needs: [migration_number]
permissions:
id-token: write
contents: read
outputs:
artemis_account_name: ${{ steps.e2e_prepare.outputs.artemis_account_name }}
artemis_account_name:
${{ steps.e2e_prepare.outputs.artemis_account_name }}
artemis_account_id: ${{ steps.e2e_prepare.outputs.artemis_account_id }}
artemis_account_subdomain: ${{ steps.e2e_prepare.outputs.artemis_account_subdomain }}
artemis_account_subdomain:
${{ steps.e2e_prepare.outputs.artemis_account_subdomain }}
artemis_users: ${{ steps.e2e_prepare.outputs.artemis_users }}
steps:
- uses: actions/checkout@v3
Expand All @@ -97,7 +126,9 @@ jobs:
uses: jupiterone/.github/.github/actions/frontend/runtime/[email protected]

unique_id:
runs-on: ${{ (inputs.fallback_runner && 'ubuntu-latest') || 'scaleset-jupiterone-infra-arm64' }}
runs-on:
${{ (inputs.fallback_runner && 'ubuntu-latest') ||
'scaleset-jupiterone-infra-arm64' }}
outputs:
unique_id: ${{ steps.unique_id.outputs.unique_id }}
steps:
Expand All @@ -110,7 +141,9 @@ jobs:

e2e_run:
# Note this is the only job that leverages amd64
runs-on: ${{ (inputs.fallback_runner && 'ubuntu-latest') || 'scaleset-jupiterone-infra-amd64' }}
runs-on:
${{ (inputs.fallback_runner && 'ubuntu-latest') ||
'scaleset-jupiterone-infra-amd64' }}
container:
# Available containers here: https://hub.docker.com/r/cypress/browsers/tags
image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
Expand All @@ -122,8 +155,11 @@ jobs:
needs: [migration_number, e2e_prepare, unique_id]
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
# leaving Cypress Cloud hanging: https://github.com/cypress-io/github-action/issues/48
fail-fast: false
matrix:
# run copies of the current job in parallel
containers: ${{ fromJson(inputs.e2e_containers) }}
outputs:
test_passed: ${{ steps.e2e_run.outputs.test_passed }}
steps:
Expand All @@ -137,10 +173,14 @@ jobs:
uses: jupiterone/.github/.github/actions/frontend/runtime/[email protected]
timeout-minutes: 120
with:
cypress_container: ${{ matrix.containers }}
ci_build_id: ${{ needs.unique_id.outputs.unique_id }}
artemis_account_name: ${{ needs.e2e_prepare.outputs.artemis_account_name }}
artemis_account_id: ${{ needs.e2e_prepare.outputs.artemis_account_id }}
artemis_account_subdomain: ${{ needs.e2e_prepare.outputs.artemis_account_subdomain }}
artemis_account_name:
${{ needs.e2e_prepare.outputs.artemis_account_name }}
artemis_account_id:
${{ needs.e2e_prepare.outputs.artemis_account_id }}
artemis_account_subdomain:
${{ needs.e2e_prepare.outputs.artemis_account_subdomain }}
artemis_users: ${{ needs.e2e_prepare.outputs.artemis_users }}
cypress_record_key: ${{ secrets.CYPRESS_RECORD_KEY }}
cypress_project_id: ${{ secrets.CYPRESS_PROJECT_ID }}
Expand Down
Loading