From 1a832a766703c8efb391e871cfa4b60f4340f8a7 Mon Sep 17 00:00:00 2001 From: Tom Neuber Date: Wed, 9 Oct 2024 01:18:17 +0200 Subject: [PATCH 1/5] .woodpecker/.deploy.yaml: add a random message to PR --- .woodpecker/.deploy.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml index 5f19257..b544e7f 100644 --- a/.woodpecker/.deploy.yaml +++ b/.woodpecker/.deploy.yaml @@ -48,10 +48,18 @@ steps: - branch: exclude: master event: push +- name: generate random pull request message + image: git.ar21.de/tom/push-message-randomizer:latest + pull: true + when: + - event: push - name: create pull request (prod) image: johnwalkerx/gitea-pull-request-create-plugin:latest pull: true + commands: + - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" settings: + pr_body_message: "" gitea_address: https://git.ar21.de gitea_token: from_secret: FORGEJO_API @@ -63,6 +71,8 @@ steps: pr_body: | ### ℹ Dashboard image update + $${PLUGIN_PR_BODY_MESSAGE} + ### Configuration 📅 **Schedule**: Branch creation - At any time, Automerge - At any time. @@ -79,7 +89,10 @@ steps: - name: create pull request (staging) image: johnwalkerx/gitea-pull-request-create-plugin:latest pull: true + commands: + - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" settings: + pr_body_message: "" gitea_address: https://git.ar21.de gitea_token: from_secret: FORGEJO_API @@ -91,6 +104,8 @@ steps: pr_body: | ### ℹ Dashboard image update + $${PLUGIN_PR_BODY_MESSAGE} + ### Configuration 📅 **Schedule**: Branch creation - At any time, Automerge - At any time. From 12fcfbe37afd6951f115df2af9af282d5d4dd6cc Mon Sep 17 00:00:00 2001 From: Tom Neuber Date: Wed, 9 Oct 2024 02:04:11 +0200 Subject: [PATCH 2/5] woodpecker: we need to remove "settings" and switch to "environment" because of this very important feature --- .woodpecker/.deploy.yaml | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml index b544e7f..7066e57 100644 --- a/.woodpecker/.deploy.yaml +++ b/.woodpecker/.deploy.yaml @@ -56,8 +56,8 @@ steps: - name: create pull request (prod) image: johnwalkerx/gitea-pull-request-create-plugin:latest pull: true - commands: - - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" + #commands: + # - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" settings: pr_body_message: "" gitea_address: https://git.ar21.de @@ -91,17 +91,18 @@ steps: pull: true commands: - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" - settings: - pr_body_message: "" - gitea_address: https://git.ar21.de - gitea_token: + - /gitea-pull-request-create-plugin + environment: + PLUGIN_PR_BODY_MESSAGE: "" + PLUGIN_GITEA_ADDRESS: https://git.ar21.de + PLUGIN_GITEA_TOKEN: from_secret: FORGEJO_API - owner: ${CI_REPO_OWNER} - repo: core-deployments - branch: "${CI_PIPELINE_NUMBER}_dashboard_staging" - base_branch: main - pr_title: "DASHBOARD STAGING: update image tag to ${CI_PIPELINE_NUMBER}" - pr_body: | + PLUGIN_OWNER: ${CI_REPO_OWNER} + PLUGIN_REPO: core-deployments + PLUGIN_BRANCH: "${CI_PIPELINE_NUMBER}_dashboard_staging" + PLUGIN_BASE_BRANCH: main + PLUGIN_PR_TITLE: "DASHBOARD STAGING: update image tag to ${CI_PIPELINE_NUMBER}" + PLUGIN_PR_BODY: | ### ℹ Dashboard image update $${PLUGIN_PR_BODY_MESSAGE} @@ -111,11 +112,11 @@ steps: 📅 **Schedule**: Branch creation - At any time, Automerge - At any time. 🚦 **Automerge**: Enabled. - skip_on_missing_branch: true - close_pr_if_empty: true - delete_branch_if_pr_empty: true - merge_when_checks_succeed: true - delete_branch_after_merge: true + PLUGIN_SKIP_ON_MISSING_BRANCH: true + PLUGIN_CLOSE_PR_IF_EMPTY: true + PLUGIN_DELETE_BRANCH_IF_PR_EMPTY: true + PLUGIN_MERGE_WHEN_CHECKS_SUCCEED: true + PLUGIN_DELETE_BRANCH_AFTER_MERGE: true when: - branch: exclude: master From 4a4d5d9d55540e58e600c22da9299c69df01bcee Mon Sep 17 00:00:00 2001 From: Tom Neuber Date: Wed, 9 Oct 2024 02:10:23 +0200 Subject: [PATCH 3/5] test --- .woodpecker/.deploy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml index 7066e57..fa6268e 100644 --- a/.woodpecker/.deploy.yaml +++ b/.woodpecker/.deploy.yaml @@ -90,6 +90,7 @@ steps: image: johnwalkerx/gitea-pull-request-create-plugin:latest pull: true commands: + - ls -l - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" - /gitea-pull-request-create-plugin environment: From 41ff3a3e9814ed8279e0919f12e9fbb7c5e9ec78 Mon Sep 17 00:00:00 2001 From: Tom Neuber Date: Wed, 9 Oct 2024 02:43:02 +0200 Subject: [PATCH 4/5] test 2 --- .woodpecker/.deploy.yaml | 47 +++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml index fa6268e..bc7cce6 100644 --- a/.woodpecker/.deploy.yaml +++ b/.woodpecker/.deploy.yaml @@ -1,4 +1,7 @@ skip_clone: true +variables: + - &test + PR_BODY_MESSAGE: lol steps: - name: bump tag in deployment-repo (prod) image: git.ar21.de/aaron/kustomize-ci @@ -51,6 +54,13 @@ steps: - name: generate random pull request message image: git.ar21.de/tom/push-message-randomizer:latest pull: true + environment: + <<: *test + commands: + - /entrypoint.sh + - echo "${PR_BODY_MESSAGE}" + - PR_BODY_MESSAGE="$(cat message.txt)" + - echo "${PR_BODY_MESSAGE}" when: - event: push - name: create pull request (prod) @@ -89,35 +99,32 @@ steps: - name: create pull request (staging) image: johnwalkerx/gitea-pull-request-create-plugin:latest pull: true - commands: - - ls -l - - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" - - /gitea-pull-request-create-plugin - environment: - PLUGIN_PR_BODY_MESSAGE: "" - PLUGIN_GITEA_ADDRESS: https://git.ar21.de - PLUGIN_GITEA_TOKEN: + settings: + <<: *test + gitea_address: https://git.ar21.de + gitea_token: from_secret: FORGEJO_API - PLUGIN_OWNER: ${CI_REPO_OWNER} - PLUGIN_REPO: core-deployments - PLUGIN_BRANCH: "${CI_PIPELINE_NUMBER}_dashboard_staging" - PLUGIN_BASE_BRANCH: main - PLUGIN_PR_TITLE: "DASHBOARD STAGING: update image tag to ${CI_PIPELINE_NUMBER}" - PLUGIN_PR_BODY: | + owner: ${CI_REPO_OWNER} + repo: core-deployments + branch: "${CI_PIPELINE_NUMBER}_dashboard_staging" + base_branch: main + pr_title: "DASHBOARD STAGING: update image tag to ${CI_PIPELINE_NUMBER}" + pr_body: | ### ℹ Dashboard image update - $${PLUGIN_PR_BODY_MESSAGE} + ${PLUGIN_PR_BODY_MESSAGE} + ${PR_BODY_MESSAGE} ### Configuration 📅 **Schedule**: Branch creation - At any time, Automerge - At any time. 🚦 **Automerge**: Enabled. - PLUGIN_SKIP_ON_MISSING_BRANCH: true - PLUGIN_CLOSE_PR_IF_EMPTY: true - PLUGIN_DELETE_BRANCH_IF_PR_EMPTY: true - PLUGIN_MERGE_WHEN_CHECKS_SUCCEED: true - PLUGIN_DELETE_BRANCH_AFTER_MERGE: true + skip_on_missing_branch: true + close_pr_if_empty: true + delete_branch_if_pr_empty: true + merge_when_checks_succeed: true + delete_branch_after_merge: true when: - branch: exclude: master From c8834a863243d849d8be0ae3afea2a2bc909e038 Mon Sep 17 00:00:00 2001 From: Tom Neuber Date: Wed, 9 Oct 2024 13:34:12 +0200 Subject: [PATCH 5/5] replace create-pr image with own randomizer image --- .woodpecker/.deploy.yaml | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/.woodpecker/.deploy.yaml b/.woodpecker/.deploy.yaml index bc7cce6..d4327c3 100644 --- a/.woodpecker/.deploy.yaml +++ b/.woodpecker/.deploy.yaml @@ -1,7 +1,4 @@ skip_clone: true -variables: - - &test - PR_BODY_MESSAGE: lol steps: - name: bump tag in deployment-repo (prod) image: git.ar21.de/aaron/kustomize-ci @@ -51,25 +48,10 @@ steps: - branch: exclude: master event: push -- name: generate random pull request message +- name: create pull request (prod) image: git.ar21.de/tom/push-message-randomizer:latest pull: true - environment: - <<: *test - commands: - - /entrypoint.sh - - echo "${PR_BODY_MESSAGE}" - - PR_BODY_MESSAGE="$(cat message.txt)" - - echo "${PR_BODY_MESSAGE}" - when: - - event: push -- name: create pull request (prod) - image: johnwalkerx/gitea-pull-request-create-plugin:latest - pull: true - #commands: - # - PLUGIN_PR_BODY_MESSAGE="$(cat message.txt)" settings: - pr_body_message: "" gitea_address: https://git.ar21.de gitea_token: from_secret: FORGEJO_API @@ -81,7 +63,7 @@ steps: pr_body: | ### ℹ Dashboard image update - $${PLUGIN_PR_BODY_MESSAGE} + {- random-pr-message -} ### Configuration @@ -97,10 +79,9 @@ steps: - branch: master event: push - name: create pull request (staging) - image: johnwalkerx/gitea-pull-request-create-plugin:latest + image: git.ar21.de/tom/push-message-randomizer:latest pull: true settings: - <<: *test gitea_address: https://git.ar21.de gitea_token: from_secret: FORGEJO_API @@ -112,8 +93,7 @@ steps: pr_body: | ### ℹ Dashboard image update - ${PLUGIN_PR_BODY_MESSAGE} - ${PR_BODY_MESSAGE} + {- random-pr-message -} ### Configuration