From f825e8356e8445ac2e04b599b51ad4a6b8964e34 Mon Sep 17 00:00:00 2001 From: Michael 'Flimmy' Flemming Date: Mon, 12 Jan 2026 15:55:51 +0100 Subject: [PATCH 1/4] add pipeline to autogenerate a docs pr for env changes --- .woodpecker.star | 51 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/.woodpecker.star b/.woodpecker.star index 92c2ee16ec..70b7df0f46 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -576,7 +576,7 @@ def main(ctx): ), ) - pipelines = test_pipelines + build_release_pipelines + notifyMatrix(ctx) + pipelines = test_pipelines + build_release_pipelines + gen_docs_pr(ctx) + notifyMatrix(ctx) pipelineSanityChecks(pipelines) return savePipelineNumber(ctx) + pipelines @@ -2213,6 +2213,55 @@ def makeGoGenerate(module): }, ] +def gen_docs_pr(ctx): + return [{ + "name": "gen-docs-pr", + "skip_clone": True, + "workspace": { + "base": "/woodpecker", + "path": "docs_gen_pr", + }, + "steps": [ + # { + # "name": "clone", + # "image": "woodpeckerci/plugin-git", + # "settings": { + # "remote": "https://github.com/opencloud-eu/markdown-docs-generator.git", + # "path": "/docs_gen_pr", + # }, + # }, + { + "name": "make-docs-pr", + "image": "quay.io/opencloudeu/golang-ci", + "environment": { + "GH_TOKEN": { + "from_secret": "github_token", + }, + }, + "commands": [ + "gh auth status", + "gh repo clone opencloud-eu/markdown-docs-generator /woodpecker/docs_gen_pr" + #"make git-clone", + #"make all", + #"gh auth status", + #"make create-docs-pullrequest", + ] + }, + ], + "when": [ + { + "event": "push", + "branch": "main", + "path": "services/*/pkg/config/**/*.go", + }, + { + "event": "push", + "branch": "add_docs_pr_gen_pipeline", + "path": ".woodpecker.star", + }, + ], + }] + def notifyMatrix(ctx): result = [{ "name": "chat-notifications", From 1b4b99d729b04e49a7602cc9eee20191b3f9adec Mon Sep 17 00:00:00 2001 From: Michael 'Flimmy' Flemming Date: Tue, 13 Jan 2026 11:35:23 +0100 Subject: [PATCH 2/4] add actual pr commands --- .woodpecker.star | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index 70b7df0f46..d0cc293dd8 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -2222,14 +2222,6 @@ def gen_docs_pr(ctx): "path": "docs_gen_pr", }, "steps": [ - # { - # "name": "clone", - # "image": "woodpeckerci/plugin-git", - # "settings": { - # "remote": "https://github.com/opencloud-eu/markdown-docs-generator.git", - # "path": "/docs_gen_pr", - # }, - # }, { "name": "make-docs-pr", "image": "quay.io/opencloudeu/golang-ci", @@ -2240,11 +2232,10 @@ def gen_docs_pr(ctx): }, "commands": [ "gh auth status", - "gh repo clone opencloud-eu/markdown-docs-generator /woodpecker/docs_gen_pr" - #"make git-clone", - #"make all", - #"gh auth status", - #"make create-docs-pullrequest", + "gh repo clone opencloud-eu/markdown-docs-generator /woodpecker/docs_gen_pr", + "make git-clone", + "make all", + "make create-docs-pullrequest", ] }, ], From 385cb02c9f302b2c1223644b7fb9f35bdb81f541 Mon Sep 17 00:00:00 2001 From: Michael 'Flimmy' Flemming Date: Tue, 13 Jan 2026 11:52:58 +0100 Subject: [PATCH 3/4] set auth for git push --- .woodpecker.star | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index d0cc293dd8..f3c0262034 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -2225,17 +2225,29 @@ def gen_docs_pr(ctx): { "name": "make-docs-pr", "image": "quay.io/opencloudeu/golang-ci", + "pull": True, "environment": { "GH_TOKEN": { "from_secret": "github_token", }, + "CI_SSH_KEY": { + "from_secret": "markdown-docs-generator-push-key", + }, + "CI_SSH_KEY_DOCS": { + "from_secret": "gh-docs-push-key", + }, + "GIT_SSH_COMMAND": "ssh -o StrictHostKeyChecking=no -i /root/id_rsa" }, "commands": [ - "gh auth status", - "gh repo clone opencloud-eu/markdown-docs-generator /woodpecker/docs_gen_pr", + 'echo "$${CI_SSH_KEY}" > /root/id_rsa && chmod 600 /root/id_rsa', + 'git config --global user.email "devops@opencloud.eu"', + 'git config --global user.name "openclouders"', + "git clone git@github.com:opencloud-eu/markdown-docs-generator.git /woodpecker/docs_gen_pr", + 'echo "$${CI_SSH_KEY_DOCS}" > /root/id_rsa && chmod 600 /root/id_rsa', "make git-clone", "make all", "make create-docs-pullrequest", + "echo done", ] }, ], From 9a5b5a7af6600f1ad946018c1e3d8caf71a7f280 Mon Sep 17 00:00:00 2001 From: Michael 'Flimmy' Flemming Date: Wed, 14 Jan 2026 16:12:04 +0100 Subject: [PATCH 4/4] add branch switching logic --- .woodpecker.star | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/.woodpecker.star b/.woodpecker.star index f3c0262034..faa4a6423a 100644 --- a/.woodpecker.star +++ b/.woodpecker.star @@ -576,7 +576,7 @@ def main(ctx): ), ) - pipelines = test_pipelines + build_release_pipelines + gen_docs_pr(ctx) + notifyMatrix(ctx) + pipelines = test_pipelines + build_release_pipelines + genDocsPr(ctx) + notifyMatrix(ctx) pipelineSanityChecks(pipelines) return savePipelineNumber(ctx) + pipelines @@ -2213,7 +2213,7 @@ def makeGoGenerate(module): }, ] -def gen_docs_pr(ctx): +def genDocsPr(ctx): return [{ "name": "gen-docs-pr", "skip_clone": True, @@ -2236,9 +2236,12 @@ def gen_docs_pr(ctx): "CI_SSH_KEY_DOCS": { "from_secret": "gh-docs-push-key", }, - "GIT_SSH_COMMAND": "ssh -o StrictHostKeyChecking=no -i /root/id_rsa" + "GIT_SSH_COMMAND": "ssh -o StrictHostKeyChecking=no -i /root/id_rsa", + "OC_GIT_BRANCH": "${CI_COMMIT_BRANCH}", + "MY_TARGET_BRANCH": "${CI_COMMIT_BRANCH}", }, "commands": [ + 'export DOC_GIT_TARGET_FOLDER="$$(if [ \"$$MY_TARGET_BRANCH\" = \"main\" ]; then echo \"tmpdocs/docs/dev/_static/env-vars/\"; else echo \"tmpdocs/versioned_docs/version-$${MY_TARGET_BRANCH}/dev/_static/env-vars/\"; fi)"', 'echo "$${CI_SSH_KEY}" > /root/id_rsa && chmod 600 /root/id_rsa', 'git config --global user.email "devops@opencloud.eu"', 'git config --global user.name "openclouders"', @@ -2247,20 +2250,19 @@ def gen_docs_pr(ctx): "make git-clone", "make all", "make create-docs-pullrequest", - "echo done", ] }, ], "when": [ { "event": "push", - "branch": "main", "path": "services/*/pkg/config/**/*.go", + "branch": "[main, stable-*]", }, { - "event": "push", - "branch": "add_docs_pr_gen_pipeline", - "path": ".woodpecker.star", + "event": "cron", + "branch": "[main]", + "cron": "nightly (@daily)", }, ], }]