22
33set -e
44
5- env_variables=$( yq eval ' .env | to_entries | .[] | .key + "=" + .value' .github/workflows/end2end.yaml | sed ' s/\${{[^}]*}}//g' ) && export $env_variables
6- export GIT_ACCESS_TOKEN=${GITHUB_TOKEN}
7- export E2E_IMAGE_TAG=latest
8-
5+ # Persist workflow env vars so they survive across terminal sessions
6+ ZENKO_ENV_FILE=" $HOME /.zenko.env"
7+ yq eval ' .env | to_entries | .[] | "export " + .key + "=" + (.value | tostring | @sh)' .github/workflows/end2end.yaml \
8+ | sed ' s/\${{[^}]*}}//g' > " $ZENKO_ENV_FILE "
9+ echo ' export GIT_ACCESS_TOKEN="${GITHUB_TOKEN}"' >> " $ZENKO_ENV_FILE "
910# Disable GCP tests as we don't have credentials setup in devcontainer
10- export GCP_BACKEND_DESTINATION_LOCATION=
11+ echo ' export GCP_BACKEND_DESTINATION_LOCATION=' >> " $ZENKO_ENV_FILE "
12+
13+ # Source now for this session
14+ source " $ZENKO_ENV_FILE "
15+
16+ # Auto-source in future Codespace terminals
17+ echo ' [ -f "$HOME/.zenko.env" ] && source "$HOME/.zenko.env"' >> " $HOME /.bashrc"
1118
1219GITHUB_ENV=$( mktemp /tmp/github_env.XXXXXX)
1320
@@ -22,10 +29,10 @@ for i in $(seq 0 $array_length); do
2229 working_dir=$( yq " .runs.steps[$i ].working-directory" .github/actions/deploy/action.yaml)
2330 run_command=$( yq " .runs.steps[$i ].run" .github/actions/deploy/action.yaml)
2431
25- # We don 't want to run `run -e2e-test .sh` because it is used for linting here, user will run it manually if needed after deployment
26- # We can't run `configure-e2e.sh` here because it needs an image that is not yet built and sent to kind, will be run after
32+ # We can 't run `configure -e2e.sh` here because it needs services to be ready first, will be run after
33+ # User will run tests manually after deployment
2734 (
28- if [[ " $run_command " != " null" && " $run_command " != * " configure-e2e.sh" * && " $run_command " != * " run-e2e-test.sh " * ]]; then
35+ if [[ " $run_command " != " null" && " $run_command " != * " configure-e2e.sh" * ]]; then
2936 # Inject env 'generated' from previous steps
3037 source " $GITHUB_ENV "
3138
@@ -47,23 +54,6 @@ for i in $(seq 0 $array_length); do
4754 )
4855done
4956
50- (
51- cd tests/zenko_tests
52-
53- envsubst < ' e2e-config.yaml.template' > ' e2e-config.yaml'
54- if [[ " ${ENABLE_RING_TESTS} " == " false" ]]; then
55- yq -i ' del(.locations[] | select(.locationType == "location-scality-ring-s3-v1"))' e2e-config.yaml
56- fi
57-
58- if [ -z " $GCP_BACKEND_DESTINATION_LOCATION " ]; then
59- yq -i ' del(.locations[] | select(.locationType == "location-gcp-v1"))' e2e-config.yaml
60- fi
61-
62- docker build -t $E2E_IMAGE_NAME :$E2E_IMAGE_TAG .
63- kind load docker-image ${E2E_IMAGE_NAME} :${E2E_IMAGE_TAG}
64- docker rmi ${E2E_IMAGE_NAME} :${E2E_IMAGE_TAG}
65- )
66-
6757(
6858 cd .github/scripts/end2end
6959
0 commit comments