From 6a2ebc2ba45a29b1b57fb47b362ec6bfc60ae9fc Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Sun, 26 Feb 2023 06:33:53 +0100 Subject: [PATCH] fix: application set should finally work --- .drone.yml | 4 ++-- kube/applicationset.yaml | 6 +++--- scripts/cleanup.pl | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100755 scripts/cleanup.pl diff --git a/.drone.yml b/.drone.yml index 9679238..c996c4d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -83,7 +83,7 @@ steps: - yq -i "del(.metadata.generation)" /tmp/old_appset.yaml - yq -i "del(.metadata.uid)" /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 - yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /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.uid)" /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 - envsubst < ./kube/main.yaml > /tmp/elements.yaml - yq '.spec.generators[].list.elements += load("/tmp/elements.yaml")' /tmp/clean_appset.yaml > /tmp/new_appset.yaml diff --git a/kube/applicationset.yaml b/kube/applicationset.yaml index 8891ca7..7388408 100644 --- a/kube/applicationset.yaml +++ b/kube/applicationset.yaml @@ -10,14 +10,14 @@ spec: - name: application app: badhouseplants branch: main - chart_version: + chart_version: 0.3.8 template: metadata: name: "{{ app }}-{{ name }}" namespace: argo-system labels: - branch: "{{ name }}" - application: "{{ branch }}" + branch: "{{ branch }}" + application: "{{ app }}" spec: project: "default" source: diff --git a/scripts/cleanup.pl b/scripts/cleanup.pl new file mode 100755 index 0000000..c7c7a4b --- /dev/null +++ b/scripts/cleanup.pl @@ -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"; +} +