Skip to content

Commit 3860b2f

Browse files
authored
Merge branch 'main' into ci/test-race
2 parents c332683 + 8f810cb commit 3860b2f

File tree

110 files changed

+2443
-1223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2443
-1223
lines changed

.ci/scripts/push-pgo-pr.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
5+
PGO_BRANCH="update-pgo-$(date +%s)"
6+
cd $WORKSPACE_PATH
7+
git fetch origin main
8+
git checkout main
9+
git checkout -b $PGO_BRANCH
10+
mv $PROFILE_PATH x-pack/apm-server/default.pgo
11+
git add x-pack/apm-server/default.pgo
12+
git commit -m "PGO: Update default.pgo from benchmarks $WORKFLOW."
13+
git push -u origin $PGO_BRANCH
14+
gh pr create -B main -H $PGO_BRANCH -t "PGO: Update default.pgo" -b "Update default.pgo CPU profile from the benchmarks [workflow]($WORKFLOW)." -R elastic/apm-server
15+
gh pr merge --auto --delete-branch --squash $PGO_BRANCH

.github/workflows/add-to-docs-project.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ jobs:
1111
runs-on: ubuntu-latest
1212
if: github.event.label.name == 'Team:Docs'
1313
steps:
14+
- name: Get token
15+
id: get_token
16+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
17+
with:
18+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
19+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
20+
permissions: >-
21+
{
22+
"organization_projects": "write",
23+
"issues": "read"
24+
}
1425
- uses: octokit/[email protected]
1526
id: add_to_project
1627
with:
@@ -28,4 +39,4 @@ jobs:
2839
contentid: ${{ github.event.issue.node_id }}
2940
env:
3041
PROJECT_ID: "PVT_kwDOAGc3Zs0iZw"
31-
GITHUB_TOKEN: ${{ secrets.APM_TECH_USER_TOKEN }}
42+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}

.github/workflows/add-to-project.yml

+12-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@ jobs:
1414
name: Add issue to project
1515
runs-on: ubuntu-latest
1616
steps:
17+
- name: Get token
18+
id: get_token
19+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
20+
with:
21+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
22+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
23+
permissions: >-
24+
{
25+
"organization_projects": "write",
26+
"issues": "read"
27+
}
1728
- uses: actions/[email protected]
1829
with:
1930
project-url: https://github.com/orgs/elastic/projects/1286
20-
github-token: ${{ secrets.APM_TECH_USER_TOKEN }}
31+
github-token: ${{ steps.get_token.outputs.token }}

.github/workflows/benchmarks.yml

+102-15
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: benchmarks
33
on:
44
workflow_dispatch:
55
inputs:
6+
runStandalone:
7+
description: 'Run the benchmarks against standalone APM Server with Moxy'
8+
required: false
9+
type: boolean
10+
default: false
611
profile:
712
description: 'The system profile used to run the benchmarks'
813
required: false
@@ -21,10 +26,12 @@ on:
2126
required: false
2227
type: string
2328
schedule:
24-
- cron: '0 17 * * *'
29+
- cron: '0 17 * * *' # Scheduled regular benchmarks.
30+
- cron: '0 5 */5 * *' # Scheduled PGO benchmarks.
2531

2632
env:
2733
PNG_REPORT_FILE: out.png
34+
BENCHMARK_CPU_OUT: default.pgo
2835
BENCHMARK_RESULT: benchmark-result.txt
2936
WORKING_DIRECTORY: testing/benchmark
3037

@@ -38,12 +45,14 @@ jobs:
3845
run:
3946
working-directory: ${{ env.WORKING_DIRECTORY }}
4047
permissions:
41-
contents: read
48+
contents: write
4249
id-token: write
4350
env:
4451
SSH_KEY: ./id_rsa_terraform
4552
TF_VAR_private_key: ./id_rsa_terraform
4653
TF_VAR_public_key: ./id_rsa_terraform.pub
54+
TF_VAR_run_standalone: ${{ inputs.runStandalone || github.event.schedule=='0 5 */5 * *' }}
55+
RUN_STANDALONE: ${{ inputs.runStandalone || github.event.schedule=='0 5 */5 * *' }}
4756
TFVARS_SOURCE: ${{ inputs.profile || 'system-profiles/8GBx1zone.tfvars' }} # // Default to use an 8gb profile
4857
TF_VAR_BUILD_ID: ${{ github.run_id }}
4958
TF_VAR_ENVIRONMENT: ci
@@ -59,7 +68,7 @@ jobs:
5968
with:
6069
go-version-file: 'go.mod'
6170

62-
- uses: rlespinasse/github-slug-action@797d68864753cbceedc271349d402da4590e6302
71+
- uses: rlespinasse/github-slug-action@aba9f8db6ef36e0733227a62673d6592b1f430ea
6372

6473
- name: Set up env
6574
run: |
@@ -90,7 +99,7 @@ jobs:
9099
with:
91100
role-duration-seconds: 18000 # 5 hours
92101

93-
- uses: google-github-actions/get-secretmanager-secrets@95a0b09b8348ef3d02c68c6ba5662a037e78d713 # v2.1.4
102+
- uses: google-github-actions/get-secretmanager-secrets@e5bb06c2ca53b244f978d33348d18317a7f263ce # v2.2.2
94103
with:
95104
export_to_environment: true
96105
secrets: |-
@@ -101,28 +110,44 @@ jobs:
101110
terraform_version: 1.3.7
102111
terraform_wrapper: false
103112

113+
- name: Init terraform module
114+
id: init
115+
run: make init
116+
104117
- name: Build apmbench
105118
run: make apmbench $SSH_KEY terraform.tfvars
106119

120+
- name: Build APM Server and Moxy
121+
if: ${{ env.RUN_STANDALONE == 'true' }}
122+
run: |
123+
make apm-server
124+
make moxy
125+
107126
- name: Override docker committed version
108-
if: ${{ ! inputs.runOnStable }}
127+
if: ${{ ! inputs.runOnStable && env.RUN_STANDALONE == 'false' }}
109128
run: make docker-override-committed-version
110129

111130
- name: Spin up benchmark environment
112131
id: deploy
113132
run: |
114-
make init apply
133+
make apply
115134
admin_console_url=$(terraform output -raw admin_console_url)
116135
echo "admin_console_url=$admin_console_url" >> "$GITHUB_OUTPUT"
117136
echo "-> infra setup done"
118-
119137
- name: Run benchmarks autotuned
120138
if: ${{ inputs.benchmarkAgents == '' }}
121-
run: make run-benchmark-autotuned index-benchmark-results
139+
run: make run-benchmark-autotuned
122140

123141
- name: Run benchmarks self tuned
124142
if: ${{ inputs.benchmarkAgents != '' }}
125-
run: make run-benchmark index-benchmark-results
143+
run: make run-benchmark
144+
145+
- name: Cat standalone server logs
146+
if: ${{ env.RUN_STANDALONE == 'true' && failure() }}
147+
run: make cat-apm-server-logs
148+
149+
- name: Index benchmarks result
150+
run: make index-benchmark-results
126151

127152
- name: Download PNG
128153
run: >-
@@ -150,15 +175,76 @@ jobs:
150175
151176
- name: Upload benchmark result
152177
uses: actions/upload-artifact@v4
153-
if: always()
154178
with:
155179
name: benchmark-result
156180
path: ${{ env.WORKING_DIRECTORY }}/${{ env.BENCHMARK_RESULT }}
157181
if-no-files-found: error
158182

183+
# The next section injects CPU profile collected by apmbench into the build.
184+
# By copying the profile, uploading it to the artifacts and pushing it
185+
# via a PR to update default.pgo.
186+
187+
- name: Copy CPU profile
188+
run: make cp-cpuprof
189+
190+
- name: Upload CPU profile
191+
uses: actions/upload-artifact@v4
192+
with:
193+
name: cpu-profile
194+
path: ${{ env.WORKING_DIRECTORY }}/${{ env.BENCHMARK_CPU_OUT }}
195+
if-no-files-found: error
196+
197+
- name: Get token
198+
id: get_token
199+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
200+
with:
201+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
202+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
203+
permissions: >-
204+
{
205+
"contents": "write",
206+
"pull_requests": "write"
207+
}
208+
209+
# Required to use a service account, otherwise PRs created by
210+
# GitHub bot won't trigger any CI builds.
211+
# See https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081
212+
- name: Configure git user
213+
uses: elastic/oblt-actions/git/setup@v1
214+
with:
215+
github-token: ${{ steps.get_token.outputs.token }}
216+
217+
- name: Import GPG key
218+
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
219+
with:
220+
gpg_private_key: ${{ secrets.APM_SERVER_RELEASE_GPG_PRIVATE_KEY }}
221+
passphrase: ${{ secrets.APM_SERVER_RELEASE_PASSPHRASE }}
222+
git_user_signingkey: true
223+
git_commit_gpgsign: true
224+
225+
- name: Open PGO PR
226+
if: ${{ env.RUN_STANDALONE == 'true' }}
227+
run: ${{ github.workspace }}/.ci/scripts/push-pgo-pr.sh
228+
env:
229+
WORKSPACE_PATH: ${{ github.workspace }}
230+
PROFILE_PATH: ${{ env.WORKING_DIRECTORY }}/${{ env.BENCHMARK_CPU_OUT }}
231+
GITHUB_TOKEN: ${{ steps.get_token.outputs.token }}
232+
WORKFLOW: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}
233+
234+
# Secrets are rotated daily, if the benchmarks run between the rotation window, then
235+
# there is a high chance things will stop working
236+
# This is trying to reduce the chances of that happening.
237+
# See https://github.com/elastic/observability-test-environments/actions/workflows/cluster-rotate-api-keys.yml
238+
- uses: google-github-actions/get-secretmanager-secrets@e5bb06c2ca53b244f978d33348d18317a7f263ce # v2.2.2
239+
if: always()
240+
with:
241+
export_to_environment: true
242+
secrets: |-
243+
EC_API_KEY:elastic-observability/elastic-cloud-observability-team-pro-api-key
244+
159245
- name: Tear down benchmark environment
160246
if: always()
161-
run: make destroy
247+
run: make init destroy
162248

163249
# Notify failure to Slack only on schedule (nightly run)
164250
- if: failure() && github.event_name == 'schedule'
@@ -170,13 +256,14 @@ jobs:
170256

171257
# Notify result to Slack only on schedule (nightly run)
172258
- if: github.event_name == 'schedule'
173-
uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
174-
env:
175-
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
259+
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
176260
with:
177-
channel-id: "#apm-server"
261+
method: chat.postMessage
262+
token: ${{ secrets.SLACK_BOT_TOKEN }}
178263
payload: |
179264
{
265+
"channel": "#apm-server",
266+
"text": "${{ github.event_name == 'schedule' && 'Nightly' || '' }} APM Server benchmarks succesfully executed!",
180267
"blocks": [
181268
{
182269
"type": "section",

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
- uses: actions/checkout@v4
122122
- name: Get changed files
123123
id: changed-files
124-
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45.0.2
124+
uses: tj-actions/changed-files@4edd678ac3f81e2dc578756871e4d00c19191daf # v45.0.4
125125
with:
126126
files: .go-version
127127

.github/workflows/run-minor-release.yml

+16-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919
env:
2020
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
2121
SLACK_CHANNEL: "#apm-server"
22-
GH_TOKEN: ${{ secrets.APM_SERVER_RELEASE_TOKEN }}
2322

2423
jobs:
2524
prepare:
@@ -58,6 +57,18 @@ jobs:
5857
The `${{ github.repository }}@${{ env.RELEASE_BRANCH }}` branch will be created Today.
5958
thread-timestamp: ${{ needs.prepare.outputs.slack-thread || '' }}
6059

60+
- name: Get token
61+
id: get_token
62+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
63+
with:
64+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
65+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
66+
permissions: >-
67+
{
68+
"contents": "write",
69+
"pull_requests": "write"
70+
}
71+
6172
- uses: actions/checkout@v4
6273
with:
6374
# 0 indicates all history for all branches and tags.
@@ -69,17 +80,19 @@ jobs:
6980
- name: Configure git user
7081
uses: elastic/oblt-actions/git/setup@v1
7182
with:
72-
github-token: ${{ env.GH_TOKEN }}
83+
github-token: ${{ steps.get_token.outputs.token }}
7384

7485
- name: Import GPG key
75-
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
86+
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
7687
with:
7788
gpg_private_key: ${{ secrets.APM_SERVER_RELEASE_GPG_PRIVATE_KEY }}
7889
passphrase: ${{ secrets.APM_SERVER_RELEASE_PASSPHRASE }}
7990
git_user_signingkey: true
8091
git_commit_gpgsign: true
8192

8293
- run: make minor-release
94+
env:
95+
GH_TOKEN: ${{ steps.get_token.outputs.token }}
8396

8497
- if: success()
8598
uses: elastic/oblt-actions/slack/[email protected]

.github/workflows/run-patch-release.yml

+16-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919
env:
2020
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
2121
SLACK_CHANNEL: "#apm-server"
22-
GH_TOKEN: ${{ secrets.APM_SERVER_RELEASE_TOKEN }}
2322

2423
jobs:
2524
prepare:
@@ -56,23 +55,37 @@ jobs:
5655
# Use the makefile in the given release branch.
5756
ref: ${{ env.RELEASE_BRANCH }}
5857

58+
- name: Get token
59+
id: get_token
60+
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
61+
with:
62+
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }}
63+
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }}
64+
permissions: >-
65+
{
66+
"contents": "write",
67+
"pull_requests": "write"
68+
}
69+
5970
# Required to use a service account, otherwise PRs created by
6071
# GitHub bot won't trigger any CI builds.
6172
# See https://github.com/peter-evans/create-pull-request/issues/48#issuecomment-537478081
6273
- name: Configure git user
6374
uses: elastic/oblt-actions/git/setup@v1
6475
with:
65-
github-token: ${{ env.GH_TOKEN }}
76+
github-token: ${{ steps.get_token.outputs.token }}
6677

6778
- name: Import GPG key
68-
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
79+
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
6980
with:
7081
gpg_private_key: ${{ secrets.APM_SERVER_RELEASE_GPG_PRIVATE_KEY }}
7182
passphrase: ${{ secrets.APM_SERVER_RELEASE_PASSPHRASE }}
7283
git_user_signingkey: true
7384
git_commit_gpgsign: true
7485

7586
- run: make patch-release
87+
env:
88+
GH_TOKEN: ${{ steps.get_token.outputs.token }}
7689

7790
- if: success()
7891
uses: elastic/oblt-actions/slack/send@v1

0 commit comments

Comments
 (0)