Skip to content

Commit

Permalink
updatecli: verify commits for golang and beats (#13107)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8182fb1)

# Conflicts:
#	.ci/bump-golang.yml
#	.github/workflows/bump-golang.yml
#	.github/workflows/update-beats.yml
  • Loading branch information
v1v authored and mergify[bot] committed May 8, 2024
1 parent 5b885bc commit 4bd431d
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 4 deletions.
111 changes: 111 additions & 0 deletions .ci/bump-golang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
name: Bump golang-version to latest version
pipelineid: 'updatecli-bump-golang'

actions:
default:
title: '[updatecli] Bump Golang version to {{ source "latestGoVersion" }}'
kind: github/pullrequest
scmid: default
spec:
labels:
- automation
- backport-skip
- dependencies
description: |-
### What
Bump go release version with the latest release.
### Further details
See [changelog](https://github.com/golang/go/issues?q=milestone%3AGo{{ source "latestGoVersion" }}+label%3ACherryPickApproved) for {{ source "latestGoVersion" }}
scms:
default:
kind: github
spec:
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: elastic
repository: apm-server
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
branch: main
commitusingapi: true

sources:
minor:
name: Get minor version in .go-version
kind: shell
transformers:
- findsubmatch:
pattern: '^\d+.(\d+).\d+$'
captureindex: 1
spec:
command: cat .go-version

latestGoVersion:
name: Get Latest Go Release
kind: githubrelease
dependson:
- minor
transformers:
- trimprefix: go
spec:
owner: golang
repository: go
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
versionfilter:
kind: regex
pattern: go1\.{{ source "minor" }}\.\d*$

gomod:
dependson:
- latestGoVersion
name: Get version in go.mod format
kind: shell
transformers:
- findsubmatch:
pattern: '^(\d+.\d+).\d*'
captureindex: 1
spec:
command: echo {{ source "latestGoVersion" }}

conditions:
dockerTag:
name: Is docker image golang:{{ source "latestGoVersion" }} published
kind: dockerimage
spec:
image: golang
tag: '{{ source "latestGoVersion" }}'
sourceid: latestGoVersion

goDefaultVersion-check:
name: Check if defined golang version differs
kind: shell
sourceid: latestGoVersion
spec:
command: 'grep -v -q {{ source "latestGoVersion" }} .go-version #'

targets:
update-go-version:
name: 'Update .go-version with Golang version {{ source "latestGoVersion" }}'
sourceid: latestGoVersion
scmid: default
kind: file
spec:
content: '{{ source "latestGoVersion" }}'
file: .go-version
matchpattern: '\d+.\d+.\d+'
update-gomod:
name: 'Update go.mod files with {{ source "gomod" }}'
sourceid: gomod
scmid: default
kind: file
spec:
content: 'go {{ source "gomod" }}'
files:
- go.mod
- cmd/intake-receiver/go.mod
- internal/glog/go.mod
- systemtest/go.mod
- tools/go.mod
matchpattern: 'go \d+.\d+'
5 changes: 2 additions & 3 deletions .ci/update-beats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ scms:
default:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
owner: elastic
repository: apm-server
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: '{{ requiredEnv "BRANCH_NAME" }}'
commitusingapi: true

actions:
default:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/bump-elastic-stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ jobs:
command: '--experimental apply'
env:
BRANCH: ${{ matrix.branch }}
GITHUB_ACTOR: ${{ github.actor }}
24 changes: 24 additions & 0 deletions .github/workflows/bump-golang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: bump-golang

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

permissions:
contents: read

jobs:
bump:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
- uses: elastic/apm-pipeline-library/.github/actions/updatecli@current
with:
vaultUrl: ${{ secrets.VAULT_ADDR }}
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
pipeline: ./.ci/bump-golang.yml
command: '--experimental apply'
5 changes: 5 additions & 0 deletions .github/workflows/update-beats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ jobs:
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
pipeline: ./.ci/update-beats.yml
<<<<<<< HEAD
- if: always()
=======
command: '--experimental apply'
- if: failure()
>>>>>>> 8182fb130 (updatecli: verify commits for golang and beats (#13107))
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
with:
vaultUrl: ${{ secrets.VAULT_ADDR }}
Expand Down

0 comments on commit 4bd431d

Please sign in to comment.