mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 15:08:25 -04:00
write a script to get the VCAP value
This commit is contained in:
12
README.md
12
README.md
@@ -514,12 +514,6 @@ At some point, E2E tests will fail because the secrets held in VCAP_SERVICES hav
|
|||||||
them, you will need to do the following:
|
them, you will need to do the following:
|
||||||
|
|
||||||
1. Log in the normal way to access cloudfoundry command line options
|
1. Log in the normal way to access cloudfoundry command line options
|
||||||
2. Run `cf env notify-admin-staging`
|
2. In your terminal, run `chmod +x print_vcap.sh`
|
||||||
3. Copy everything for the json in VCAP_SERVICES
|
3. In your terminal, run `./print_vcap.sh`
|
||||||
4. Open a test file and make a new test anywhere that is convenient
|
4. Copy the value in your terminal and paste it into the VCAP_SERVICES secret in Github on the staging tier.
|
||||||
5. Paste the secret into the test file
|
|
||||||
6. Make your test look like this: `print(json.dumps(VCAP_SERVICES))`
|
|
||||||
7. Copy the output of this test (stringified VCAP_SERVICES) into the VCAP_SERVICES secret in github on the staging tier
|
|
||||||
8. Delete everything you did in #4, #5, and #6.
|
|
||||||
9. Rerun the E2E tests
|
|
||||||
10. Note: Pay attention to whitespace, etc. It's very sensitive to formatting.
|
|
||||||
|
|||||||
17
print_vcap.sh
Executable file
17
print_vcap.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
STAGING_APP_NAME="notify-admin-staging"
|
||||||
|
|
||||||
|
# Fetch the environment variables of the staging app
|
||||||
|
env_var_value=$(cf env "$STAGING_APP_NAME" | awk '/'"VCAP_SERVICES"':/,/^}/')
|
||||||
|
|
||||||
|
|
||||||
|
# Check if the environment variable was found"
|
||||||
|
if [ -z "$env_var_value" ]; then
|
||||||
|
echo "Environment variable VCAP_SERVICES not found in the staging environment"
|
||||||
|
else
|
||||||
|
env_var_json=$(echo "$env_var_value" | sed '1s/^[^:]*: //' | tr -d '\n')
|
||||||
|
stringified_value=$(python3 -c "import json, sys; print(json.dumps(json.loads(sys.stdin.read())))" <<< "$env_var_json")
|
||||||
|
echo "VCAP_SERVICES:"
|
||||||
|
echo "$stringified_value"
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user