fix: application set editing won't break applying anymore
This commit is contained in:
parent
99a168644f
commit
3a6e3e4268
27
.drone.yml
27
.drone.yml
@ -34,6 +34,10 @@ steps:
|
||||
|
||||
- name: Build and push the docker image
|
||||
image: plugins/docker
|
||||
when:
|
||||
branch:
|
||||
exclude:
|
||||
- main
|
||||
settings:
|
||||
registry: git.badhouseplants.net
|
||||
username: allanger
|
||||
@ -42,6 +46,21 @@ steps:
|
||||
repo: git.badhouseplants.net/allanger/badhouseplants-net
|
||||
tags: ${DRONE_COMMIT_SHA}
|
||||
|
||||
- name: Build and push the docker image
|
||||
image: plugins/docker
|
||||
when:
|
||||
branch:
|
||||
- main
|
||||
settings:
|
||||
registry: git.badhouseplants.net
|
||||
username: allanger
|
||||
password:
|
||||
from_secret: GITEA_TOKEN
|
||||
repo: git.badhouseplants.net/allanger/badhouseplants-net
|
||||
tags:
|
||||
- ${DRONE_COMMIT_SHA}
|
||||
- latest
|
||||
|
||||
- name: Deploy a preview ApplicationSet
|
||||
image: alpine/k8s:1.24.10
|
||||
when:
|
||||
@ -60,6 +79,10 @@ steps:
|
||||
- export ARGO_APP_HOSTNAME="${DRONE_BRANCH}-dev.badhouseplants.net"
|
||||
- export ARGO_APP_IMAGE_TAG=$DRONE_COMMIT_SHA
|
||||
- kubectl get -f ./kube/applicationset.yaml -o yaml > /tmp/old_appset.yaml
|
||||
- yq -i "del(.metadata.resourceVersion)" /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(.status)" /tmp/old_appset.yaml
|
||||
- yq "del(.spec.generators[].list.elements[] | select(.name == \"$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
|
||||
@ -81,6 +104,10 @@ steps:
|
||||
- export ARGO_APP_BRANCH=$DRONE_BRANCH
|
||||
- export ARGO_APP_IMAGE_TAG=$DRONE_COMMIT_SHA
|
||||
- kubectl get -f ./kube/applicationset.yaml -o yaml > /tmp/old_appset.yaml
|
||||
- yq -i "del(.metadata.resourceVersion)" /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(.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(.commit_sha == \"$ARGO_APP_IMAGE_TAG\"))" /tmp/clean_appset1.yaml > /tmp/clean_appset.yaml
|
||||
- envsubst < ./kube/main.yaml > /tmp/elements.yaml
|
||||
|
@ -6,7 +6,11 @@ metadata:
|
||||
spec:
|
||||
generators:
|
||||
- list:
|
||||
elements: []
|
||||
elements:
|
||||
- name: application
|
||||
app: badhouseplants
|
||||
branch: main
|
||||
chart_version:
|
||||
template:
|
||||
metadata:
|
||||
name: "{{ app }}-{{ name }}"
|
||||
@ -27,3 +31,4 @@ spec:
|
||||
destination:
|
||||
server: "https://kubernetes.default.svc"
|
||||
namespace: "{{ app }}-{{ name }}"
|
||||
|
||||
|
Reference in New Issue
Block a user