-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/go_modules/github.com/elastic/ela…
…stic-agent-autodiscover-0.6.11
- Loading branch information
Showing
77 changed files
with
2,038 additions
and
746 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
version_requirements=$(mage integration:updateVersions) | ||
changes=$(git status -s -uno .agent-versions.json) | ||
if [ -z "$changes" ] | ||
then | ||
echo "The versions file didn't change, skipping..." | ||
else | ||
echo "The versions file changed" | ||
open=$(gh pr list --repo "$GITHUB_REPOSITORY" --label="update-versions" --limit 1 --state open --base "$GITHUB_REF_NAME") | ||
if [ -n "$open" ] | ||
then | ||
echo "Another PR for $GITHUB_REF_NAME is in review, skipping..." | ||
exit 0 | ||
fi | ||
git diff -p | ||
git add ".agent-versions.json" | ||
|
||
nl=$'\n' # otherwise the new line character is not recognized properly | ||
commit_desc="This file is used for picking agent versions in integration tests.${nl}${nl}The file's content is based on responses from https://www.elastic.co/api/product_versions and https://snapshots.elastic.co${nl}${nl}The current update is generated based on the following requirements:${nl}${nl}\`\`\`json${nl}${version_requirements}${nl}\`\`\`" | ||
|
||
git commit -m "[$GITHUB_REF_NAME][Automation] Update .agent-versions.json" -m "$commit_desc" | ||
git push --set-upstream origin "update-agent-versions-$GITHUB_RUN_ID" | ||
gh pr create \ | ||
--base "$GITHUB_REF_NAME" \ | ||
--fill-first \ | ||
--head "update-agent-versions-$GITHUB_RUN_ID" \ | ||
--label 'Team:Elastic-Agent' \ | ||
--label 'update-versions' \ | ||
--label 'skip-changelog' \ | ||
--label 'backport-skip' \ | ||
--repo $GITHUB_REPOSITORY | ||
echo "::set-output name=pr::true" # set step output for notifications | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,21 @@ jobs: | |
update_versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup Git | ||
uses: elastic/apm-pipeline-library/.github/actions/setup-git@current | ||
|
||
- uses: elastic/apm-pipeline-library/.github/actions/github-token@current | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
# no depth limit | ||
# so, we can generate snapshot versions based on release branches | ||
fetch-depth: 0 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
|
@@ -20,41 +33,32 @@ jobs: | |
- name: Set up branch | ||
run: git checkout -b update-agent-versions-$GITHUB_RUN_ID | ||
|
||
- name: Update the agent version file | ||
- name: Install mage | ||
uses: magefile/mage-action@v3 | ||
with: | ||
version: v1.13.0 | ||
args: integration:updateVersions | ||
install-only: true | ||
|
||
- name: Check for file changes | ||
- name: Update versions file | ||
id: update | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
changes=$(git status -s -uno .agent-versions.json) | ||
if [ -z "$changes" ] | ||
then | ||
echo "The versions file didn't change, skipping..." | ||
else | ||
echo "The versions file changed" | ||
open=$(gh pr list --repo "$GITHUB_REPOSITORY" --label="update-versions" --limit 1 --state open --base "$GITHUB_REF_NAME") | ||
if [ -n "$open" ] | ||
then | ||
echo "Another PR for $GITHUB_REF_NAME is in review, skipping..." | ||
exit 0 | ||
fi | ||
git diff -p | ||
git config --global user.name 'apmmachine' | ||
git config --global user.email '[email protected]' | ||
git add ".agent-versions.json" | ||
git commit -m "[$GITHUB_REF_NAME](automation) Update .agent-versions.json" -m "This file is used for picking agent versions in integration tests. It's content is based on the reponse from https://artifacts-api.elastic.co/v1/versions/" | ||
git push --set-upstream origin "update-agent-versions-$GITHUB_RUN_ID" | ||
gh pr create \ | ||
--base "$GITHUB_REF_NAME" \ | ||
--fill-first \ | ||
--head "update-agent-versions-$GITHUB_RUN_ID" \ | ||
--label 'Team:Elastic-Agent' \ | ||
--label 'update-versions' \ | ||
--label 'skip-changelog' \ | ||
--label 'backport-skip' \ | ||
--repo $GITHUB_REPOSITORY | ||
fi | ||
GH_TOKEN: ${{ env.GITHUB_TOKEN }} | ||
run: ./.github/workflows/bump-agent-versions.sh | ||
|
||
- if: ${{ failure() }} | ||
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
message: ":traffic_cone: Elastic Agent versions file update failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
channel: "#ingest-notifications" | ||
|
||
- if: ${{ success() && steps.update.output.pr == true}} | ||
uses: elastic/apm-pipeline-library/.github/actions/slack-message@current | ||
with: | ||
url: ${{ secrets.VAULT_ADDR }} | ||
roleId: ${{ secrets.VAULT_ROLE_ID }} | ||
secretId: ${{ secrets.VAULT_SECRET_ID }} | ||
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" | ||
channel: "#ingest-notifications" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.21.8 | ||
1.21.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ARG GO_VERSION=1.21.8 | ||
ARG GO_VERSION=1.21.9 | ||
FROM circleci/golang:${GO_VERSION} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.