Skip to content

Commit 1748faa

Browse files
committed
Update Gradlew Daemon to use existing build in cache
1 parent 1bb9d6b commit 1748faa

File tree

5 files changed

+44
-12
lines changed

5 files changed

+44
-12
lines changed

.github/workflows/appsignals-e2e-ec2-test.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ jobs:
7474
- name: Deploy sample app via terraform and wait for endpoint to come online
7575
working-directory: terraform/ec2
7676
run: |
77-
# Attempt to deploy the sample app on an EC2 instance and wait for its endpoint to come online.
78-
# There may be occasional failures due to transitivity issues, so try up to 2 times.
77+
# Attempt to deploy the sample app on an EC2 instance and wait for its endpoint to come online.
78+
# There may be occasional failures due to transitivity issues, so try up to 2 times.
7979
# deployment_failed of 0 indicates that both the terraform deployment and the endpoint are running, while 1 indicates
8080
# that it failed at some point
8181
retry_counter=0
@@ -91,11 +91,11 @@ jobs:
9191
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
9292
-var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
9393
|| deployment_failed=$?
94-
94+
9595
if [ $deployment_failed -eq 1 ]; then
9696
echo "Terraform deployment was unsuccessful. Will attempt to retry deployment."
9797
fi
98-
98+
9999
# If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint.
100100
# Attempts to connect will be made for up to 10 minutes
101101
if [ $deployment_failed -eq 0 ]; then
@@ -109,12 +109,12 @@ jobs:
109109
deployment_failed=1
110110
break
111111
fi
112-
112+
113113
printf '.'
114114
attempt_counter=$(($attempt_counter+1))
115115
sleep 10
116116
done
117-
117+
118118
echo "Attempting to connect to the remote sample app endpoint"
119119
remote_sample_app_endpoint=http://$(terraform output sample_app_remote_service_public_ip):8080/healthcheck
120120
attempt_counter=0
@@ -125,26 +125,26 @@ jobs:
125125
deployment_failed=1
126126
break
127127
fi
128-
128+
129129
printf '.'
130130
attempt_counter=$(($attempt_counter+1))
131131
sleep 10
132132
done
133133
fi
134-
134+
135135
# If the success is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
136136
# resources created from terraform and try again.
137137
if [ $deployment_failed -eq 1 ]; then
138138
echo "Destroying terraform"
139139
terraform destroy -auto-approve \
140-
-var="test_id=${{ env.TESTING_ID }}"
141-
140+
-var="test_id=${{ env.TESTING_ID }}"
141+
142142
retry_counter=$(($retry_counter+1))
143143
else
144144
# If deployment succeeded, then exit the loop
145145
break
146146
fi
147-
147+
148148
if [ $retry_counter -eq $max_retry ]; then
149149
echo "Max retry reached, failed to deploy terraform and connect to the endpoint. Exiting code"
150150
exit 1
@@ -171,6 +171,12 @@ jobs:
171171
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/
172172
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/
173173
174+
- name: Initiate Gradlew Daemon
175+
uses: ./.github/workflows/actions/execute_and_retry
176+
with:
177+
command: "./gradlew"
178+
cleanup: "./gradlew clean"
179+
174180
# Validation for pulse telemetry data
175181
- name: Validate generated EMF logs
176182
id: log-validation

.github/workflows/appsignals-e2e-eks-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ jobs:
258258
curl -S -s http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}/
259259
curl -S -s http://${{ env.APP_ENDPOINT }}/client-call/
260260
261+
- name: Initiate Gradlew Daemon
262+
run: ./gradlew
263+
264+
- name: Initiate Gradlew Daemon
265+
uses: ./.github/workflows/actions/execute_and_retry
266+
with:
267+
command: "./gradlew"
268+
cleanup: "./gradlew clean"
269+
261270
# Validation for app signals telemetry data
262271
- name: Call endpoint and validate generated EMF logs
263272
id: log-validation

Dockerfile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,19 @@ RUN mv /tmp/eksctl /usr/local/bin
4040
COPY gradlew .
4141
COPY settings.gradle.kts .
4242
COPY gradlew.bat .
43+
COPY gradle.properties .
4344
COPY gradle/ /gradle/
4445
COPY buildSrc/ /buildSrc/
4546
COPY validator/ /validator/
4647

4748
# Build gradlew here so that the canary doesn't spend time downloading and building the package
48-
RUN ./gradlew
49+
RUN ./gradlew
50+
51+
# Set a custom Gradle user home directory
52+
ENV GRADLE_USER_HOME=/.gradle/
53+
54+
# Create the custom Gradle user home directory
55+
RUN mkdir -p $GRADLE_USER_HOME
56+
57+
# Copy the Gradle cache from the default location to the custom location
58+
RUN cp -r ~/.gradle/* $GRADLE_USER_HOME

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.caching=true

settings.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ dependencyResolutionManagement {
1717
}
1818
}
1919

20+
buildCache {
21+
local {
22+
isEnabled = true
23+
}
24+
}
25+
2026

2127
// End to end tests
2228
include(":validator")

0 commit comments

Comments
 (0)