Skip to content

Commit

Permalink
updatecli: use updatecli policies (#13934)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3351902)

# Conflicts:
#	.github/workflows/bump-golang.yml
  • Loading branch information
v1v authored and mergify[bot] committed Aug 28, 2024
1 parent fdb0df8 commit 1b00eec
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ scms:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: elastic
repository: apm-server
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
branch: '{{ requiredEnv "BRANCH" }}'
commitusingapi: true
Expand Down
5 changes: 3 additions & 2 deletions .ci/bump-golang.yml → .ci/updatecli/bump-golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ scms:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: elastic
repository: apm-server
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
branch: main
commitusingapi: true
Expand Down
5 changes: 3 additions & 2 deletions .ci/update-beats.yml → .ci/updatecli/update-beats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ scms:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: elastic
repository: apm-server
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
branch: '{{ requiredEnv "BRANCH_NAME" }}'
commitusingapi: true
Expand Down
2 changes: 2 additions & 0 deletions .ci/updatecli/values.d/ironbank.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config:
- path: packaging/ironbank
14 changes: 14 additions & 0 deletions .ci/updatecli/values.d/scm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
scm:
enabled: true
owner: elastic
repository: apm-server
branch: main
# begin updatecli-compose policy values
user: obltmachine
email: [email protected]
commitusingapi: true
# end updatecli-compose policy values

# This will be moved to the scm section in the future and use
# commitusingapi instead.
signedcommit: true
3 changes: 3 additions & 0 deletions .ci/updatecli/values.d/updatecli-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spec:
files:
- "updatecli-compose.yaml"
6 changes: 3 additions & 3 deletions .github/workflows/bump-elastic-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ jobs:
with:
ref: ${{ matrix.branch }}

- uses: elastic/oblt-actions/updatecli/run@v1.9.1
- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental apply --config .ci/bump-elastic-stack-snapshot.yml
command: --experimental apply --config .ci/updatecli/bump-elastic-stack-snapshot.yml --values .ci/updatecli/values.d/scm.yml
env:
BRANCH: ${{ matrix.branch }}
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

- if: ${{ failure() }}
uses: elastic/oblt-actions/slack/send@v1.9.1
uses: elastic/oblt-actions/slack/send@v1
with:
channel-id: '#apm-server'
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
Expand Down
33 changes: 31 additions & 2 deletions .github/workflows/bump-golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,43 @@ jobs:

- uses: actions/checkout@v4

- uses: elastic/oblt-actions/updatecli/run@v1.9.1
- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental apply --config .ci/bump-golang.yml
command: --experimental apply --config .ci/updatecli/bump-golang.yml --values .ci/updatecli/values.d/scm.yml
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

<<<<<<< HEAD
- if: ${{ failure() }}
uses: elastic/oblt-actions/slack/[email protected]
=======
bump-7:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: '7.17'

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental apply --config .ci/updatecli/bump-golang.yml --values .ci/updatecli/values.d/scm.yml
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}
GITHUB_BRANCH: '7.17'
GITHUB_LABELS: 'backport-skip'

notify:
runs-on: ubuntu-latest
needs: [bump, bump-7]
if: always()
steps:
- id: check
uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
with:
needs: ${{ toJSON(needs) }}
- if: ${{ steps.check.outputs.isSuccess == 'false' }}
uses: elastic/oblt-actions/slack/send@v1
>>>>>>> 3351902f8 (updatecli: use updatecli policies (#13934))
with:
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
channel-id: "#apm-server"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/update-beats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ jobs:
with:
go-version-file: go.mod

- uses: elastic/oblt-actions/updatecli/run@v1.9.1
- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental apply --config .ci/update-beats.yml
command: --experimental apply --config .ci/updatecli/update-beats.yml --values .ci/updatecli/values.d/scm.yml
env:
BRANCH_NAME: ${{ matrix.branch }}
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

- if: ${{ failure() }}
uses: elastic/oblt-actions/slack/send@v1.9.1
uses: elastic/oblt-actions/slack/send@v1
with:
channel-id: '#apm-server'
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/update-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: update-compose

on:
workflow_dispatch:
schedule:
- cron: '0 6 * * *'

permissions:
contents: read

jobs:
compose:
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@v4

- uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental compose diff
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

- uses: elastic/oblt-actions/updatecli/run@v1
with:
command: --experimental compose apply
env:
GITHUB_TOKEN: ${{ secrets.UPDATECLI_GH_TOKEN }}

- if: ${{ failure() }}
uses: elastic/oblt-actions/slack/send@v1
with:
channel-id: '#apm-server'
message: ":traffic_cone: updatecli failed for `${{ github.repository }}@${{ github.ref_name }}`, @robots-ci please look what's going on <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|here>"
bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
14 changes: 14 additions & 0 deletions updatecli-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Config file for `updatecli compose ...`.
# https://www.updatecli.io/docs/core/compose/
policies:
- name: Handle ironbank bumps
policy: ghcr.io/elastic/oblt-updatecli-policies/ironbank/templates:0.0.2@sha256:327ee971e3a974edc943f7f628145a47b202972f48e45c2054fddcd29f96a50a
values:
- .ci/updatecli/values.d/scm.yml
- .ci/updatecli/values.d/ironbank.yml

- name: Update Updatecli policies
policy: ghcr.io/updatecli/policies/autodiscovery/updatecli:0.4.0@sha256:254367f5b1454fd6032b88b314450cd3b6d5e8d5b6c953eb242a6464105eb869
values:
- .ci/updatecli/values.d/scm.yml
- .ci/updatecli/values.d/updatecli-compose.yml

0 comments on commit 1b00eec

Please sign in to comment.