Compare commits

...

11 Commits

Author SHA1 Message Date
Jack Jackson
daab6a1b0f Updated chart version 2023-06-14 22:22:19 -07:00
Jack Jackson
e2144b2be4 Extracted to build-tools 2023-06-14 22:17:33 -07:00
Jack Jackson
bd22a72e63 Remove some echos 2023-06-14 20:42:13 -07:00
Jack Jackson
a08b8d3e9d More echos 2023-06-14 20:38:52 -07:00
Jack Jackson
7b5e579aa3 Double-echo 2023-06-14 20:29:15 -07:00
Jack Jackson
7e624e1a6b Change delimiter 2023-06-14 20:25:51 -07:00
Jack Jackson
6311314ea7 Double-escape 2023-06-14 20:12:35 -07:00
Jack Jackson
d6e9066647 Force a change 2023-06-14 20:09:14 -07:00
Jack Jackson
7ea0598292 install perl 2023-06-14 20:07:35 -07:00
Jack Jackson
be460e8167 Install git 2023-06-14 20:05:43 -07:00
Jack Jackson
c8442eeea4 Introduce drone.yml 2023-06-14 20:03:19 -07:00
4 changed files with 62 additions and 2 deletions

19
.drone.yml Normal file
View File

@ -0,0 +1,19 @@
kind: pipeline
name: publish
type: docker
platform:
os: linux
arch: arm64
steps:
- name: step1
image: alpine
commands:
- ./build-tools/upload-new-versions.sh
environment:
GITEA_PASSWORD:
from_secret: gitea_password
image_pull_secrets:
- dockerconfigjson

View File

@ -15,6 +15,11 @@ $ curl --user <username>:<password> -X POST --upload-file ./<package>.tgz https:
### Installation
```bash
$ helm repo add --username <username> --password <password> <repo-alias> https://hostname.of.gitea/api/packages/scubbo/helm
$ helm repo add --username <username> --password <password> <repo-alias> https://hostname.of.gitea/api/packages/<user>/helm
$ helm install <release-name> <repo-alias>/<name>
```
## Other links
* [General documentation on repositories](https://helm.sh/docs/topics/chart_repository/)
* [Gitea's own documentation](https://docs.gitea.com/next/usage/packages/helm)

View File

@ -0,0 +1,36 @@
#!/bin/sh
set -x
apk add git curl jq helm;
# Intentionally does not handle renames, which would begin with `R`.
changed_charts=$(git show --name-status --pretty="format:" | grep '^[MA]' | cut -f 2- | grep '^charts' | cut -d '/' -f 1,2 | sort | uniq);
echo "$changed_charts";
current_versions=$(curl -s --user scubbo:$GITEA_PASSWORD https://gitea.scubbo.org/api/v1/packages/scubbo | jq -r '.[] | select(.type == "helm") | .name + "___" + .version');
echo "$current_versions";
mkdir bundles;
for changed_chart in $changed_charts
do
echo "Operating on $changed_chart";
# e.g. /Users/scubbo/Code/helm-charts/hello-world-0.1.1.tgz
output_location=$(helm package $changed_chart | rev | cut -d ' ' -f 1 | rev);
# e.g. hello-world-0.1.1
file_metadata=$(echo $output_location | rev | cut -d '/' -f 1 | cut -c 5- | rev);
chart_name=$(echo $file_metadata | rev | cut -d '-' -f 2- | rev);
chart_version=$(echo $file_metadata | rev | cut -d '-' -f 1 | rev);
if [[ $(echo $current_versions | grep "$chart_name___$chart_version" | wc -l ) -eq 1 ]]; then
# I.e. if the current version in the repo is the same as what we're trying to push
# TODO - should we check that we're pushing a _newer_ version?
# TODO - does the API only show the current version, or all versions?
echo "Version clash ($chart_version) for $chart_name";
exit 1;
else
# Move to a directory so we can upload later. Do this after checking all packages so there's no partial update
mv $output_location bundles/;
fi
done
# All packages have been checked, no version conflicts - upload them all!
find bundles -type f -exec curl -s --user "scubbo:$GITEA_PASSWORD" -X POST --upload-file '{}' https://gitea.scubbo.org/api/packages/scubbo/helm/api/charts \;
rm -rf bundles;

View File

@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.1.2
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to