Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to manage npm packages in dev env #4921

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <package>
```

1. When finished, exit the container:
```bash
exit
```

### Developing kotsadm API

Expand Down
9 changes: 9 additions & 0 deletions dev/patches/kotsadm-web-up.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ~
10 changes: 2 additions & 8 deletions dev/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
4 changes: 2 additions & 2 deletions dev/scripts/down-ec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions dev/scripts/down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions dev/scripts/up-ec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions dev/scripts/up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading