From f8022c3f5abdff700a989b421f6cbea42aa04a8b Mon Sep 17 00:00:00 2001 From: XoR Date: Thu, 13 Mar 2025 09:26:33 +0300 Subject: [PATCH] Edit. --- .gitignore | 4 ++- Taskfile.yml | 85 +++++++++++++++++++++++++++++++++++----------- argo-cd/Chart.yaml | 2 +- gitea/Chart.yaml | 2 +- 4 files changed, 70 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 9e30eb9..7357b1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -*.tgz \ No newline at end of file +*.tgz +.sec +.env \ No newline at end of file diff --git a/Taskfile.yml b/Taskfile.yml index c7d4ce5..a36fb5b 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -8,6 +8,11 @@ vars: 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 @@ -24,16 +29,41 @@ tasks: desc: Отправка Helm chart в Gitea vars: repo: helm-charts - chart_file: c:\\r\\helm-charts\\gitea\\gitea-11.0.1.tgz + chart_file: "{{ .TASK_OUTPUT.gitea_helm_pack }}" dir: . cmds: - - dir=$(pwd) + - 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" } - - task: gitea-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-pub: + 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 @@ -46,28 +76,43 @@ tasks: - helm repo add --username {{.username}} --password {{.password}} {{.repo}} https://{{.gitea_url}}/api/packages/{{.owner}}/helm - helm cm-push {{.chart_file}} {{.repo}} silent: true - gitea-helm-pack: - desc: Pack Helm chart for Gitea - vars: - chart_file: gitea-11.0.0.tgz - dir: ./gitea - cmds: - - rm -f *.tgz - - helm package . - silent: true argocd-helm-pack: desc: Pack Helm chart for ArgoCD - vars: - chart_file: gitea-11.0.0.tgz + # vars: + # CHART_FILE: gitea-11.0.0.tgz dir: ./argo-cd cmds: - rm -f *.tgz - - helm package . - silent: true - + - 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 diff --git a/argo-cd/Chart.yaml b/argo-cd/Chart.yaml index e220f25..9ebb7c9 100644 --- a/argo-cd/Chart.yaml +++ b/argo-cd/Chart.yaml @@ -28,4 +28,4 @@ name: argo-cd sources: - https://github.com/argoproj/argo-helm/tree/main/charts/argo-cd - https://github.com/argoproj/argo-cd -version: 7.8.10 +version: 7.8.11 diff --git a/gitea/Chart.yaml b/gitea/Chart.yaml index 1f93f79..3932661 100644 --- a/gitea/Chart.yaml +++ b/gitea/Chart.yaml @@ -45,4 +45,4 @@ sources: - https://github.com/go-gitea/gitea - https://hub.docker.com/r/gitea/gitea/ type: application -version: 11.0.1 +version: 11.0.2