@@ -116,7 +116,7 @@ jobs:
116116 sleep 1
117117 done
118118 echo "all services have started, moving on..."
119-
119+
120120 - name : cleanup if services fail to boot
121121 if : steps.watchservices.outcome == 'failure'
122122 run : |
@@ -163,164 +163,3 @@ jobs:
163163 - name : helm uninstall eoapi templates
164164 run : |
165165 helm uninstall $RELEASE_NAME
166-
167- gcp-integration-tests :
168- # run on:
169- # - a PR was just labeled 'test-integration-gcp'
170- # - a PR was just labeled 'test-integration'
171- # - a PR with 'test-integration' label was opened, reopened, or synchronized
172- if : |
173- github.event.label.name == 'test-integration-gcp' ||
174- contains( github.event.pull_request.labels.*.name, 'test-integration-gcp')
175- permissions :
176- contents : ' read'
177- id-token : ' write'
178- needs : helm-tests
179- runs-on : ubuntu-latest
180- steps :
181- - uses : actions/checkout@v4
182-
183- - uses : azure/setup-helm@v4
184- with :
185- version : ${{ env.HELM_VERSION }}
186- # token: ${{ secrets.GITHUB_TOKEN }}
187-
188- - name : last commit sha if PR
189- if : ${{ github.event_name == 'pull_request' }}
190- shell : bash
191- run : |
192- echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV}
193-
194- - name : last commit sha if push
195- if : ${{ github.event_name == 'push' }}
196- shell : bash
197- run : |
198- echo "LAST_COMMIT_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV}
199-
200- - name : set k8s .release.name suffix
201- run : |
202- # salt for randomness per test run
203- COMMITSHA=$(echo $LAST_COMMIT_SHA | cut -c 1-6)
204- SALT=$(echo "${RANDOM}${RANDOM}${RANDOM}" | cut -c1-3)
205- echo "RELEASE_NAME=eoapi$COMMITSHA$SALT" >> $GITHUB_ENV
206-
207- - id : ' auth'
208- uses : ' google-github-actions/auth@v2'
209- with :
210- service_account :
' [email protected] ' 211- credentials_json : ${{ secrets.GH_ACTIONS_SA_JSON }}
212-
213- - name : setup gcloud sdk
214- uses : google-github-actions/setup-gcloud@v2
215- with :
216- version : ' >= 363.0.0'
217- project_id : ' devseed-labs'
218-
219- - name : configure kubectl context
220- run : |
221- gcloud components install gke-gcloud-auth-plugin
222- gcloud container clusters get-credentials k8seed-labs-cluster --zone us-central1-f
223-
224- - name : helm install crunchydata postgres operator
225- run : |
226- helm upgrade --install \
227- --set disable_check_for_upgrades=true \
228- pgo \
229- oci://registry.developers.crunchydata.com/crunchydata/pgo \
230- --version ${{ env.PGO_VERSION }}
231-
232- - name : helm render/install eoapi templates
233- run : |
234- HOST='${{ env.RELEASE_NAME }}.k8s.labs.ds.io'
235- echo $HOST
236-
237- cd helm-chart
238-
239- helm dependency build eoapi
240-
241- helm install $RELEASE_NAME \
242- --namespace $RELEASE_NAME \
243- --create-namespace \
244- --set ingress.host=$HOST \
245- -f ./eoapi/values.yaml \
246- -f ./eoapi/test-gcp-unittest-values.yaml \
247- ./eoapi
248-
249- - name : sleep for 10s seconds while services boot
250- shell : bash
251- run : sleep 10s
252-
253- # - name: Setup upterm session
254- # uses: lhotari/action-upterm@v1
255-
256- - id : watchservices
257- name : watch services boot
258- timeout-minutes : 10
259- continue-on-error : true
260- run : |
261- kubectl config set-context --current --namespace=$RELEASE_NAME
262- while [[ -z "$(kubectl get pod | grep "^raster-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /.*/healthz" | head -n 1)" ]]; do
263- echo "still waiting for raster service to start..."
264- sleep 1
265- done
266- echo "raster service has started, moving on..."
267- while [[ -z "$(kubectl get pod | grep "^vector-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /healthz" | head -n 1)" ]]; do
268- echo "still waiting for vector service to start..."
269- sleep 1
270- done
271- echo "vector service has started, moving on..."
272- while [[ -z "$(kubectl get pod | grep "^stac-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /_mgmt/ping" | head -n 1)" ]]; do
273- echo "still waiting for stac service to start..."
274- sleep 1
275- done
276- echo "all services have started, moving on..."
277-
278- - name : cleanup if services fail to boot
279- if : steps.watchservices.outcome == 'failure'
280- run : |
281- echo "The previous step failed or timed out. Running cleanup logic..."
282- helm uninstall $RELEASE_NAME
283-
284- kubectl delete ns/$RELEASE_NAME
285-
286- # force GH action to show failed result
287- exit 128
288-
289- - name : install python unit-test dependencies
290- run : |
291- python -m pip install pytest httpx
292-
293- - name : run the tests
294- id : testrunner
295- continue-on-error : true
296- run : |
297- kubectl config set-context --current --namespace=$RELEASE_NAME
298- PUBLICIP='https://${{ env.RELEASE_NAME }}.k8s.labs.ds.io'
299- export VECTOR_ENDPOINT=$PUBLICIP/vector$RELEASE_NAME
300- export STAC_ENDPOINT=$PUBLICIP/stac$RELEASE_NAME
301- export RASTER_ENDPOINT=$PUBLICIP/raster$RELEASE_NAME
302-
303- echo '#################################'
304- echo $VECTOR_ENDPOINT
305- echo $STAC_ENDPOINT
306- echo $RASTER_ENDPOINT
307- echo '#################################'
308-
309- pytest .github/workflows/tests/test_vector.py
310- pytest .github/workflows/tests/test_stac.py
311- # TODO: fix raster tests
312- #pytest .github/workflows/tests/test_raster.py
313-
314- - name : cleanup if tests fail
315- if : steps.testrunner.outcome == 'failure'
316- run : |
317- echo "The previous step failed or timed out. Running cleanup logic..."
318- helm uninstall $RELEASE_NAME
319- kubectl delete ns/$RELEASE_NAME
320- # force GH action to show failed result
321- exit 128
322-
323- - name : helm uninstall eoapi templates
324- run : |
325- helm uninstall $RELEASE_NAME
326- kubectl delete ns/$RELEASE_NAME
0 commit comments