Skip to content

Commit

Permalink
updatecli: Re-structure pipelines, add hermit (#1503)
Browse files Browse the repository at this point in the history
- Add pipeline for hermit upgrades
- Use matrix to organize all GH actions in one workflow file
- Make naming, properties, etc consistent
- Remove goimports as we use gci instead
- Call hermit to bump the go version in bin/ as well
  • Loading branch information
orestisfl authored Nov 13, 2023
1 parent 10535b1 commit 81e0f34
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 50 deletions.
6 changes: 6 additions & 0 deletions .ci/updatecli/scripts/hermit-bump-go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -euxo pipefail

bin/hermit install "go-$1"
git status # git diff might not have output because only binaries change
File renamed without changes.
22 changes: 22 additions & 0 deletions .ci/updatecli/scripts/update-hermit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -euxo pipefail

bin/hermit upgrade \
aws-iam-authenticator \
awscli \
elastic-package \
gcloud \
gh \
golangci-lint \
jq \
just \
kind \
mage \
opa \
pre-commit \
rain \
regal \
shellcheck \
shfmt \
yq
git status # git diff might not have output because only binaries change
6 changes: 3 additions & 3 deletions .ci/updatecli/updatecli.d/update-beats.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bump beats
pipelineid: 'updatecli-update-beats-{{ .github.branch }}'
name: Update Elastic Beats go.mod Version
pipelineid: 'updatecli-beats-{{ .github.branch }}'

scms:
default:
Expand Down Expand Up @@ -65,7 +65,7 @@ targets:
scmid: default
kind: shell
spec:
command: .ci/scripts/update-beats.sh
command: .ci/updatecli/scripts/update-beats.sh
environments:
- name: PATH
- name: GOPATH
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
name: Bump golang-version to latest version
name: Update Go Version
pipelineid: 'updatecli-golang-{{ .github.branch }}'

scms:
default:
Expand All @@ -15,6 +16,7 @@ scms:

actions:
cloudbeat:
title: '[updatecli] Update Golang version to {{ source "latestGoVersion" }}'
kind: github/pullrequest
scmid: default
sourceid: latestGoVersion
Expand All @@ -25,7 +27,6 @@ actions:
- dependency
- backport-skip
- go
title: '[Automation] Bump Golang version to {{ source "latestGoVersion" }}'
description: |-
### What
Bump go release version with the latest release.
Expand Down Expand Up @@ -119,3 +120,13 @@ targets:
files:
- go.mod
matchpattern: 'go \d+.\d+'
update-hermit:
name: 'Update hermit with Golang version {{ source "latestGoVersion" }}'
sourceid: latestGoVersion
scmid: default
kind: shell
spec:
command: .ci/updatecli/scripts/hermit-bump-go.sh
environments:
- name: HOME
- name: PATH
43 changes: 43 additions & 0 deletions .ci/updatecli/updatecli.d/update-hermit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Update Hermit Dependencies
pipelineid: 'updatecli-hermit-{{ .github.branch }}'

scms:
default:
kind: github
spec:
user: '{{ requiredEnv "GIT_USER" }}'
email: '{{ requiredEnv "GIT_EMAIL" }}'
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
username: '{{ requiredEnv "GIT_USER" }}'
branch: "{{ .github.branch }}"

actions:
default:
title: '[updatecli] Update hermit dependencies'
kind: github/pullrequest
scmid: default
spec:
automerge: false
labels:
- automation
- backport-skip
- dependency
description: |-
### What
`hermit` automatic sync
Generated automatically with {{ requiredEnv "JOB_URL" }}
targets:
hermit:
name: 'Update hermit packages'
scmid: default
kind: shell
spec:
command: .ci/updatecli/scripts/update-hermit.sh
environments:
- name: PATH
- name: HOME
27 changes: 0 additions & 27 deletions .github/workflows/bump-golang.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: update-beats
---
name: Update Dependencies with Updatecli

on:
workflow_dispatch:
Expand All @@ -12,8 +13,13 @@ env:
JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

jobs:
bump:
updatecli:
name: Update ${{ matrix.pipeline-name }} dependencies
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pipeline-name: [beats, golang, hermit]
steps:
- uses: actions/checkout@v4
- name: Init Hermit
Expand All @@ -23,6 +29,6 @@ jobs:
vaultUrl: ${{ secrets.VAULT_ADDR }}
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
pipeline: ./.ci/updatecli/updatecli.d/update-beats.yml
pipeline: ./.ci/updatecli/updatecli.d/update-${{ matrix.pipeline-name }}.yml
values: ./.ci/updatecli/values.yml
notifyIfFailure: false
1 change: 0 additions & 1 deletion bin/goimports

This file was deleted.

9 changes: 0 additions & 9 deletions scripts/make/check_goimports.sh

This file was deleted.

4 changes: 0 additions & 4 deletions scripts/make/goimports.sh

This file was deleted.

1 change: 0 additions & 1 deletion tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ import (
_ "github.com/tsg/go-daemon"
_ "go.elastic.co/go-licence-detector"
_ "golang.org/x/lint/golint"
_ "golang.org/x/tools/cmd/goimports"
_ "gotest.tools/gotestsum/cmd"
)

0 comments on commit 81e0f34

Please sign in to comment.