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
File renamed without changes.
2 changes: 1 addition & 1 deletion .ci/scripts/install-go.bat → .buildkite/.ci/scripts/install-go.bat
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ IF ERRORLEVEL 1 (
IF ERRORLEVEL 1 (
exit /b 1
)
)
)
2 changes: 1 addition & 1 deletion .ci/scripts/install-go.sh → .buildkite/.ci/scripts/install-go.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ chmod +x "${GVM_CMD}"

${GVM_CMD} "${GO_VERSION}" |cut -d ' ' -f 2|tr -d '\"' > ${PROPERTIES_FILE}

eval "$("${GVM_CMD}" "${GO_VERSION}")"
eval "$("${GVM_CMD}" "${GO_VERSION}")"
19 changes: 0 additions & 19 deletions .ci/jobs/defaults.yml

This file was deleted.

43 changes: 0 additions & 43 deletions .ci/jobs/elastic-agent-mbp.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .ci/jobs/elastic-agent-schedule-daily.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .ci/jobs/folders.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .ci/schedule-daily.groovy

This file was deleted.

135 changes: 135 additions & 0 deletions .github/updatecli-bump-golang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# update-cli configuration for automated go updates
---
name: Bump golang-version to latest version

scms:
githubConfig:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: elastic
repository: elastic-agent
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: main

actions:
elastic-agent:
kind: github/pullrequest
scmid: githubConfig
sourceid: latestGoVersion
spec:
automerge: false
labels:
- dependencies
- backport-skip
title: '[Automation] Bump Golang version to {{ source "latestGoVersion" }}'
description: |
It requires the version to be bumped first in golang-crossbuild project, then a new release will be added to:
https://github.com/elastic/golang-crossbuild/releases/tag/v{{ source "latestGoVersion" }}.
Otherwise it will fail until the docker images are available.

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"
sourceid: latestGoVersion
scmid: githubConfig
kind: file
spec:
content: '{{ source "latestGoVersion" }}'
file: .go-version
matchpattern: '\d+.\d+.\d+'
update-golang.ci:
name: "Update .golangci.yml"
sourceid: latestGoVersion
scmid: githubConfig
kind: file
spec:
content: '{{ source "latestGoVersion" }}'
file: .golangci.yml
matchpattern: '\d+.\d+.\d+'
update-version.asciidoc:
name: "Update version.asciidoc"
sourceid: latestGoVersion
scmid: githubConfig
kind: file
spec:
content: ':go-version: {{ source "latestGoVersion" }}'
file: version/docs/version.asciidoc
matchpattern: ':go-version: \d+.\d+.\d+'
update-dockerfiles:
name: "Update from dockerfiles"
sourceid: latestGoVersion
scmid: githubConfig
kind: file
spec:
content: 'ARG GO_VERSION={{ source "latestGoVersion" }}'
files:
- Dockerfile
- Dockerfile.skaffold
matchpattern: 'ARG GO_VERSION=\d+.\d+.\d+'
update-gomod:
name: "Update go.mod"
sourceid: gomod
scmid: githubConfig
kind: file
spec:
content: 'go {{ source "gomod" }}'
file: go.mod
matchpattern: 'go \d+.\d+'
5 changes: 2 additions & 3 deletions .github/workflows/bump-golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: bump-golang
on:
workflow_dispatch:
schedule:
- cron: '0 20 * * 6'
- cron: "0 20 * * 6"

permissions:
contents: read
Expand All @@ -13,12 +13,11 @@ jobs:
bump:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

- 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
pipeline: ./.github/updatecli-bump-golang.yml