-
Notifications
You must be signed in to change notification settings - Fork 56
167 lines (144 loc) · 5.64 KB
/
nightly-upstream-snapshot-build.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: Nightly Snapshot Build
on:
schedule:
- cron: "21 3 * * *"
workflow_dispatch:
env:
AWS_DEFAULT_REGION: us-east-1
IMAGE_REGISTRY: 611364707713.dkr.ecr.us-west-2.amazonaws.com
IMAGE_NAME: adot-autoinstrumentation-java-nightly
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
outputs:
time_stamp_tag: ${{ steps.generate_time_stamp.outputs.nowTimeTag}}
release-candidate-image: ${{ steps.imageOutput.outputs.rcImage }}
image_registry: ${{ steps.imageOutput.outputs.imageRegistry }}
image_name: ${{ steps.imageOutput.outputs.imageName }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Log in to AWS ECR
uses: docker/login-action@v3
with:
registry: public.ecr.aws
- name: Build snapshot with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: build --stacktrace -PenableCoverage=true -PtestUpstreamSnapshots=true
env:
PUBLISH_TOKEN_USERNAME: ${{ secrets.PUBLISH_TOKEN_USERNAME }}
PUBLISH_TOKEN_PASSWORD: ${{ secrets.PUBLISH_TOKEN_PASSWORD }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Get current version
id: getADOTJavaVersion
shell: bash
run: echo "adot_java_version=$(./gradlew printVersion -q -PtestUpstreamSnapshots=true )" >> $GITHUB_OUTPUT
- name: Generate timestamp for image tag
id: generate_time_stamp
run: echo "nowTimeTag=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_OUTPUT
- name: Set image to output
id: imageOutput
run: |
echo "imageRegistry=${{ env.IMAGE_REGISTRY }}" >> $GITHUB_OUTPUT
echo "imageName=${{ env.IMAGE_NAME }}" >> $GITHUB_OUTPUT
echo "rcImage=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.generate_time_stamp.outputs.nowTimeTag }}" >> $GITHUB_OUTPUT
- name: Build and Push Java Agent Image and Execute cpUtility Tests
uses: ./.github/actions/cpUtility-testing
with:
aws-region: us-west-2
image_uri_with_tag: ${{ steps.imageOutput.outputs.rcImage }}
image_registry: ${{ steps.imageOutput.outputs.imageRegistry }}
adot-java-version: ${{ steps.getADOTJavaVersion.outputs.adot_java_version }}
snapshot-ecr-role: ${{ secrets.JAVA_INSTRUMENTATION_SNAPSHOT_ECR }}
- name: Upload to GitHub Actions
uses: actions/upload-artifact@v3
with:
name: aws-opentelemetry-agent.jar
path: otelagent/build/libs/aws-opentelemetry-agent-*.jar
default-region-output:
runs-on: ubuntu-latest
outputs:
aws_default_region: ${{ steps.default_region_output.outputs.aws_default_region }}
steps:
- name: Set default region output
id: default_region_output
run: |
echo "aws_default_region=${{ env.AWS_DEFAULT_REGION }}" >> $GITHUB_OUTPUT
e2e-operator-test:
concurrency:
group: e2e-adot-agent-operator-test
cancel-in-progress: false
needs: [build, default-region-output]
uses: ./.github/workflows/e2e-tests-with-operator.yml
secrets: inherit
with:
aws-region: ${{ needs.default-region-output.outputs.aws_default_region }}
image_tag: ${{ needs.build.outputs.time_stamp_tag }}
image_uri: ${{ needs.build.outputs.image_registry }}/${{ needs.build.outputs.image_name }}
test_ref: 'terraform'
caller-workflow-name: 'nightly-upstream-snapshot-build'
# AppSignals Contract Tests
contract-tests:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- uses: gradle/wrapper-validation-action@v1
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE_ARN }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: Log in to AWS ECR
uses: docker/login-action@v3
with:
registry: public.ecr.aws
- name: Pull base image of Contract Tests Sample Apps
run: docker pull public.ecr.aws/docker/library/amazoncorretto:17-alpine
- name: Build snapshot with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: contractTests -PtestUpstreamSnapshots=true -PlocalDocker=true
# AppSignals specific e2e tests
appsignals-e2e-test:
needs: [build,default-region-output]
uses: ./.github/workflows/application-signals-e2e-test.yml
secrets: inherit
with:
adot-image-name: ${{ needs.build.outputs.release-candidate-image }}
publish-build-status:
needs: [ build, contract-tests ]
if: ${{ always() }}
uses: ./.github/workflows/publish-status.yml
with:
namespace: 'ADOT/GitHubActions'
repository: ${{ github.repository }}
branch: ${{ github.ref_name }}
workflow: nightly-upstream-snapshot-build
success: ${{ needs.build.result == 'success' &&
needs.contract-tests.result == 'success' }}
region: us-east-1
secrets:
roleArn: ${{ secrets.METRICS_ROLE_ARN }}