diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4f41455..eba1d492 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -39,47 +39,6 @@ jobs: with: service-account-token: ${{ secrets.service-account-token }} - # - name: Setting URL's - # id: setting_url - # run: | - # workflow_name="${{ github.workflow }}" - # if [[ $workflow_name == *"manual"* ]]; then - # echo "This is a manual workflow" - # echo "CYPRESS_BRB=${{ github.event.inputs.instance1 }}" >> $GITHUB_ENV - # echo "$CYPRESS_BRB" - # echo "CYPRESS_NBC=${{ github.event.inputs.instance2 }}" >> $GITHUB_ENV - # echo "$CYPRESS_NBC" - # echo "CYPRESS_DEFAULT=${{ github.event.inputs.instance3 }}" >> $GITHUB_ENV - # echo "$CYPRESS_DEFAULT" - # echo "TAG=tag:stable:ci" >> $GITHUB_OUTPUT - # echo "$TAG" - # elif [[ $workflow_name == *"automatic"* || $workflow_name == *"scheduled"* ]]; then - # echo "This is an automatic or scheduled workflow" - # echo "CYPRESS_BRB=op://cy-dev-brb/cypress/CYPRESS_BRB" >> $GITHUB_ENV - # echo "$CYPRESS_BRB" - # echo "CYPRESS_NBC=op://cy-dev-nbc/cypress/CYPRESS_NBC" >> $GITHUB_ENV - # echo "$CYPRESS_NBC" - # echo "CYPRESS_DEFAULT=op://cy-dev-dbc/cypress/CYPRESS_DEFAULT" >> $GITHUB_ENV - # echo "$CYPRESS_DEFAULT" - # echo "TAG=tag:stable:ci" >> $GITHUB_OUTPUT - # echo "$TAG" - # else - # echo "This is an remote workflow" - # echo "CYPRESS_BRB=${{ inputs.cypress_brb }}" >> $GITHUB_ENV - # echo "$CYPRESS_BRB" - # echo "CYPRESS_NBC=${{ inputs.cypress_nbc }}" >> $GITHUB_ENV - # echo "$CYPRESS_NBC" - # echo "CYPRESS_DEFAULT=${{ inputs.cypress_default }}" >> $GITHUB_ENV - # echo "$CYPRESS_DEFAULT" - # echo "TAG=tag:stable:pr:ci" >> $GITHUB_OUTPUT - # echo "$TAG" - # fi - - # - name: Set Environment Variables - # run: | - # chmod +x ${{ github.workspace }}/e2e-system-tests/scripts/set-env-vars.sh - # ${{ github.workspace }}/e2e-system-tests/scripts/set-env-vars.sh - - name: Fetch JSON files from 1Password run: | instances=(brb dbc nbc) @@ -88,7 +47,7 @@ jobs: for instance in "${instances[@]}"; do for environment in "${environments[@]}"; do vault_name="cy-${environment}-${instance}" - op document get test --vault "$vault_name" --output ${{ github.workspace }}/e2e-system-tests/env_variables/file-${environment}-${instance}.json + op document get cypress-json --vault "$vault_name" --output ${{ github.workspace }}/e2e-system-tests/env_variables/file-${environment}-${instance}.json done done @@ -144,12 +103,6 @@ jobs: done < <(jq -r 'to_entries | .[] | .key + "=" + .value' "$file_path") done - # - name: Load secret - # id: op-load-secret - # uses: 1password/load-secrets-action@v1 - # with: - # export-env: false - - name: Clean up previous report uses: cypress-io/github-action@v5 with: @@ -162,8 +115,6 @@ jobs: working-directory: e2e-system-tests command: npm run ${{ steps.read_variables.outputs.tag }} browser: chrome - # env: - # DEBUG: "@cypress/github-action" - name: Generate Report if: always() diff --git a/scripts/set-env-vars.sh b/scripts/set-env-vars.sh deleted file mode 100644 index fdb1193e..00000000 --- a/scripts/set-env-vars.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -if [[ $CYPRESS_BRB =~ \b(?:staging|schulportal)\b && $CYPRESS_NBC =~ \b(?:staging|schulportal)\b && $CYPRESS_DEFAULT =~ \b(?:staging|schulportal)\b ]]; then - echo "Loading staging environment variables" - ENV_PREFIX="ref" -else - echo "Loading dev environment variables" - ENV_PREFIX="dev" -fi - -# Define your environment json file with variables -# "CYPRESS_BRB_ALL" -> json file with all secrets for BRB -# "CYPRESS_NBC_ALL" -> json file with all secrets for NBC -# "CYPRESS_DBC_ALL" -> json file with all secrets for DBC -declare -a env_vars=( - "BRB" - "NBC" - "DBC" -) - -# Loop through environment json files and set environment variables -for var in "${env_vars[@]}"; do - ENV="${var}" - echo "Setting CYPRESS_${var}_ALL=${ENV_PREFIX}:CYPRESS_${var}_ALL" - echo "CYPRESS_${var}_ALL=op://cy-${ENV_PREFIX}-${ENV}/cypress/CYPRESS_${var}_ALL" >> $GITHUB_ENV - -done