-
Notifications
You must be signed in to change notification settings - Fork 50
167 lines (140 loc) · 5.17 KB
/
harmony-in-a-box.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Harmony in a box
on: [push]
jobs:
harmony-in-a-box:
# TODO this is locked to macos-12 to fix an issue with the gdal dependency
# We will go back to macos-latest in HARMONY-1765
runs-on: macos-12
strategy:
matrix:
node-version: [22.x]
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Install setuptools
run: sudo -H pip install setuptools
- name: Install docker
run: |
brew update
brew install docker
brew install kubectl
- name: Install awslocal
run: |
pip install awscli-local
- name: Set up npm dependency caching
uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Create netrc
run: bin/create-netrc
env:
EDL_USER: ${{ secrets.LEO_EDL_USER }}
EDL_PASSWORD: ${{ secrets.LEO_EDL_PASSWORD }}
- name: Install dependencies
run: |
source bin/helper
retry_command 10 npm ci
- name: Start colima
run: colima start --cpu 2 --memory 12 --with-kubernetes
- name: Check colima status
run: colima status
- name: Pull down basic harmony docker images
run: bin/pull-harmony-images
- 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: Check kubernetes status
run: |
source bin/helper
retry_command 5 kubectl cluster-info
- 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
request_status==$(curl -Ln -bj "${{ steps.giovanni.outputs.status_url }}" | jq -r '.status')
# remove the leading = that shows up only in github actions
GIOVANNI_STATUS="${request_status#=}"
if [[ "$GIOVANNI_STATUS" != "running" ]]; then
break
else
echo "Giovanni request 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