Skip to content

Commit 1f90391

Browse files
authored
Use pre-defined Github actions, enable Slack notifications (#4522)
This should solve permission issues with triggering buildkite builds and will notify our team about failed and successful attempts to update the version file.
1 parent 3dab14d commit 1f90391

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

.github/workflows/bump-agent-versions.sh

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ else
1515
exit 0
1616
fi
1717
git diff -p
18-
git config --global user.name 'apmmachine'
19-
git config --global user.email 'apmmachine@users.noreply.github.com'
2018
git add ".agent-versions.json"
2119
git commit -m "[$GITHUB_REF_NAME](automation) Update .agent-versions.json" -m "This file is used for picking agent versions in integration tests.\n\nThe file's content is based on responses from https://www.elastic.co/api/product_versions and https://snapshots.elastic.co\n\nThe current update is generated based on the following requirements:\n\`\`\`json\n$version_requirements\n\`\`\`"
2220
git push --set-upstream origin "update-agent-versions-$GITHUB_RUN_ID"

.github/workflows/bump-agent-versions.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ jobs:
99
update_versions:
1010
runs-on: ubuntu-latest
1111
steps:
12+
- name: Setup Git
13+
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current
14+
15+
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current
16+
with:
17+
url: ${{ secrets.VAULT_ADDR }}
18+
roleId: ${{ secrets.VAULT_ROLE_ID }}
19+
secretId: ${{ secrets.VAULT_SECRET_ID }}
20+
1221
- name: Checkout
1322
uses: actions/checkout@v4
1423
with:
@@ -32,5 +41,23 @@ jobs:
3241

3342
- name: Update versions file
3443
env:
35-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
GH_TOKEN: ${{ env.GITHUB_TOKEN }}
3645
run: ./.github/workflows/bump-agent-versions.sh
46+
47+
- if: ${{ failure() }}
48+
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
49+
with:
50+
url: ${{ secrets.VAULT_ADDR }}
51+
roleId: ${{ secrets.VAULT_ROLE_ID }}
52+
secretId: ${{ secrets.VAULT_SECRET_ID }}
53+
message: ":traffic_cone: Elastic Agent versions file update failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
54+
channel: "#ingest-notifications"
55+
56+
- if: ${{ success() }}
57+
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current
58+
with:
59+
url: ${{ secrets.VAULT_ADDR }}
60+
roleId: ${{ secrets.VAULT_ROLE_ID }}
61+
secretId: ${{ secrets.VAULT_SECRET_ID }}
62+
message: "Update for Elastic Agent versions file has been created https://github.com/elastic/elastic-agent/pulls?q=is%3Aopen+is%3Apr+label%3Aupdate-versions"
63+
channel: "#ingest-notifications"

0 commit comments

Comments
 (0)