Skip to content

Commit 08a64a6

Browse files
committed
Update Gradlew Daemon to use existing build in cache
1 parent 5bfea39 commit 08a64a6

File tree

5 files changed

+41
-12
lines changed

5 files changed

+41
-12
lines changed

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

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ jobs:
7373
- name: Deploy sample app via terraform and wait for endpoint to come online
7474
working-directory: terraform/ec2
7575
run: |
76-
# Attempt to deploy the sample app on an EC2 instance and wait for its endpoint to come online.
77-
# There may be occasional failures due to transitivity issues, so try up to 2 times.
76+
# Attempt to deploy the sample app on an EC2 instance and wait for its endpoint to come online.
77+
# There may be occasional failures due to transitivity issues, so try up to 2 times.
7878
# deployment_failed of 0 indicates that both the terraform deployment and the endpoint are running, while 1 indicates
7979
# that it failed at some point
8080
retry_counter=0
@@ -90,11 +90,11 @@ jobs:
9090
-var="get_cw_agent_rpm_command=${{ env.GET_CW_AGENT_RPM_COMMAND }}" \
9191
-var="get_adot_jar_command=${{ env.GET_ADOT_JAR_COMMAND }}" \
9292
|| deployment_failed=$?
93-
93+
9494
if [ $deployment_failed -eq 1 ]; then
9595
echo "Terraform deployment was unsuccessful. Will attempt to retry deployment."
9696
fi
97-
97+
9898
# If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint.
9999
# Attempts to connect will be made for up to 10 minutes
100100
if [ $deployment_failed -eq 0 ]; then
@@ -108,12 +108,12 @@ jobs:
108108
deployment_failed=1
109109
break
110110
fi
111-
111+
112112
printf '.'
113113
attempt_counter=$(($attempt_counter+1))
114114
sleep 10
115115
done
116-
116+
117117
echo "Attempting to connect to the remote sample app endpoint"
118118
remote_sample_app_endpoint=http://$(terraform output sample_app_remote_service_public_ip):8080/healthcheck
119119
attempt_counter=0
@@ -124,26 +124,26 @@ jobs:
124124
deployment_failed=1
125125
break
126126
fi
127-
127+
128128
printf '.'
129129
attempt_counter=$(($attempt_counter+1))
130130
sleep 10
131131
done
132132
fi
133-
133+
134134
# If the success is 1 then either the terraform deployment or the endpoint connection failed, so first destroy the
135135
# resources created from terraform and try again.
136136
if [ $deployment_failed -eq 1 ]; then
137137
echo "Destroying terraform"
138138
terraform destroy -auto-approve \
139-
-var="test_id=${{ env.TESTING_ID }}"
140-
139+
-var="test_id=${{ env.TESTING_ID }}"
140+
141141
retry_counter=$(($retry_counter+1))
142142
else
143143
# If deployment succeeded, then exit the loop
144144
break
145145
fi
146-
146+
147147
if [ $retry_counter -eq $max_retry ]; then
148148
echo "Max retry reached, failed to deploy terraform and connect to the endpoint. Exiting code"
149149
exit 1
@@ -170,6 +170,12 @@ jobs:
170170
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/
171171
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/
172172
173+
- name: Initiate Gradlew Daemon
174+
uses: ./.github/workflows/actions/execute_and_retry
175+
with:
176+
command: "./gradlew"
177+
cleanup: "./gradlew clean"
178+
173179
# Validation for pulse telemetry data
174180
- name: Validate generated EMF logs
175181
id: log-validation

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ jobs:
265265
curl -S -s http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}/
266266
curl -S -s http://${{ env.APP_ENDPOINT }}/client-call/
267267
268+
- name: Initiate Gradlew Daemon
269+
uses: ./.github/workflows/actions/execute_and_retry
270+
with:
271+
command: "./gradlew"
272+
cleanup: "./gradlew clean"
273+
268274
# Validation for app signals telemetry data
269275
- name: Call endpoint and validate generated EMF logs
270276
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)