From 950df53cba20a487fac49167903551002fe0a233 Mon Sep 17 00:00:00 2001 From: Salah Al Saleh Date: Tue, 17 Sep 2024 09:11:47 -0700 Subject: [PATCH] Dev env - always patch even if up & cache yarn packages (#4906) --- .gitignore | 1 + dev/scripts/common.sh | 1 + dev/scripts/up-ec.sh | 12 ++++-------- dev/scripts/up.sh | 10 +++------- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 8a208024b1..e24e3e6244 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ packages/* # dev cache dev/.gocache dev/.gomodcache +dev/.yarncache diff --git a/dev/scripts/common.sh b/dev/scripts/common.sh index 5526f3b663..2a5857656e 100644 --- a/dev/scripts/common.sh +++ b/dev/scripts/common.sh @@ -33,6 +33,7 @@ function populate() { "kotsadm-web") docker run --rm \ -v "$(pwd):/replicatedhq/kots" \ + -e YARN_CACHE_FOLDER=/replicatedhq/kots/dev/.yarncache \ -w /replicatedhq/kots/web \ node:18-alpine \ /bin/sh -c "apk add make bash git && make deps" diff --git a/dev/scripts/up-ec.sh b/dev/scripts/up-ec.sh index 573c7381c7..a81b7940a7 100755 --- a/dev/scripts/up-ec.sh +++ b/dev/scripts/up-ec.sh @@ -12,12 +12,6 @@ if [ -z "$component" ]; then exit 1 fi -# Check if already up -if [ -f "dev/patches/$component-down-ec.yaml.tmp" ]; then - ec_up $component - exit 0 -fi - # Build and load the image into the embedded cluster ec_build_and_load "$component" @@ -30,8 +24,10 @@ if [ "$component" == "kotsadm" ]; then ec_patch "kotsadm-web" fi -# Save current deployment state -ec_exec k0s kubectl get deployment $(deployment $component) -n kotsadm -oyaml > dev/patches/$component-down-ec.yaml.tmp +# Save original state +if [ ! -f "dev/patches/$component-down-ec.yaml.tmp" ]; then + ec_exec k0s kubectl get deployment $(deployment $component) -n kotsadm -oyaml > dev/patches/$component-down-ec.yaml.tmp +fi # Patch the deployment ec_patch $component diff --git a/dev/scripts/up.sh b/dev/scripts/up.sh index 45ac73af3c..2a53720e5e 100755 --- a/dev/scripts/up.sh +++ b/dev/scripts/up.sh @@ -12,15 +12,11 @@ if [ -z "$component" ]; then exit 1 fi -# Check if already up -if [ -f "dev/patches/$component-down.yaml.tmp" ]; then - up $component - exit 0 +# Save original state +if [ ! -f "dev/patches/$component-down.yaml.tmp" ]; then + kubectl get deployment $(deployment $component) -oyaml > dev/patches/$component-down.yaml.tmp fi -# Save current state -kubectl get deployment $(deployment $component) -oyaml > dev/patches/$component-down.yaml.tmp - # Prepare and apply the patch render dev/patches/$component-up.yaml | kubectl patch deployment $(deployment $component) --patch-file=/dev/stdin