From 4f6c8ae262ebb083f98a1a1f257bedab74e46c6a Mon Sep 17 00:00:00 2001 From: Julien Lind Date: Wed, 11 Oct 2023 07:41:25 +0200 Subject: [PATCH 1/2] Create bump-golang.yml --- .ci/bump-golang.yml | 110 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .ci/bump-golang.yml diff --git a/.ci/bump-golang.yml b/.ci/bump-golang.yml new file mode 100644 index 000000000..412d46aeb --- /dev/null +++ b/.ci/bump-golang.yml @@ -0,0 +1,110 @@ +--- +name: Bump golang-version to latest version + +scms: + githubConfig: + kind: github + spec: + user: '{{ requiredEnv "GIT_USER" }}' + email: '{{ requiredEnv "GIT_EMAIL" }}' + owner: elastic + repository: fleet-server + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + branch: main + +actions: + fleet-server: + kind: github/pullrequest + scmid: githubConfig + sourceid: latestGoVersion + spec: + automerge: false + labels: + - dependencies + - backport-skip + title: '[Automation] Bump Golang version to {{ source "latestGoVersion" }}' + +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-gomod: + name: "Update go.mod" + sourceid: gomod + scmid: githubConfig + kind: file + spec: + content: 'go {{ source "gomod" }}' + file: go.mod + matchpattern: 'go \d+.\d+' From 417a7e906267dfcf6f27827f9c68c228fa3b4927 Mon Sep 17 00:00:00 2001 From: Julien Lind Date: Wed, 11 Oct 2023 07:42:13 +0200 Subject: [PATCH 2/2] Create bump-elastic-stack-snapshot.yml --- .ci/bump-elastic-stack-snapshot.yml | 45 +++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .ci/bump-elastic-stack-snapshot.yml diff --git a/.ci/bump-elastic-stack-snapshot.yml b/.ci/bump-elastic-stack-snapshot.yml new file mode 100644 index 000000000..3649bfb44 --- /dev/null +++ b/.ci/bump-elastic-stack-snapshot.yml @@ -0,0 +1,45 @@ +--- +name: Bump elastic-stack to latest snapshot version +pipelineid: 'bump-elastic-stack-snapshot-{{ requiredEnv "BRANCH" }}' + +actions: + default: + title: '[updatecli] update elastic stack version for testing {{ source "latestVersion" }}-SNAPSHOT' + kind: github/pullrequest + spec: + labels: + - automation + - dependency + - backport-skip + scmid: default + +scms: + default: + kind: github + spec: + user: '{{ requiredEnv "GIT_USER" }}' + email: '{{ requiredEnv "GIT_EMAIL" }}' + owner: elastic + repository: fleet-server + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + username: '{{ requiredEnv "GIT_USER" }}' + branch: '{{ requiredEnv "BRANCH" }}' + +sources: + latestVersion: + name: Get latest snapshot build + kind: json + spec: + file: https://storage.googleapis.com/artifacts-api/snapshots/{{ requiredEnv "BRANCH" }}.json + key: .build_id + +targets: + update-snapshot: + name: "Update snapshot.yml" + kind: file + sourceid: latestVersion + scmid: default + spec: + file: dev-tools/integration/.env + matchpattern: '(ELASTICSEARCH_VERSION)=\d+.\d+.\d+-.*-SNAPSHOT' + replacepattern: '$1={{ source "latestVersion" }}-SNAPSHOT'