Files
helm-charts/Taskfile.yml
2025-03-13 09:26:33 +03:00

119 lines
3.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# https://taskfile.dev
version: "3"
vars:
gitea_url: git.benadis.ru
username: helm
password: r4E-C9C-iBD-JK2
owner: helm
chart_file: ""
CHART_FILE: "11"
# env:
dotenv: [".sec"]
tasks:
# gitea-helm-publish:
# desc: Publish Helm chart to Gitea
# vars:
# chart_file: c:\\r\\helm-charts\\gitea\\gitea-11.0.0.tgz
# dir: .
# cmds:
# - dir=$(pwd)
# - task: gitea-helm-pack
# - curl --user {{.username}}:{{.password}} -X POST --upload-file {{.chart_file}} https://{{.gitea_url}}/api/packages/{{.owner}}/helm/api/charts
# silent: true
gitea-helm-pub:
desc: Отправка Helm chart в Gitea
vars:
repo: helm-charts
chart_file: "{{ .TASK_OUTPUT.gitea_helm_pack }}"
dir: .
cmds:
- task: gitea_helm_pack # Выполняем задачу для получения chart_file
- echo "Chart file {{ .chart_file }}"
# - helm repo add --username {{ .username }} --password {{ .password }} {{ .repo }} https://{{ .gitea_url }}/api/packages/{{ .owner }}/helm
# - helm cm-push "{{ .chart_file }}" {{ .repo }}
gitea_helm_pack:
desc: Pack Helm chart for Gitea
vars:
repo: helm-charts
chart_file: ""
dir: ./gitea
cmds:
- rm -f *.tgz
- |
output=$(helm package .)
# Получаем только последний токен из вывода, который содержит имя созданного .tgz файла
chart_file=$(echo "$output" | awk '{print $NF}')
# Выводим значение без лишних символов, чтобы его можно было корректно захватить как TASK_OUTPUT
echo "$chart_file"
- task: helm-push
# vars: { chart_file: {{ .chart_file }}, repo: "www" }
silent: true
helm:push:
desc: Установка плагина helm-push
dir: .
vars:
repo: '{{default "helm-charts" .repo}}'
chart_file: '{{default "" .chart_file}}'
cmds:
- echo "{{ .repo }} {{ .chart_file }}"
helm:argocd-pub:
desc: Отправка Helm chart в Gitea
vars:
repo: helm-charts
chart_file: c:\\r\\helm-charts\\argo-cd\\argo-cd-7.8.10.tgz
dir: .
cmds:
- dir=$(pwd)
- task: argocd-helm-pack
- helm repo add --username {{.username}} --password {{.password}} {{.repo}} https://{{.gitea_url}}/api/packages/{{.owner}}/helm
- helm cm-push {{.chart_file}} {{.repo}}
silent: true
argocd-helm-pack:
desc: Pack Helm chart for ArgoCD
# vars:
# CHART_FILE: gitea-11.0.0.tgz
dir: ./argo-cd
cmds:
- rm -f *.tgz
- CHART_FILE=$(helm package . | grep "Successfully packaged" | awk '{print $NF}')
- echo "File-$CHART_FILE-"
# silent: true
helm-push-inst:
desc: Установка плагина helm-push
dir: .
cmds:
- helm plugin install https://github.com/chartmuseum/helm-push
silent: true
greet:
vars:
RECIPIENT: '{{default "World" .RECIPIENT}}'
cmds:
- echo "Hello, {{.RECIPIENT}}!"
greet-pessimistically:
cmds:
- task: greet
vars: { RECIPIENT: 'Cruel World' }
silent: true
helm:argocd-build-pub:
desc: Отправка Helm chart в Gitea
vars:
repo: helm-charts
chart_name: argo-cd
dir: .
cmds:
- dir=$(pwd)
# - task: argocd-helm-pack
- helm repo add --username {{.username}} --password {{.password}} {{.repo}} https://{{.gitea_url}}/api/packages/{{.owner}}/helm
- helm cm-push {{.chart_name}} {{.repo}}
silent: true