Compare commits

...

8 Commits

Author SHA1 Message Date
3uzbcqje 8ed5721cd6 Removing debugging. 2026-08-27 23:56:45 +02:00
3uzbcqje 3daecd3465 Woodpecker is being a peckerwood. 2026-08-27 23:56:45 +02:00
3uzbcqje b14bcd15c2 Debugging 2026-08-27 23:56:44 +02:00
3uzbcqje 9411e6c2ee Removing bad escaping 2026-08-27 23:56:44 +02:00
3uzbcqje fbe76255d5 Going back to using a script, because Woodpecker CI requires $$ escaping, which is annoying. 2026-08-27 23:56:44 +02:00
3uzbcqje 6f98c392b5 Consolidating and simplifying CI 2026-08-27 23:56:44 +02:00
3uzbcqje b5006b7cce garage uses default branch name main-v2 2026-08-27 23:56:44 +02:00
3uzbcqje b41e0f49bf Adding workflow and script to build helm chart. 2026-08-27 23:56:43 +02:00
2 changed files with 60 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
steps:
helm:
when:
- event: pull_request
branch: main-v2
- event: push
branch: main-v2
image: alpine/helm:4.1.1
environment:
chart_dir: script/helm/garage
chart_name: garage
registry_host: codeberg.org
registry_user: ${CI_REPO_OWNER}
registry_path: ${CI_REPO}
# To create registry_password:
# 1. Go to https://codeberg.org/user/settings/applications.
# 2. Create a token with these settings:
# - Token name: https://git.deuxfleurs.fr/3uzbcqje/garage/src/branch/main-v2/.woodpecker/helm.yaml
# - Set package permission to "Read and write".
# 3. Click "Generate token".
# 4. Copy the token.
# 5. Log into https://ci.codeberg.org.
# 6. Find your repo, and add a secret with these settings:
# - Name: registry_password
# - Value: <the token you copied earlier>
# 7. Click "Add secret".
registry_password:
from_secret: registry_password
commands:
- |
if [[ "${CI_PIPELINE_EVENT}" == "push" && "${CI_COMMIT_BRANCH}" == "${CI_REPO_DEFAULT_BRANCH}" ]]; then
./pipeline.sh push
else
./pipeline.sh
fi
Executable
+22
View File
@@ -0,0 +1,22 @@
#!/usr/bin/env bash
# https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
# Not using "-x" because we aren't debugging.
set -Eeuo pipefail
# We get unbound var err if we don't set arg
arg="${1:-}"
echo "${registry_password}" | helm registry login -u "${registry_user}" --password-stdin "${registry_host}"
helm lint "${chart_dir}"
chart_version=$(grep '^version: ' "${chart_dir}/Chart.yaml" | cut -d' ' -f 2)
helm package "${chart_dir}"
# If chart already exists in the chart repository, don't push.
if helm pull "oci://${registry_host}/${registry_path}/${chart_name}" --version "${chart_version}" &> /dev/null; then
echo -e "\e[31mWARNING: Chart ${chart_name} version ${chart_version} already exists in the repository.\nThis means that the chart's code has not changed, or you forgot to update the version in Chart.yaml.\e[0m"
else
if [[ $arg == 'push' ]]; then
helm push "${chart_name}-${chart_version}.tgz" "oci://${registry_host}/${registry_path}"
fi
fi