This repository has been archived by the owner on Dec 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Auto update shkeptnspecversion on release of new keptn/spec ve…
…rsion (#4404)
- Loading branch information
Showing
9 changed files
with
101 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Auto Update - Spec | ||
on: | ||
repository_dispatch: | ||
types: [spec-update] | ||
defaults: | ||
run: | ||
shell: bash | ||
env: | ||
KEPTN_BOT_USER: "keptn-bot <86361500+keptn-bot@users.noreply.github.com>" | ||
jobs: | ||
update-spec: | ||
env: | ||
SPEC_REF: ${{ github.event.client_payload.ref }} | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract spec tag | ||
run: echo "SPEC_TAG=${SPEC_REF#refs/tags/}" >> $GITHUB_ENV | ||
|
||
- name: Update keptn/spec | ||
env: | ||
SPEC_TAG: ${{ env.SPEC_TAG }} | ||
run: | | ||
echo "shkeptnspecversion: '$SPEC_TAG'" > ./config/config.yaml | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v3 | ||
with: | ||
token: ${{ secrets.KEPTN_BOT_TOKEN }} | ||
commit-message: "Update keptn/spec to release ${{ env.SPEC_TAG }}" | ||
committer: ${{ env.KEPTN_BOT_USER }} | ||
author: ${{ env.KEPTN_BOT_USER }} | ||
signoff: true | ||
branch: patch/update-keptn-spec-${{ env.SPEC_TAG }} | ||
delete-branch: true | ||
base: master | ||
labels: "dependencies" | ||
title: "Update keptn/spec to release ${{ env.SPEC_TAG }}" | ||
body: | | ||
**This is an automated PR!** | ||
Update to the keptn/spec | ||
New version: ${{ env.SPEC_TAG }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package config | ||
|
||
import ( | ||
// allow to load config from file | ||
_ "embed" | ||
"gopkg.in/yaml.v3" | ||
"sync" | ||
) | ||
|
||
//go:embed config.yaml | ||
var yamlConfig []byte | ||
var cfg KeptnGoUtilsConfig | ||
|
||
var doOnce = sync.Once{} | ||
|
||
// KeptnGoUtilsConfig contains config for the keptn go-utils | ||
type KeptnGoUtilsConfig struct { | ||
ShKeptnSpecVersion string `yaml:"shkeptnspecversion"` | ||
} | ||
|
||
// GetKeptnGoUtilsConfig take the config.yaml file and reads it into the KeptnGoUtilsConfig struct | ||
func GetKeptnGoUtilsConfig() KeptnGoUtilsConfig { | ||
doOnce.Do(func() { | ||
err := yaml.Unmarshal(yamlConfig, &cfg) | ||
if err != nil { | ||
cfg = KeptnGoUtilsConfig{} | ||
} | ||
}) | ||
return cfg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shkeptnspecversion: "0.2.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package config | ||
|
||
import ( | ||
"github.com/stretchr/testify/require" | ||
"testing" | ||
) | ||
|
||
func TestGetKeptnGoUtilsConfig(t *testing.T) { | ||
got := GetKeptnGoUtilsConfig() | ||
require.NotEmpty(t, got.ShKeptnSpecVersion) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters