HARMONY-1564: Add debug info when harmony request fails. #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Harmony in a box | |
on: [push] | |
jobs: | |
harmony-in-a-box: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Install setuptools | |
run: sudo -H pip install setuptools | |
- name: Install docker | |
run: | | |
brew update | |
brew install docker | |
brew install kubectl | |
colima start --cpu 2 --memory 12 --with-kubernetes | |
- name: Install awslocal | |
run: | | |
pip install awscli-local | |
- name: Print awslocal Version | |
run: | | |
awslocal --version | |
- name: Create netrc | |
run: bin/create-netrc | |
env: | |
EDL_USER: ${{ secrets.EDL_USER }} | |
EDL_PASSWORD: ${{ secrets.EDL_PASSWORD }} | |
- name: Pull down basic harmony docker images | |
run: bin/pull-harmony-images | |
- name: Install dependencies | |
run: | | |
source bin/helper | |
retry_command 10 npm ci | |
- name: Build harmony image | |
run: | | |
source bin/helper | |
retry_command 10 npm run build | |
- name: Build all other images | |
run: | | |
source bin/helper | |
retry_command 10 npm run build-sequential | |
- name: list images | |
run: docker images | |
- name: Start harmony in a box | |
run: | | |
source bin/helper | |
export KUBE_CONTEXT=colima | |
export EXEC_CONTEXT=workflow | |
retry_command 5 bin/bootstrap-harmony | |
env: | |
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }} | |
OAUTH_UID: ${{ secrets.OAUTH_UID }} | |
OAUTH_PASSWORD: ${{ secrets.OAUTH_PASSWORD }} | |
- name: debug pods | |
run: | | |
kubectl -n harmony get pods | |
- name: Check if harmony server is up | |
run: | | |
HTTP_STATUS=$(curl -I -s -o /dev/null -w "%{http_code}" "http://localhost:3000") | |
echo "harmony server status code: $HTTP_STATUS" | |
- name: Run harmony request | |
id: curl | |
run: | | |
HTTP_STATUS=$(curl -Ln -bj -w "%{http_code}" "http://localhost:3000/C1233800302-EEDTEST/ogc-api-coverages/1.0.0/collections/all/coverage/rangeset?granuleId=G1233800343-EEDTEST&format=image/tiff" -o /dev/null) | |
echo "http_status=$HTTP_STATUS" >> "$GITHUB_OUTPUT" | |
- name: Check HTTP status code | |
env: | |
HTTP_STATUS: ${{ steps.curl.outputs.http_status }} | |
run: | | |
if [[ "$HTTP_STATUS" -eq 200 ]]; then | |
echo "HTTP request was successful!" | |
else | |
echo "HTTP request failed with status code $HTTP_STATUS" | |
kubectl -n harmony get pods | |
harmony_pod=$(kubectl get pods -n harmony -l app=harmony | grep -v NAME | awk '{print $1;}') | |
kubectl -n harmony describe pod $harmony_pod | |
echo "========harmony pod log" | |
kubectl -n harmony logs $harmony_pod | |
exit 1 | |
fi | |
- name: Wait for Giovanni pod to be ready | |
run: | | |
for i in {1..10}; do | |
kubectl -n harmony get pods | |
running_count=$(kubectl -n harmony get pods -l name="giovanni-adapter" --no-headers | grep "2/2" | wc -l) | |
if [ "$running_count" -eq 1 ]; then | |
echo "Giovanni pod is ready! Continue with the workflow." | |
break | |
else | |
echo "Giovanni pod is not ready, wait..." | |
sleep 60 | |
fi | |
done | |
# If Giovanni pod is still not ready, fail the workflow | |
if [ "$running_count" -ne 1 ]; then | |
echo "Failed: Giovanni pod is not ready after 10 minutes." | |
exit 1 | |
fi | |
- name: Test Giovanni request | |
id: giovanni | |
run: | | |
GIOVANNI_RESP=$(curl -Ln -bj "http://localhost:3000/C1225808238-GES_DISC/ogc-api-coverages/1.0.0/collections/Grid%2FprecipitationCal/coverage/rangeset?format=text%2Fcsv&point=0.76,-3.8&subset=time(%222020-01-06T12%3A00%3A00Z%22%3A%222020-01-06T16%3A00%3A00Z%22)") | |
GIOVANNI_URL=$(echo "$GIOVANNI_RESP" | jq -r '.links[] | select(.rel == "self") | .href') | |
echo "status_url: $GIOVANNI_URL" | |
echo "status_url=$GIOVANNI_URL" >> "$GITHUB_OUTPUT" | |
- name: Check Giovanni request final status | |
run: | | |
for i in {1..30}; do | |
GIOVANNI_STATUS==$(curl -Ln -bj "${{ steps.giovanni.outputs.status_url }}" | jq -r '.status') | |
if [ "$GIOVANNI_STATUS" != "running" ]; then | |
break | |
else | |
echo "Giovanni reqeust running, wait..." | |
sleep 10 | |
fi | |
done | |
echo "Giovanni request final status is $GIOVANNI_STATUS" | |
if [ "$GIOVANNI_STATUS" != "successful" ]; then | |
echo "Error: The final status is not successful." | |
exit 1 | |
else | |
echo "The final status is successful." | |
fi |