diff --git a/.github/workflows/automatic-trigger.yml b/.github/workflows/automatic-trigger.yml index f5efad8d..3e982d45 100644 --- a/.github/workflows/automatic-trigger.yml +++ b/.github/workflows/automatic-trigger.yml @@ -5,11 +5,11 @@ jobs: e2e-system-tests: runs-on: ubuntu-latest outputs: - cypress_brb: ${{steps.set_variables.outputs.cypress_brb}} - cypress_dbc: ${{steps.set_variables.outputs.cypress_dbc}} - cypress_nbc: ${{steps.set_variables.outputs.cypress_nbc}} - tag: ${{steps.set_variables.outputs.tag}} - environment: ${{steps.set_variables.outputs.environment}} + cypress_brb: ${{ steps.set_variables.outputs.cypress_brb }} + cypress_dbc: ${{ steps.set_variables.outputs.cypress_dbc }} + cypress_nbc: ${{ steps.set_variables.outputs.cypress_nbc }} + tag: ${{ steps.set_variables.outputs.tag }} + environment: ${{ steps.set_variables.outputs.environment }} steps: - name: Setup Node @@ -47,8 +47,8 @@ jobs: secrets: service-account-token: ${{ secrets.CYPRESS_ONEPWD_SERVICE_ACCOUNT_TOKEN }} with: - cypress_brb: ${{needs.e2e-system-tests.outputs.cypress_brb}} - cypress_default: ${{needs.e2e-system-tests.outputs.cypress_dbc}} - cypress_nbc: ${{needs.e2e-system-tests.outputs.cypress_nbc}} - tag: ${{needs.e2e-system-tests.outputs.tag}} - environment: ${{needs.e2e-system-tests.outputs.environment}} + cypress_brb: ${{ needs.e2e-system-tests.outputs.cypress_brb }} + cypress_default: ${{ needs.e2e-system-tests.outputs.cypress_dbc }} + cypress_nbc: ${{ needs.e2e-system-tests.outputs.cypress_nbc }} + tag: ${{ needs.e2e-system-tests.outputs.tag }} + environment: ${{ needs.e2e-system-tests.outputs.environment }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d0e3d7a2..61efbe0c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,8 +24,6 @@ on: jobs: configure-load-secrets-and-run_tests: runs-on: ubuntu-latest - outputs: - tag: ${{ steps.read_variables.outputs.TAG }} steps: - name: Checkout @@ -48,13 +46,10 @@ jobs: - name: Fetch JSON files from 1Password run: | instances=(brb dbc nbc) - environments=(dev ref) for instance in "${instances[@]}"; do - # for environment in "${environments[@]}"; do - vault_name="cy-${{inputs.environment}}-${instance}" - op document get cypress-json --vault "$vault_name" --output ${{ github.workspace }}/e2e-system-tests/env_variables/file-${{inputs.environment}}-${instance}.json - # done + vault_name="cy-${{ inputs.environment }}-${instance}" + op document get cypress-json --vault "$vault_name" --output ${{ github.workspace }}/e2e-system-tests/env_variables/file-${{ inputs.environment }}-${instance}.json done - name: Aggregate JSON Data into one File @@ -63,28 +58,14 @@ jobs: workflow=${{ github.workflow }} workspace_path=${{ github.workspace }} - # if [[ $workflow == *"manual"* ]]; then - # brb_instance=${{ github.event.inputs.instance1 }} - # dbc_instance=${{ github.event.inputs.instance2 }} - # nbc_instance=${{ github.event.inputs.instance3 }} - # elif [[ $workflow == *"automatic"* || $workflow == *"scheduled"* ]]; then - # brb_instance="" - # dbc_instance="" - # nbc_instance="" - # else - # brb_instance=${{ inputs.cypress_brb }} - # dbc_instance=${{ inputs.cypress_default }} - # nbc_instance=${{ inputs.cypress_nbc }} - # fi - chmod +x ${{ github.workspace }}/e2e-system-tests/scripts/aggregate-json-files.sh ${{ github.workspace }}/e2e-system-tests/scripts/aggregate-json-files.sh \ "${workflow}" \ - "${{inputs.cypress_brb}}" \ - "${{inputs.cypress_default}}" \ - "${{inputs.cypress_nbc}}" \ + "${{ inputs.cypress_brb }}" \ + "${{ inputs.cypress_default }}" \ + "${{ inputs.cypress_nbc }}" \ "${workspace_path}" \ - "${{inputs.environment}}" + "${{ inputs.environment }}" - name: Clean up previous report uses: cypress-io/github-action@v5 diff --git a/.github/workflows/manual-trigger.yml b/.github/workflows/manual-trigger.yml index bb55713e..ce96c32e 100644 --- a/.github/workflows/manual-trigger.yml +++ b/.github/workflows/manual-trigger.yml @@ -19,11 +19,11 @@ jobs: e2e-system-tests: runs-on: ubuntu-latest outputs: - cypress_brb: ${{steps.set_variables.outputs.cypress_brb}} - cypress_dbc: ${{steps.set_variables.outputs.cypress_dbc}} - cypress_nbc: ${{steps.set_variables.outputs.cypress_nbc}} - tag: ${{steps.set_variables.outputs.tag}} - environment: ${{steps.set_variables.outputs.environment}} + # cypress_brb: ${{steps.set_variables.outputs.cypress_brb}} + # cypress_dbc: ${{steps.set_variables.outputs.cypress_dbc}} + # cypress_nbc: ${{steps.set_variables.outputs.cypress_nbc}} + tag: ${{ steps.set_variables.outputs.tag }} + environment: ${{ steps.set_variables.outputs.environment }} steps: - name: Setup Node @@ -38,9 +38,9 @@ jobs: id: set_variables shell: bash run: | - echo "cypress_brb=${{inputs.instance1}}" - echo "cypress_nbc=${{inputs.instance2}}" - echo "cypress_dbc=${{inputs.instance3}}" + echo "cypress_brb=${{ inputs.instance1 }}" + echo "cypress_nbc=${{ inputs.instance2 }}" + echo "cypress_dbc=${{ inputs.instance3 }}" if [[ ! $cypress_brb =~ (staging|schulportal) && ! $cypress_dbc =~ (staging|schulportal) && ! $cypress_nbc =~ (staging|schulportal) ]]; then environment="dev" @@ -57,11 +57,11 @@ jobs: secrets: service-account-token: ${{ secrets.CYPRESS_ONEPWD_SERVICE_ACCOUNT_TOKEN }} with: - cypress_brb: ${{needs.e2e-system-tests.outputs.cypress_brb}} - cypress_default: ${{needs.e2e-system-tests.outputs.cypress_dbc}} - cypress_nbc: ${{needs.e2e-system-tests.outputs.cypress_nbc}} - tag: ${{needs.e2e-system-tests.outputs.tag}} - environment: ${{needs.e2e-system-tests.outputs.environment}} + cypress_brb: ${{ inputs.instance1 }} + cypress_default: ${{ inputs.instance3 }} + cypress_nbc: ${{ inputs.instance2 }} + tag: ${{ needs.e2e-system-tests.outputs.tag }} + environment: ${{ needs.e2e-system-tests.outputs.environment }} notify_RC: runs-on: ubuntu-latest diff --git a/.github/workflows/remote-trigger.yml b/.github/workflows/remote-trigger.yml index 73963570..d9c0fad6 100644 --- a/.github/workflows/remote-trigger.yml +++ b/.github/workflows/remote-trigger.yml @@ -16,8 +16,8 @@ jobs: cypress_brb: ${{ steps.set_target.outputs.CYPRESS_BRB }} cypress_nbc: ${{ steps.set_target.outputs.CYPRESS_NBC }} cypress_default: ${{ steps.set_target.outputs.CYPRESS_DEFAULT }} - tag: ${{steps.set_target.outputs.tag}} - environment: ${{steps.set_target.outputs.environment}} + tag: ${{ steps.set_target.outputs.tag }} + environment: ${{ steps.set_target.outputs.environment }} steps: - name: Setup Node @@ -77,7 +77,7 @@ jobs: environment="ref" fi - echo "tag=tag:stable:ci" >> $GITHUB_OUTPUT + echo "tag=tag:stable:pr:ci" >> $GITHUB_OUTPUT echo "environment=$environment" >> $GITHUB_OUTPUT - name: Check if all apps are running @@ -116,5 +116,5 @@ jobs: cypress_brb: ${{ needs.e2e-system-tests.outputs.cypress_brb }} cypress_nbc: ${{ needs.e2e-system-tests.outputs.cypress_nbc }} cypress_default: ${{ needs.e2e-system-tests.outputs.cypress_default }} - tag: ${{needs.e2e-system-tests.outputs.tag}} - environment: ${{needs.e2e-system-tests.outputs.environment}} + tag: ${{ needs.e2e-system-tests.outputs.tag }} + environment: ${{ needs.e2e-system-tests.outputs.environment }} diff --git a/.github/workflows/scheduled-trigger.yml b/.github/workflows/scheduled-trigger.yml index 9309b052..58edde95 100644 --- a/.github/workflows/scheduled-trigger.yml +++ b/.github/workflows/scheduled-trigger.yml @@ -6,11 +6,11 @@ jobs: e2e-system-tests: runs-on: ubuntu-latest outputs: - cypress_brb: ${{steps.set_variables.outputs.cypress_brb}} - cypress_dbc: ${{steps.set_variables.outputs.cypress_dbc}} - cypress_nbc: ${{steps.set_variables.outputs.cypress_nbc}} - tag: ${{steps.set_variables.outputs.tag}} - environment: ${{steps.set_variables.outputs.environment}} + cypress_brb: ${{ steps.set_variables.outputs.cypress_brb }} + cypress_dbc: ${{ steps.set_variables.outputs.cypress_dbc }} + cypress_nbc: ${{ steps.set_variables.outputs.cypress_nbc }} + tag: ${{ steps.set_variables.outputs.tag }} + environment: ${{ steps.set_variables.outputs.environment }} steps: - name: Setup Node @@ -48,11 +48,11 @@ jobs: secrets: service-account-token: ${{ secrets.CYPRESS_ONEPWD_SERVICE_ACCOUNT_TOKEN }} with: - cypress_brb: ${{needs.e2e-system-tests.outputs.cypress_brb}} - cypress_default: ${{needs.e2e-system-tests.outputs.cypress_dbc}} - cypress_nbc: ${{needs.e2e-system-tests.outputs.cypress_nbc}} - tag: ${{needs.e2e-system-tests.outputs.tag}} - environment: ${{needs.e2e-system-tests.outputs.environment}} + cypress_brb: ${{ needs.e2e-system-tests.outputs.cypress_brb }} + cypress_default: ${{ needs.e2e-system-tests.outputs.cypress_dbc }} + cypress_nbc: ${{ needs.e2e-system-tests.outputs.cypress_nbc }} + tag: ${{ needs.e2e-system-tests.outputs.tag }} + environment: ${{ needs.e2e-system-tests.outputs.environment }} notify_RC: runs-on: ubuntu-latest diff --git a/scripts/aggregate-json-files.sh b/scripts/aggregate-json-files.sh index 40f8cf46..c2db8e8f 100644 --- a/scripts/aggregate-json-files.sh +++ b/scripts/aggregate-json-files.sh @@ -9,49 +9,12 @@ nbc_instance=$4 workspace_path=$5 environment=$6 -# check_environment() { -# local url="$1" - -# if [[ $url == *"staging"* || $url == *"schulportal"* ]]; then -# echo "ref" -# else -# echo "dev" -# fi -# } - -# if [[ $workflow_name == *"manual"* ]]; then -# echo "This is a manual workflow" -# 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 "TAG=tag:stable:ci" >>$GITHUB_OUTPUT -# echo "$TAG" -# else -# echo "This is a remote workflow" -# echo "TAG=tag:stable:pr:ci" >>$GITHUB_OUTPUT -# echo "$TAG" -# fi - -# brb_env=$(check_environment "$brb_instance") -# dbc_env=$(check_environment "$dbc_instance") -# nbc_env=$(check_environment "$nbc_instance") - -# if [[ $brb_env == "ref" || $dbc_env == "ref" || $nbc_env == "ref" ]]; then -# environment="ref" -# else -# environment="dev" -# fi - file_paths=() declare -A key_value_pairs for instance in "${instances[@]}"; do - # if [[ $workflow_name == *"manual"* || $workflow_name == *"remote"* ]]; then - file_path="$workspace_path/e2e-system-tests/env_variables/file-${environment}-${instance}.json" - # else - # file_path="$workspace_path/e2e-system-tests/env_variables/file-dev-${instance}.json" - # fi + + file_path="$workspace_path/e2e-system-tests/env_variables/file-${environment}-${instance}.json" file_paths+=("$file_path")