fix: application set should finally work

This commit is contained in:
Nikolai Rodionov 2023-02-26 06:33:53 +01:00
parent cc7bfcda3f
commit 6a2ebc2ba4
3 changed files with 22 additions and 5 deletions

View File

@ -83,7 +83,7 @@ steps:
- yq -i "del(.metadata.generation)" /tmp/old_appset.yaml - yq -i "del(.metadata.generation)" /tmp/old_appset.yaml
- yq -i "del(.metadata.uid)" /tmp/old_appset.yaml - yq -i "del(.metadata.uid)" /tmp/old_appset.yaml
- yq -i "del(.status)" /tmp/old_appset.yaml - yq -i "del(.status)" /tmp/old_appset.yaml
- yq "del(.spec.generators[].list.elements[] | select(.name == \"$ARGO_APP_BRANCH\"))" /tmp/old_appset.yaml > /tmp/clean_appset.yaml - yq "del(.spec.generators[].list.elements[] | select(.branch == \"$ARGO_APP_BRANCH\"))" /tmp/old_appset.yaml > /tmp/clean_appset.yaml
- envsubst < ./kube/template.yaml > /tmp/elements.yaml - envsubst < ./kube/template.yaml > /tmp/elements.yaml
- yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml - yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml
- kubectl apply -f /tmp/new_appset.yaml - kubectl apply -f /tmp/new_appset.yaml
@ -108,7 +108,7 @@ steps:
- yq -i "del(.metadata.generation)" /tmp/old_appset.yaml - yq -i "del(.metadata.generation)" /tmp/old_appset.yaml
- yq -i "del(.metadata.uid)" /tmp/old_appset.yaml - yq -i "del(.metadata.uid)" /tmp/old_appset.yaml
- yq -i "del(.status)" /tmp/old_appset.yaml - yq -i "del(.status)" /tmp/old_appset.yaml
- yq "del(.spec.generators[].list.elements[] | select(.name == \"$ARGO_APP_BRANCH\"))" /tmp/old_appset.yaml > /tmp/clean_appset1.yaml - yq "del(.spec.generators[].list.elements[] | select(.branch == \"$ARGO_APP_BRANCH\"))" /tmp/old_appset.yaml > /tmp/clean_appset1.yaml
- yq "del(.spec.generators[].list.elements[] | select(.commit_sha == \"$ARGO_APP_IMAGE_TAG\"))" /tmp/clean_appset1.yaml > /tmp/clean_appset.yaml - yq "del(.spec.generators[].list.elements[] | select(.commit_sha == \"$ARGO_APP_IMAGE_TAG\"))" /tmp/clean_appset1.yaml > /tmp/clean_appset.yaml
- envsubst < ./kube/main.yaml > /tmp/elements.yaml - envsubst < ./kube/main.yaml > /tmp/elements.yaml
- yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml - yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml

View File

@ -10,14 +10,14 @@ spec:
- name: application - name: application
app: badhouseplants app: badhouseplants
branch: main branch: main
chart_version: chart_version: 0.3.8
template: template:
metadata: metadata:
name: "{{ app }}-{{ name }}" name: "{{ app }}-{{ name }}"
namespace: argo-system namespace: argo-system
labels: labels:
branch: "{{ name }}" branch: "{{ branch }}"
application: "{{ branch }}" application: "{{ app }}"
spec: spec:
project: "default" project: "default"
source: source:

17
scripts/cleanup.pl Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/perl
# Modules used
use strict;
use warnings;
my $cmd = "git log --format=format:%H --all";
my @output = `$cmd`;
chomp @output;
foreach my $line (@output)
{
print "$line";
}