Skip to content

Commit f921ad9

Browse files
authored
Merge pull request #36 from aws-observability/revert-35-revert-33-build-docker-for-e2e
Revert 35 revert 33 build docker for e2e
2 parents 9a6e0cb + 42134a5 commit f921ad9

File tree

5 files changed

+96
-50
lines changed

5 files changed

+96
-50
lines changed

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

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ env:
3131
LOG_GROUP_NAME: /aws/appsignals/generic
3232
TEST: ${{ inputs.test }}
3333
GET_ADOT_JAR_COMMAND: "wget -O adot.jar https://github.com/aws-observability/aws-otel-java-instrumentation/releases/latest/download/aws-opentelemetry-agent.jar"
34+
TEST_RESOURCES_FOLDER: /__w/aws-application-signals-test-framework/aws-application-signals-test-framework
3435
GET_CW_AGENT_RPM_COMMAND: "wget -O cw-agent.rpm https://amazoncloudwatch-agent-${{ inputs.aws-region }}.s3.${{ inputs.aws-region }}.amazonaws.com/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm"
35-
TEST_RESOURCES_FOLDER: /home/runner/work/aws-application-signals-test-framework/aws-application-signals-test-framework
36-
3736

3837
jobs:
3938
e2e-ec2-test:
4039
runs-on: ubuntu-latest
40+
container:
41+
image: public.ecr.aws/h6o3z5z9/aws-application-signals-test-framework-workflow-container:latest
4142
steps:
4243
- uses: actions/checkout@v4
4344
with:
@@ -64,13 +65,6 @@ jobs:
6465
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
6566
aws-region: ${{ inputs.aws-region }}
6667

67-
- name: Set up terraform
68-
uses: ./.github/workflows/actions/execute_and_retry
69-
with:
70-
command: "wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg"
71-
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
72-
&& sudo apt update && sudo apt install terraform'
73-
7468
- name: Initiate Terraform
7569
uses: ./.github/workflows/actions/execute_and_retry
7670
with:
@@ -176,13 +170,6 @@ jobs:
176170
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/aws-sdk-call/
177171
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_IP }}/
178172
curl -S -s http://${{ env.MAIN_SERVICE_ENDPOINT }}/client-call/
179-
180-
- name: Build Gradlew
181-
uses: ./.github/workflows/actions/execute_and_retry
182-
with:
183-
max_retry: 2
184-
command: "./gradlew"
185-
cleanup: "./gradlew clean"
186173
187174
# Validation for pulse telemetry data
188175
- name: Validate generated EMF logs
@@ -238,7 +225,7 @@ jobs:
238225
- name: Publish metric on test result
239226
if: always()
240227
run: |
241-
if [[ "${{ steps.log-validation.outcome }}" == "success" && "${{ steps.metric-validation.outcome }}" == "success" && "${{ steps.trace-validation.outcome }}" == "success" ]]; then
228+
if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
242229
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
243230
--metric-name Failure \
244231
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \

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

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ env:
3939
SAMPLE_APP_REMOTE_SERVICE_IMAGE: ${{ secrets.APP_SIGNALS_E2E_TEST_ACC }}.dkr.ecr.${{ inputs.aws-region }}.amazonawss.com/${{ secrets.APP_SIGNALS_E2E_RE_SA_IMG }}
4040
METRIC_NAMESPACE: AppSignals
4141
LOG_GROUP_NAME: /aws/appsignals/eks
42-
TEST_RESOURCES_FOLDER: /home/runner/work/aws-application-signals-test-framework/aws-application-signals-test-framework
42+
TEST_RESOURCES_FOLDER: /__w/aws-application-signals-test-framework/aws-application-signals-test-framework
4343

4444
jobs:
4545
e2e-eks-test:
4646
runs-on: ubuntu-latest
47+
container:
48+
image: public.ecr.aws/h6o3z5z9/aws-application-signals-test-framework-workflow-container:latest
4749
steps:
4850
- uses: actions/checkout@v4
4951
with:
@@ -86,24 +88,9 @@ jobs:
8688
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }}
8789
aws-region: ${{ inputs.aws-region }}
8890

89-
# local directory to store the kubernetes config
90-
- name: Create kubeconfig directory
91-
run: mkdir -p ${{ github.workspace }}/.kube
92-
93-
- name: Set KUBECONFIG environment variable
94-
run: echo KUBECONFIG="${{ github.workspace }}/.kube/config" >> $GITHUB_ENV
95-
9691
- name: Set up kubeconfig
9792
run: aws eks update-kubeconfig --name ${{ inputs.test-cluster-name }} --region ${{ inputs.aws-region }}
9893

99-
- name: Download and install eksctl
100-
uses: ./.github/workflows/actions/execute_and_retry
101-
with:
102-
pre-command: 'mkdir ${{ github.workspace }}/eksctl'
103-
command: 'curl -sLO "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz"
104-
&& tar -xzf eksctl_Linux_amd64.tar.gz -C ${{ github.workspace }}/eksctl && rm eksctl_Linux_amd64.tar.gz'
105-
cleanup: 'rm -f eksctl_Linux_amd64.tar.gz'
106-
10794
- name: Add eksctl to Github Path
10895
run: |
10996
echo "${{ github.workspace }}/eksctl" >> $GITHUB_PATH
@@ -121,13 +108,6 @@ jobs:
121108
--region ${{ inputs.aws-region }} \
122109
--approve"
123110

124-
- name: Set up terraform
125-
uses: ./.github/workflows/actions/execute_and_retry
126-
with:
127-
command: "wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg"
128-
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
129-
&& sudo apt update && sudo apt install terraform'
130-
131111
- name: Initiate Terraform
132112
uses: ./.github/workflows/actions/execute_and_retry
133113
with:
@@ -166,7 +146,7 @@ jobs:
166146
# If the deployment_failed is still 0, then the terraform deployment succeeded and now try to connect to the endpoint
167147
# after installing App Signals. Attempts to connect will be made for up to 10 minutes
168148
if [ $deployment_failed -eq 0 ]; then
169-
source ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
149+
. ${{ env.TEST_RESOURCES_FOLDER }}/.github/workflows/util/execute_and_retry.sh
170150
execute_and_retry 2 \
171151
"${{ env.TEST_RESOURCES_FOLDER }}/enablement-script/enable-app-signals.sh \
172152
${{ inputs.test-cluster-name }} \
@@ -277,13 +257,6 @@ jobs:
277257
curl -S -s http://${{ env.APP_ENDPOINT }}/remote-service?ip=${{ env.REMOTE_SERVICE_POD_IP }}/
278258
curl -S -s http://${{ env.APP_ENDPOINT }}/client-call/
279259
280-
- name: Build Gradlew
281-
uses: ./.github/workflows/actions/execute_and_retry
282-
with:
283-
max_retry: 2
284-
command: "./gradlew"
285-
cleanup: "./gradlew clean"
286-
287260
# Validation for app signals telemetry data
288261
- name: Call endpoint and validate generated EMF logs
289262
id: log-validation
@@ -340,7 +313,7 @@ jobs:
340313
- name: Publish metric on test result
341314
if: always()
342315
run: |
343-
if [[ "${{ steps.log-validation.outcome }}" == "success" && "${{ steps.metric-validation.outcome }}" == "success" && "${{ steps.trace-validation.outcome }}" == "success" ]]; then
316+
if [ "${{ steps.log-validation.outcome }}" = "success" ] && [ "${{ steps.metric-validation.outcome }}" = "success" ] && [ "${{ steps.trace-validation.outcome }}" = "success" ]; then
344317
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
345318
--metric-name Failure \
346319
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=${{ inputs.caller-workflow-name }} \
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
id-token: write
8+
contents: read
9+
10+
jobs:
11+
build-and-push-image:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Configure AWS Credentials
18+
uses: aws-actions/configure-aws-credentials@v4
19+
with:
20+
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_ARN }}
21+
aws-region: us-east-1
22+
23+
- name: Login to Amazon ECR
24+
id: login-ecr-public
25+
uses: aws-actions/amazon-ecr-login@v2
26+
with:
27+
registry-type: public
28+
29+
- name: Build, tag, and push image to Amazon ECR
30+
id: build-image
31+
env:
32+
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
33+
REGISTRY_ALIAS: h6o3z5z9
34+
REPOSITORY: aws-application-signals-test-framework-workflow-container
35+
IMAGE_TAG: latest
36+
run: |
37+
docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG .
38+
docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG

.github/workflows/util/execute_and_retry.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ execute_and_retry () {
3030
done
3131
}
3232

33-
export -f execute_and_retry
33+
export VARIABLE=execute_and_retry

Dockerfile

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Use an image with java 11 installed as the basis
2+
FROM openjdk:11-jdk
3+
4+
# Set the Java path
5+
ENV JAVA_HOME=/usr/local/openjdk-11
6+
ENV PATH="$JAVA_HOME/bin:${PATH}"
7+
8+
# Install the neccessary commands
9+
RUN \
10+
apt-get update -y && \
11+
apt-get install unzip -y && \
12+
apt-get install wget -y && \
13+
apt-get install vim -y && \
14+
apt-get install curl -y && \
15+
apt-get install git -y && \
16+
apt-get install jq -y
17+
18+
# Install kubectl
19+
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \
20+
&& chmod +x ./kubectl \
21+
&& mv ./kubectl /usr/local/bin/kubectl
22+
23+
# Install awscli
24+
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
25+
unzip awscliv2.zip && \
26+
./aws/install && \
27+
rm -rf awscliv2.zip ./aws
28+
29+
# Install Terraform
30+
RUN wget https://releases.hashicorp.com/terraform/1.7.5/terraform_1.7.5_linux_amd64.zip
31+
RUN unzip terraform_1.7.5_linux_amd64.zip
32+
RUN mv terraform /usr/local/bin/
33+
34+
# Install eksctl
35+
RUN curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_Linux_amd64.tar.gz"
36+
RUN tar -xzf eksctl_Linux_amd64.tar.gz -C /tmp && rm eksctl_Linux_amd64.tar.gz
37+
RUN mv /tmp/eksctl /usr/local/bin
38+
39+
# Copy the Gradle wrapper files (gradlew and gradle wrapper jar) to the container
40+
COPY gradlew .
41+
COPY settings.gradle.kts .
42+
COPY gradlew.bat .
43+
COPY gradle/ /gradle/
44+
COPY buildSrc/ /buildSrc/
45+
COPY validator/ /validator/
46+
47+
# Build gradlew here so that the canary doesn't spend time downloading and building the package
48+
RUN ./gradlew

0 commit comments

Comments
 (0)