@@ -94,38 +94,42 @@ jobs:
94
94
- name : Set up kubeconfig
95
95
run : aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }}
96
96
97
+ - name : Download eksctl
98
+ uses : ./.github/workflows/actions/execute_and_retry
99
+ with :
100
+ pre-command : ' mkdir ${{ github.workspace }}/eksctl'
101
+ command : ' curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz"'
102
+
97
103
- name : Install eksctl
98
104
run : |
99
- source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
100
- mkdir ${{ github.workspace }}/eksctl
101
- curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz"
102
- execute_and_retry 2 "tar -xzf eksctl_Linux_amd64.tar.gz -C ${{ github.workspace }}/eksctl && rm eksctl_Linux_amd64.tar.gz"
105
+ tar -xzf eksctl_Linux_amd64.tar.gz -C ${{ github.workspace }}/eksctl && rm eksctl_Linux_amd64.tar.gz
103
106
echo "${{ github.workspace }}/eksctl" >> $GITHUB_PATH
104
107
105
108
- name : Create role for AWS access from the sample app
106
109
id : create_service_account
107
- run : |
108
- eksctl create iamserviceaccount \
110
+ uses : ./.github/workflows/actions/execute_and_retry
111
+ with :
112
+ command : " eksctl create iamserviceaccount \
109
113
--name service-account-${{ env.TESTING_ID }} \
110
114
--namespace ${{ env.SAMPLE_APP_NAMESPACE }} \
111
115
--cluster ${{ inputs.test-cluster-name }} \
112
116
--role-name eks-s3-access-${{ env.TESTING_ID }} \
113
117
--attach-policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess \
114
118
--region ${{ inputs.aws-region }} \
115
- --approve
119
+ --approve"
116
120
117
121
- name : Set up terraform
118
- run : |
119
- source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
120
- execute_and_retry 2 "wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg"
121
- echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
122
- sudo apt update && sudo apt install terraform
122
+ uses : ./.github/workflows/actions/execute_and_retry
123
+ with :
124
+ command : " wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg"
125
+ post-command : ' echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list \
126
+ sudo apt update && sudo apt install terraform'
123
127
124
128
- name : Initiate Terraform
125
- working-directory : terraform/eks
126
- run : |
127
- source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
128
- execute_and_retry 2 "terraform init && terraform validate" "rm -rf .terraform && rm -rf .terraform.lock.hcl"
129
+ uses : ./.github/workflows/actions/execute_and_retry
130
+ with :
131
+ command : " cd ${{ env.TEST_RESOURCES_FOLDER }}/terraform/eks && terraform init && terraform validate "
132
+ cleanup : " rm -rf .terraform && rm -rf .terraform.lock.hcl"
129
133
130
134
- name : Deploy sample app via terraform and wait for the endpoint to come online
131
135
id : deploy-sample-app
@@ -159,6 +163,21 @@ jobs:
159
163
# If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint
160
164
# after installing App Signals. Attempts to connect will be made for up to 10 minutes
161
165
if [ $deployment_failed -eq 0 ]; then
166
+ source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
167
+ execute_and_retry 2 \
168
+ "${{ env.TEST_RESOURCES_FOLDER }}/enablement-script/scripts/eks/appsignals/enable-app-signals.sh \
169
+ ${{ inputs.test-cluster-name }} \
170
+ ${{ inputs.aws-region }} \
171
+ ${{ env.SAMPLE_APP_NAMESPACE }}" \
172
+ "${{ env.TEST_RESOURCES_FOLDER }}/enablement-script/scripts/eks/appsignals/clean-app-signals.sh \
173
+ ${{ inputs.test-cluster-name }} \
174
+ ${{ inputs.aws-region }} \
175
+ ${{ env.SAMPLE_APP_NAMESPACE }} && \
176
+ aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }}"
177
+
178
+ kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }}
179
+ kubectl wait --for=condition=Ready pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }}
180
+
162
181
echo "Attempting to connect to the main sample app endpoint"
163
182
main_sample_app_endpoint=http://$(terraform output sample_app_endpoint)
164
183
attempt_counter=0
@@ -176,9 +195,7 @@ jobs:
176
195
done
177
196
178
197
echo "Attempting to connect to the remote sample app endpoint"
179
- remote_service_pod_ip=$(kubectl get pods -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=remote-app -o jsonpath='{.items[0].status.podIP}')
180
- remote_sample_app_endpoint=http://$remote_service_pod_ip/healthcheck
181
- echo $remote_service_pod_ip
198
+ remote_sample_app_endpoint=http://$(terraform output sample_remote_app_endpoint)/healthcheck
182
199
echo $remote_sample_app_endpoint
183
200
attempt_counter=0
184
201
max_attempts=60
@@ -198,6 +215,15 @@ jobs:
198
215
# If the deployment_failed is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
199
216
# resources created from terraform and try again.
200
217
if [ $deployment_failed -eq 1 ]; then
218
+ echo "Cleaning up App Signal"
219
+ ./clean-app-signals.sh \
220
+ ${{ inputs.test-cluster-name }} \
221
+ ${{ inputs.aws-region }} \
222
+ ${{ env.SAMPLE_APP_NAMESPACE }}
223
+
224
+ # Running clean-app-signal.sh removes the current cluster from the config. Update the cluster again for subsequent runs.
225
+ aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }}
226
+
201
227
echo "Destroying terraform"
202
228
terraform destroy -auto-approve \
203
229
-var="test_id=${{ env.TESTING_ID }}" \
@@ -220,24 +246,6 @@ jobs:
220
246
fi
221
247
done
222
248
223
- - name : Install AppSignals addon
224
- run : |
225
- source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
226
- execute_and_retry 2 \
227
- "${GITHUB_WORKSPACE}/enablement-script/scripts/eks/appsignals/enable-app-signals.sh \
228
- ${{ inputs.test-cluster-name }} \
229
- ${{ inputs.aws-region }} \
230
- ${{ env.SAMPLE_APP_NAMESPACE }}" \
231
- " echo "Cleaning up App Signal" \
232
- ./clean-app-signals.sh \
233
- ${{ inputs.test-cluster-name }} \
234
- ${{ inputs.aws-region }} \
235
- ${{ env.SAMPLE_APP_NAMESPACE }} && \
236
- aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }}"
237
-
238
- kubectl delete pods --all -n ${{ env.SAMPLE_APP_NAMESPACE }}
239
- kubectl wait --for=condition=Ready pod --all -n ${{ env.SAMPLE_APP_NAMESPACE }}
240
-
241
249
- name : Get remote service pod name and IP
242
250
run : |
243
251
echo "REMOTE_SERVICE_DEPLOYMENT_NAME=$(kubectl get deployments -n ${{ env.SAMPLE_APP_NAMESPACE }} --selector=app=remote-app -o jsonpath='{.items[0].metadata.name}')" >> $GITHUB_ENV
@@ -267,9 +275,9 @@ jobs:
267
275
curl -S -s http://${{ env.APP_ENDPOINT }}/client-call/
268
276
269
277
- name : Build Gradlew
270
- run : |
271
- source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
272
- execute_and_retry 2 "./gradlew"
278
+ uses : ./.github/workflows/actions/execute_and_retry
279
+ with :
280
+ command : " ./gradlew"
273
281
274
282
# Validation for app signals telemetry data
275
283
- name : Call endpoint and validate generated EMF logs
0 commit comments