Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .ci/updatecli/updatecli-bump-vm-images.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# update-cli configuration for automated VM image version bumping
---
name: Bump vm-images to latest version
pipelineid: 'updatecli-update-vm-images-{{ requiredEnv "BRANCH_NAME" }}'

scms:
githubConfig:
Expand All @@ -12,7 +13,7 @@ scms:
repository: '{{ .scm.repository }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
commitusingapi: true
branch: '{{ .scm.branch }}'
branch: '{{ requiredEnv "BRANCH_NAME" }}'
force: false

actions:
Expand All @@ -24,9 +25,9 @@ actions:
automerge: false
labels:
- dependencies
- backport-active-all
- backport-skip
- skip-changelog
title: '[Automation] Bump VM Image version to {{ source "latestVersion" }}'
title: '[{{ requiredEnv "BRANCH_NAME" }}][Automation] Bump VM Image version to {{ source "latestVersion" }}'

sources:
latestVersion:
Expand All @@ -44,6 +45,8 @@ conditions:
spec:
command: 'grep -q -v {{ source "latestVersion" }} .buildkite/pipeline.yml #'

# NOTE: if you add a new target file, please update the .mergify.yml file
# to include the new file for the approval and automatic merge
targets:
update-buildkite-pipeline:
name: "Update .buildkite/pipeline.yml"
Expand Down
48 changes: 27 additions & 21 deletions .github/workflows/bump-vm-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ name: bump-vm-images
on:
workflow_dispatch:
schedule:
- cron: "0 10 * * 0"
# Since the CI Agent images are produced weekly on Saturday at 0am UTC
# and we can only bump the version after the images are available
# let's try on Saturday at 12:00 UTC.
- cron: "0 12 * * 6"

permissions:
contents: read
Expand All @@ -13,11 +16,29 @@ env:
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

jobs:
filter:
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
matrix: ${{ steps.generator.outputs.matrix }}
permissions:
contents: read
steps:
- id: generator
uses: elastic/oblt-actions/elastic/active-branches@v1
with:
filter-branches: true

bump:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
needs:
- filter
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.filter.outputs.matrix) }}
steps:
- uses: actions/checkout@v4

Expand All @@ -26,26 +47,11 @@ jobs:
command: apply --config .ci/updatecli/updatecli-bump-vm-images.yml --values .ci/updatecli/values.d/scm.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: ${{ matrix.branch }}

- if: ${{ failure() }}
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
uses: elastic/oblt-actions/slack/send@v1
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
{
"channel": "#ingest-notifications",
"text": "${{ env.SLACK_MESSAGE }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.SLACK_MESSAGE }}"
}
}
]
}
env:
#SLACK_MESSAGE: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, `@agent-team` please look what's going on <${{ env.JOB_URL }}|here>"
SLACK_MESSAGE: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`"
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#ingest-notifications"
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <${{ env.JOB_URL }}|here>"
20 changes: 20 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ queue_rules:
conditions:
- check-success=fleet-ci/pr-merge
pull_request_rules:
- name: automatic approval for updatecli pull requests with changes in .buildkite
conditions:
- author=github-actions[bot]
- check-success=buildkite/elastic-agent
- files~=^.buildkite/(pipeline.yml|bk.integration.pipeline.yml)$
- head~=^updatecli_.*
actions:
review:
type: APPROVE
message: Automatically approving mergify
- name: automatic squash and merge with success checks and the files matching the regex .buildkite is modified.
conditions:
- author=github-actions[bot]
- check-success=buildkite/elastic-agent
- files~=^.buildkite/(pipeline.yml|bk.integration.pipeline.yml)$
- head~=^updatecli_.*
- "#approved-reviews-by>=1"
actions:
queue:
name: default
- name: self-assign PRs
conditions:
- -merged
Expand Down