Skip to content

Commit

Permalink
BC-5468 formatted all files
Browse files Browse the repository at this point in the history
  • Loading branch information
UzaeirKhan committed Nov 24, 2023
1 parent 95a5d6f commit 1f5b3b7
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 102 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/automatic-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
31 changes: 6 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/manual-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/remote-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
20 changes: 10 additions & 10 deletions .github/workflows/scheduled-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
41 changes: 2 additions & 39 deletions scripts/aggregate-json-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 1f5b3b7

Please sign in to comment.