Skip to content

Commit

Permalink
Dev env - always patch even if up & cache yarn packages (#4906)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgalsaleh authored Sep 17, 2024
1 parent 548af28 commit 950df53
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ packages/*
# dev cache
dev/.gocache
dev/.gomodcache
dev/.yarncache
1 change: 1 addition & 0 deletions dev/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 4 additions & 8 deletions dev/scripts/up-ec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand Down
10 changes: 3 additions & 7 deletions dev/scripts/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 950df53

Please sign in to comment.