diff --git a/README.md b/README.md index 13c65fd6f6..1fcfae0d99 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,24 @@ cosign verify-blob --key sbom/key.pub --signature sbom/kots-sbom.tgz.sig sbom/ko ### Developing kotsadm web -Changes to the kotsadm web component are reflected in real-time, no manual steps required. +Changes to the kotsadm web component are reflected in real-time; no manual steps are required. + +However, to add, remove, or upgrade a dependency / package: + +1. Exec into the kotsadm-web container: + ```bash + make kotsadm-web-up + ``` + +1. Run the desired `yarn` commands. For example: + ```bash + yarn add + ``` + +1. When finished, exit the container: + ```bash + exit + ``` ### Developing kotsadm API diff --git a/dev/patches/kotsadm-web-up.yaml b/dev/patches/kotsadm-web-up.yaml index 4a758b3b06..0595d2f135 100644 --- a/dev/patches/kotsadm-web-up.yaml +++ b/dev/patches/kotsadm-web-up.yaml @@ -6,10 +6,19 @@ spec: hostPath: path: __PROJECT_DIR__/web type: Directory + - name: yarncache + hostPath: + path: __PROJECT_DIR__/dev/.yarncache + type: Directory containers: - name: kotsadm-web image: kotsadm-web-dev volumeMounts: - name: dev mountPath: /replicatedhq/kots/web # workdir in the container + - name: yarncache + mountPath: /replicatedhq/kots/dev/.yarncache + env: + - name: YARN_CACHE_FOLDER + value: /replicatedhq/kots/dev/.yarncache resources: ~ diff --git a/dev/scripts/common.sh b/dev/scripts/common.sh index 2a5857656e..91b1e78d45 100644 --- a/dev/scripts/common.sh +++ b/dev/scripts/common.sh @@ -113,14 +113,8 @@ function ec_build_and_load() { } function up() { - if [ "$1" == "kotsadm-web" ]; then - # Tail the logs of the new pod - newpod=$(kubectl get pods -l app=kotsadm-web --no-headers --sort-by=.metadata.creationTimestamp | awk 'END {print $1}') - kubectl logs -f $newpod --tail=100 - else - # Exec into the deployment - kubectl exec -it deployment/$(deployment $1) -- bash - fi + # Exec into the deployment + kubectl exec -it deployment/$(deployment $1) -- bash } function ec_up() { diff --git a/dev/scripts/down-ec.sh b/dev/scripts/down-ec.sh index c5abe2701d..82e6f81ad8 100755 --- a/dev/scripts/down-ec.sh +++ b/dev/scripts/down-ec.sh @@ -8,8 +8,8 @@ component=$1 # Check if a deployment name was provided if [ -z "$component" ]; then - echo "Error: No component name provided." - exit 1 + echo "Error: No component name provided." + exit 1 fi # Check if already down diff --git a/dev/scripts/down.sh b/dev/scripts/down.sh index 71d28790d9..2a89df3ddc 100755 --- a/dev/scripts/down.sh +++ b/dev/scripts/down.sh @@ -8,8 +8,8 @@ component=$1 # Check if a deployment name was provided if [ -z "$component" ]; then - echo "Error: No component name provided." - exit 1 + echo "Error: No component name provided." + exit 1 fi # Check if already down diff --git a/dev/scripts/up-ec.sh b/dev/scripts/up-ec.sh index a81b7940a7..5f8c6c8473 100755 --- a/dev/scripts/up-ec.sh +++ b/dev/scripts/up-ec.sh @@ -8,8 +8,14 @@ component=$1 # Check if a component name was provided if [ -z "$component" ]; then - echo "Error: No component name provided." - exit 1 + echo "Error: No component name provided." + exit 1 +fi + +# kotsadm-web must already be up +if [ "$component" == "kotsadm-web" ]; then + ec_up $component + exit 0 fi # Build and load the image into the embedded cluster diff --git a/dev/scripts/up.sh b/dev/scripts/up.sh index 2a53720e5e..4b3263f3da 100755 --- a/dev/scripts/up.sh +++ b/dev/scripts/up.sh @@ -8,8 +8,14 @@ component=$1 # Check if a component name was provided if [ -z "$component" ]; then - echo "Error: No component name provided." - exit 1 + echo "Error: No component name provided." + exit 1 +fi + +# kotsadm-web must already be up +if [ "$component" == "kotsadm-web" ]; then + up $component + exit 0 fi # Save original state