From b6054d1aa14c34dc6ccbcf2c24d9c40fb66fb898 Mon Sep 17 00:00:00 2001 From: An Nguyen Date: Fri, 11 Oct 2024 14:08:45 -0500 Subject: [PATCH] use test notification url --- .github/workflows/bitrise-envs-sync.yml | 4 + bitrise.yml | 104 ------------------ .../bitrise/overrideFeatureFlagsKey.sh | 29 ----- .../scripts/bitrise/overrideSeedlessEnvs.sh | 42 ------- .../core-mobile/scripts/bitrise/setEnv.sh | 12 +- packages/core-mobile/scripts/getEnvs.sh | 4 + 6 files changed, 17 insertions(+), 178 deletions(-) delete mode 100644 packages/core-mobile/scripts/bitrise/overrideFeatureFlagsKey.sh delete mode 100644 packages/core-mobile/scripts/bitrise/overrideSeedlessEnvs.sh diff --git a/.github/workflows/bitrise-envs-sync.yml b/.github/workflows/bitrise-envs-sync.yml index be0fe0eea..5d3a4b3be 100644 --- a/.github/workflows/bitrise-envs-sync.yml +++ b/.github/workflows/bitrise-envs-sync.yml @@ -30,6 +30,8 @@ jobs: ENV_DEV_E2E, core/dev/mobile/.env.development.e2e ENV_PROD, core/dev/mobile/.env.production ENV_PROD_E2E, core/dev/mobile/.env.production.e2e + ENV_INTERNAL, core/dev/mobile/.env.internal + ENV_INTERNAL_E2E, core/dev/mobile/.env.internal.e2e ANDROID_GOOGLE_SERVICES_INTERNAL, core/dev/mobile/android/internal/google-services.json IOS_GOOGLE_SERVICES_INTERNAL, core/dev/mobile/ios/internal/GoogleService-Info.plist ANDROID_GOOGLE_SERVICES_EXTERNAL, core/dev/mobile/android/prod/google-services.json @@ -42,6 +44,8 @@ jobs: ../common/writeEnvsToFile.sh "$ENV_DEV_E2E" ".env.development.e2e" ../common/writeEnvsToFile.sh "$ENV_PROD" ".env.production" ../common/writeEnvsToFile.sh "$ENV_PROD_E2E" ".env.production.e2e" + ../common/writeEnvsToFile.sh "$ENV_INTERNAL" ".env.internal" + ../common/writeEnvsToFile.sh "$ENV_INTERNAL_E2E" ".env.internal.e2e" ../common/writeGoogleServicesToFile.sh "$ANDROID_GOOGLE_SERVICES_INTERNAL" "google-services.json.internal" "json" ../common/writeGoogleServicesToFile.sh "$IOS_GOOGLE_SERVICES_INTERNAL" "GoogleService-Info.plist.internal" "plist" ../common/writeGoogleServicesToFile.sh "$ANDROID_GOOGLE_SERVICES_EXTERNAL" "google-services.json.external" "json" diff --git a/bitrise.yml b/bitrise.yml index a4c451ca9..aa43b1163 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -63,12 +63,6 @@ workflows: - APP_TITLE: Core Mobile External opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - IS_EXTERNAL_BUILD: "true" opts: is_expand: false @@ -146,12 +140,6 @@ workflows: - APP_TITLE: Core Mobile Internal opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - IS_INTERNAL_BUILD: "true" opts: is_expand: false @@ -334,14 +322,6 @@ workflows: title: Set Env inputs: - file_path: scripts/bitrise/setEnv.sh - - script-runner@0: - title: Override Feature Flags Key - inputs: - - file_path: scripts/bitrise/overrideFeatureFlagsKey.sh - - script-runner@0: - title: Override Seedless Envs - inputs: - - file_path: scripts/bitrise/overrideSeedlessEnvs.sh _trigger_ios_internal_build: steps: - script-runner@0: @@ -544,12 +524,6 @@ workflows: - APP_TITLE: Core Mobile Internal opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false steps: - deploy-to-bitrise-io@2: {} - create-install-page-qr-code@1: {} @@ -582,12 +556,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - IS_INTERNAL_BUILD: "true" opts: is_expand: false @@ -618,12 +586,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - IS_REGRESSION_RUN: "true" opts: is_expand: false @@ -658,12 +620,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - IS_REGRESSION_RUN: "true" opts: is_expand: false @@ -703,12 +659,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -751,12 +701,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -799,12 +743,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -847,12 +785,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -895,12 +827,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -1000,12 +926,6 @@ workflows: - APP_TITLE: Core Mobile Internal opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - IS_INTERNAL_BUILD: "true" opts: is_expand: false @@ -1040,12 +960,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -1080,12 +994,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -1123,12 +1031,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false @@ -1177,12 +1079,6 @@ workflows: - E2E: "true" opts: is_expand: false - - USE_TEST_FEATURE_FLAGS: "true" - opts: - is_expand: false - - USE_SEEDLESS_GAMMA: "true" - opts: - is_expand: false - POST_TO_TESTRAIL: "true" opts: is_expand: false diff --git a/packages/core-mobile/scripts/bitrise/overrideFeatureFlagsKey.sh b/packages/core-mobile/scripts/bitrise/overrideFeatureFlagsKey.sh deleted file mode 100644 index 5363885d6..000000000 --- a/packages/core-mobile/scripts/bitrise/overrideFeatureFlagsKey.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# fail if any commands fails -set -e -# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully -set -o pipefail - -# Check if the environment variable USE_TEST_FEATURE_FLAGS is set to "true" -if [ "$USE_TEST_FEATURE_FLAGS" = "true" ]; then - - # Read the value of POSTHOG_FEATURE_FLAGS_KEY from .env.development file - feature_flags_key=$(grep '^POSTHOG_FEATURE_FLAGS_KEY=' .env.development | cut -d '=' -f2) - - # Check if the value is not empty (found in .env.development) - if [ -n "$feature_flags_key" ]; then - # Create a temporary file for the in-place edit - temp_file=$(mktemp) - - # Replace the value of POSTHOG_FEATURE_FLAGS_KEY in the .env file and save it in the temporary file - sed "s/^POSTHOG_FEATURE_FLAGS_KEY=.*/POSTHOG_FEATURE_FLAGS_KEY=$feature_flags_key/" .env > "$temp_file" - - # Replace the original .env file with the modified temporary file - mv "$temp_file" .env - - echo "Updated POSTHOG_FEATURE_FLAGS_KEY in .env" - else - echo "POSTHOG_FEATURE_FLAGS_KEY not found in .env.development or is empty." - fi - -fi diff --git a/packages/core-mobile/scripts/bitrise/overrideSeedlessEnvs.sh b/packages/core-mobile/scripts/bitrise/overrideSeedlessEnvs.sh deleted file mode 100644 index b440faf8f..000000000 --- a/packages/core-mobile/scripts/bitrise/overrideSeedlessEnvs.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# fail if any commands fails -set -e -# make pipelines' return status equal the last command to exit with a non-zero status, or zero if all commands exit successfully -set -o pipefail - -if ! cat /etc/issue 2>/dev/null -then - # do nothing - : -else - stack=$( cat /etc/issue ) -fi - -# Check if the environment variable USE_SEEDLESS_GAMMA is set to "true" -if [ "$USE_SEEDLESS_GAMMA" = "true" ]; then - - # Loop through the fields to replace - for field in "SEEDLESS_URL" "SEEDLESS_API_KEY" "SEEDLESS_ORG_ID" "SEEDLESS_ENVIRONMENT" "GOOGLE_OAUTH_CLIENT_WEB_ID" "GOOGLE_OAUTH_CLIENT_IOS_ID" "APPLE_OAUTH_CLIENT_ID" "APPLE_OAUTH_REDIRECT_URL"; do - - # Read the corresponding value from .env.development - value=$(awk -F '=' -v field="$field" '$1 == field {print substr($0, length(field)+2)}' .env.development) - - # Check if the value is not empty (found in .env.development) - if [ -n "$value" ]; then - - # Replace the value in .env - if [[ $stack == *Ubuntu* ]] - then - # on ubuntu, the command doesn't need the empty string extension - sed -i -e "s|$field=.*|$field=$value|g" ".env" - else - sed -i '' -e "s|$field=.*|$field=$value|g" ".env" - fi - - fi - - done - -fi - - diff --git a/packages/core-mobile/scripts/bitrise/setEnv.sh b/packages/core-mobile/scripts/bitrise/setEnv.sh index 1c20b6c47..b5a6acd1a 100644 --- a/packages/core-mobile/scripts/bitrise/setEnv.sh +++ b/packages/core-mobile/scripts/bitrise/setEnv.sh @@ -1,12 +1,18 @@ #!/usr/bin/env bash set -ex -# grab the correct env file based on ENVIRONMENT and E2E env vars +# grab the correct env file if [ "$ENVIRONMENT" = "production" ]; then + if [ "$APP_TITLE" = "Core Mobile Internal" ]; then + PREFIX=".env.internal" + else + PREFIX=".env.production" + fi + if [ "$E2E" = "true" ]; then - cp .env.production.e2e .env + cp "$PREFIX.e2e" .env else - cp .env.production .env + cp "$PREFIX" .env fi elif [ "$ENVIRONMENT" = "development" ]; then cp .env.development .env diff --git a/packages/core-mobile/scripts/getEnvs.sh b/packages/core-mobile/scripts/getEnvs.sh index cb0b16305..da033be3e 100755 --- a/packages/core-mobile/scripts/getEnvs.sh +++ b/packages/core-mobile/scripts/getEnvs.sh @@ -11,12 +11,16 @@ ENV_DEV=$(getSecretFromAWS "core/dev/mobile/.env.development") ENV_DEV_E2E=$(getSecretFromAWS "core/dev/mobile/.env.development.e2e") ENV_PROD=$(getSecretFromAWS "core/dev/mobile/.env.production") ENV_PROD_E2E=$(getSecretFromAWS "core/dev/mobile/.env.production.e2e") +ENV_INTERNAL=$(getSecretFromAWS "core/dev/mobile/.env.internal") +ENV_INTERNAL_E2E=$(getSecretFromAWS "core/dev/mobile/.env.internal.e2e") # Write to .env files ./scripts/common/writeEnvsToFile.sh "$ENV_DEV" ".env.development" ./scripts/common/writeEnvsToFile.sh "$ENV_DEV_E2E" ".env.development.e2e" ./scripts/common/writeEnvsToFile.sh "$ENV_PROD" ".env.production" ./scripts/common/writeEnvsToFile.sh "$ENV_PROD_E2E" ".env.production.e2e" +./scripts/common/writeEnvsToFile.sh "$ENV_INTERNAL" ".env.internal" +./scripts/common/writeEnvsToFile.sh "$ENV_INTERNAL_E2E" ".env.internal.e2e" # Use .env.development as the default cp .env.development .env