Skip to content

Commit

Permalink
Create missing resources that were removed. (#3025)
Browse files Browse the repository at this point in the history
* Create bump-golang.yml

* Create bump-elastic-stack-snapshot.yml
  • Loading branch information
jlind23 authored Oct 11, 2023
1 parent 8331096 commit ef70e49
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .ci/bump-elastic-stack-snapshot.yml
Original file line number Diff line number Diff line change
@@ -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'
110 changes: 110 additions & 0 deletions .ci/bump-golang.yml
Original file line number Diff line number Diff line change
@@ -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+'

0 comments on commit ef70e49

Please sign in to comment.