add renovate config (#2)

This commit is contained in:
Robert Kaussow 2022-11-02 21:58:50 +01:00 committed by GitHub
parent 0d7c9d6777
commit ba90d434d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 128 deletions

View File

@ -1,126 +0,0 @@
def main(ctx):
before = testing(ctx)
stages = []
after = release(ctx) + notification(ctx)
for b in before:
for s in stages:
s["depends_on"].append(b["name"])
for s in stages:
for a in after:
a["depends_on"].append(s["name"])
return before + stages + after
def testing(ctx):
return [{
"kind": "pipeline",
"type": "docker",
"name": "testing",
"platform": {
"os": "linux",
"arch": "amd64",
},
"steps": [
{
"name": "lint",
"image": "koalaman/shellcheck-alpine:stable",
"commands": [
"shellcheck ./retry",
],
},
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/**",
"refs/pull/**",
],
},
}]
def release(ctx):
return [{
"kind": "pipeline",
"type": "docker",
"name": "release",
"steps": [
{
"name": "changelog",
"image": "thegeeklab/git-chglog",
"commands": [
"git fetch -tq",
"git-chglog --no-color --no-emoji %s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"),
"git-chglog --no-color --no-emoji -o CHANGELOG.md %s" % (ctx.build.ref.replace("refs/tags/", "") if ctx.build.event == "tag" else "--next-tag unreleased unreleased"),
]
},
{
"name": "release",
"image": "plugins/github-release",
"settings": {
"api_key": {
"from_secret": "github_token",
},
"note": "CHANGELOG.md",
"overwrite": True,
"title": ctx.build.ref.replace("refs/tags/", ""),
"files": [
"retry"
],
},
"when": {
"ref": [
"refs/tags/**",
],
},
}
],
"depends_on": [
"testing",
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/**",
"refs/pull/**",
],
},
}]
def notification(ctx):
return [{
"kind": "pipeline",
"type": "docker",
"name": "notify",
"clone": {
"disable": True,
},
"steps": [
{
"name": "notify",
"image": "plugins/slack",
"settings": {
"webhook": {
"from_secret": "private_rocketchat",
},
"channel": "builds",
},
}
],
"depends_on": [
"release",
],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/**",
],
"status": [
"success",
"failure",
],
},
}]

4
renovate.json Normal file
View File

@ -0,0 +1,4 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>thegeeklab/renovate-presets:docker"]
}

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bats
@test "retry echo should work" {
run ./retry echo u work good
run ./retry 'echo "u work good"'
[ "$output" = "u work good" ]
}
@ -10,5 +10,5 @@
run ./retry -t 1 'echo "y u no work"; false'
[ "$status" -ne 0 ]
[ "$output" = "y u no work" ]
[[ "$output" =~ "y u no work" ]]
}