@@ -69,12 +69,12 @@ run_deployment() {
6969 helm dependency update charts/eoapi
7070
7171 local helm_cmd=" helm upgrade --install $RELEASE_NAME charts/eoapi -n $NAMESPACE --create-namespace"
72- local use_experimental =false
72+ local testing_mode =false
7373
7474 if [[ -f " charts/eoapi/profiles/experimental.yaml" ]]; then
7575 log_info " Applying experimental profile..."
7676 helm_cmd=" $helm_cmd -f charts/eoapi/profiles/experimental.yaml"
77- use_experimental =true
77+ testing_mode =true
7878 fi
7979 if [[ -f " charts/eoapi/profiles/local/k3s.yaml" ]]; then
8080 log_info " Applying k3s local profile..."
@@ -84,28 +84,41 @@ run_deployment() {
8484 helm_cmd=" $helm_cmd --set eoapi-notifier.config.sources[0].type=pgstac"
8585 helm_cmd=" $helm_cmd --set eoapi-notifier.config.sources[0].config.connection.existingSecret.name=$RELEASE_NAME -pguser-eoapi"
8686
87- # Set UPSTREAM_URL and OIDC_DISCOVERY_URL dynamically for stac-auth-proxy when experimental profile is used
88- # The experimental profile enables stac-auth-proxy, so we need to set the correct service names
87+ # Set UPSTREAM_URL and OIDC_DISCOVERY_URL dynamically for stac-auth-proxy when testing mode is enabled
88+ # Testing mode enables stac-auth-proxy, so we need to set the correct service names
8989 # Also configure STAC service to run without root path when behind auth proxy
90- if [[ " $use_experimental " == " true" ]]; then
91- helm_cmd=" $helm_cmd --set stac-auth-proxy.env.UPSTREAM_URL=http://$RELEASE_NAME -stac:8080"
92- helm_cmd=" $helm_cmd --set stac-auth-proxy.env.OIDC_DISCOVERY_URL=http://$RELEASE_NAME -mock-oidc-server.$NAMESPACE .svc.cluster.local:8080/.well-known/openid-configuration"
93- # Note: initContainer service names are dynamically replaced by the stac-auth-proxy-patch job
90+ if [[ " $testing_mode " == " true" ]]; then
91+ # Create temporary values file for dynamic stac-auth-proxy configuration
92+ local temp_values=" /tmp/stac-auth-proxy-values-${RELEASE_NAME} .yaml"
93+ cat > " $temp_values " << EOF
94+ stac-auth-proxy:
95+ env:
96+ UPSTREAM_URL: "http://${RELEASE_NAME} -stac:8080"
97+ OIDC_DISCOVERY_URL: "http://${RELEASE_NAME} -mock-oidc-server.${NAMESPACE} .svc.cluster.local:8080/.well-known/openid-configuration"
98+ initContainers:
99+ - name: wait-for-mock-oidc
100+ image: busybox:1.35
101+ command: ['sh', '-c', 'until nc -z ${RELEASE_NAME} -mock-oidc-server.${NAMESPACE} .svc.cluster.local 8080; do echo waiting for mock-oidc; sleep 2; done']
102+ - name: wait-for-stac
103+ image: busybox:1.35
104+ command: ['sh', '-c', 'until nc -z ${RELEASE_NAME} -stac.${NAMESPACE} .svc.cluster.local 8080; do echo waiting for stac service; sleep 2; done']
105+ EOF
106+ helm_cmd=" $helm_cmd -f $temp_values "
94107 # Configure STAC service to run without root path when behind auth proxy
95108 # Empty string makes STAC service run at root path (no --root-path argument)
96109 helm_cmd=" $helm_cmd --set 'stac.overrideRootPath='"
97110 fi
98111
99112 if is_ci; then
100113 log_info " Applying CI-specific configurations..."
101-
102- helm_cmd=" $helm_cmd --set testing=true"
103114 helm_cmd=" $helm_cmd --set monitoring.prometheusAdapter.prometheus.url=http://$RELEASE_NAME -prometheus-server.eoapi.svc.cluster.local"
115+ testing_mode=true
104116 fi
105117
106118 helm_cmd=" $helm_cmd --timeout $TIMEOUT "
107119
108120 log_info " Deploying eoAPI..."
121+ local deploy_result=0
109122 if eval " $helm_cmd " ; then
110123 log_success " eoAPI deployed successfully"
111124
@@ -153,8 +166,15 @@ run_deployment() {
153166 fi
154167 else
155168 log_error " Deployment failed"
156- return 1
169+ deploy_result= 1
157170 fi
171+
172+ # Cleanup temporary files
173+ if [[ " $testing_mode " == " true" ]] && [[ -f " /tmp/stac-auth-proxy-values-${RELEASE_NAME} .yaml" ]]; then
174+ rm -f " /tmp/stac-auth-proxy-values-${RELEASE_NAME} .yaml"
175+ fi
176+
177+ return $deploy_result
158178}
159179
160180debug_deployment () {
0 commit comments