Skip to content

Commit 996ad8c

Browse files
authored
Merge pull request #40872 from appsmithorg/release
05/06 Daily Promotion
2 parents 344a394 + 9ae1eb9 commit 996ad8c

File tree

9 files changed

+321
-4
lines changed

9 files changed

+321
-4
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Helm Unit Tests
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- release
7+
paths:
8+
- "deploy/helm/**"
9+
workflow_dispatch:
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
15+
defaults:
16+
run:
17+
working-directory: deploy/helm
18+
shell: bash
19+
20+
steps:
21+
- name: Checkout the code
22+
uses: actions/checkout@v4
23+
24+
- name: Unittest
25+
run: |
26+
docker run --rm -v $(pwd):/apps helmunittest/helm-unittest .

app/client/src/LandingScreen.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ interface Props {
1515
}
1616

1717
function LandingScreen(props: Props) {
18-
if (props.user && window.location.pathname === BASE_URL) {
19-
if (props.user.email === ANONYMOUS_USERNAME) {
18+
if (window.location.pathname === BASE_URL) {
19+
if (!props.user || props.user.email === ANONYMOUS_USERNAME) {
2020
return <Redirect to={AUTH_LOGIN_URL} />;
2121
} else {
2222
return <Redirect to={APPLICATIONS_URL} />;

deploy/helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sources:
1111
- https://github.com/appsmithorg/appsmith
1212
home: https://www.appsmith.com/
1313
icon: https://assets.appsmith.com/appsmith-icon.png
14-
version: 3.6.2
14+
version: 3.6.3
1515
dependencies:
1616
- condition: redis.enabled
1717
name: redis

deploy/helm/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Appsmith
32
Appsmith is a JS-based internal tool development platform. Internal tools take a lot of time to build even though they involve the same UI components, data integrations, and user access management. Developers love Appsmith because it saves them hundreds of hours.
43

@@ -228,3 +227,7 @@ helm upgrade --values values.yaml stable-appsmith/appsmith appsmith
228227
If at any time you encounter an error during the installation process, reach out to support@appsmith.com or join our Discord Server
229228

230229
If you know the error and would like to reinstall Appsmith, simply delete the installation folder and the templates folder and execute the script again
230+
231+
## Testing
232+
233+
Review tests/README.md for details on how the chart is tested.

deploy/helm/templates/deployment.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ spec:
144144
value: kubernetes.KUBE_PING
145145
- name: APPSMITH_HEADLESS_SVC
146146
value: {{ include "appsmith.fullname" . }}-headless
147+
{{- if .Values.securityContext.runAsUser | default nil }}
148+
# ensure the interactive shell when connected via kubectl exec is set
149+
- name: LD_PRELOAD
150+
value: /usr/local/lib/libnss_wrapper.so
151+
{{- end }}
147152
envFrom:
148153
- configMapRef:
149154
name: {{ include "appsmith.fullname" . }}

deploy/helm/tests/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Helm Chart Unit Tests
2+
3+
This directory contains unit tests for our Helm charts using [helm-unittest](https://github.com/helm-unittest/helm-unittest), a BDD-style testing framework for Helm charts.
4+
5+
## Running Tests Locally
6+
7+
You can run the tests locally using Docker:
8+
9+
```bash
10+
docker run -ti --rm -v $(pwd):/apps helmunittest/helm-unittest .
11+
```
12+
13+
## Snapshot Testing
14+
15+
Our tests use snapshot testing to validate the rendered Kubernetes manifests. This ensures that any changes to the defaults are intentional and reviewed.
16+
17+
### Updating Snapshots
18+
19+
When making changes that affect the rendered output (like updating labels or other metadata), you'll need to update the snapshots. This is particularly important during releases when labels are updated.
20+
21+
To update snapshots, run the tests with the `-u` flag:
22+
23+
```bash
24+
docker run -ti --rm -v $(pwd):/apps helmunittest/helm-unittest -u .
25+
```
26+
27+
**Important**: Always review the changes in the snapshots before committing them to ensure they match your expectations.
28+
29+
## Documentation
30+
31+
For more information about helm-unittest, including:
32+
- Writing test cases
33+
- Available assertions
34+
- Test suite configuration
35+
- Best practices
36+
37+
Please refer to the [official helm-unittest documentation](https://github.com/helm-unittest/helm-unittest).
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
"":
2+
1: |
3+
raw: |
4+
1. Get the application URL by running these commands:
5+
export POD_NAME=$(kubectl get pods --namespace NAMESPACE -l "app.kubernetes.io/name=appsmith,app.kubernetes.io/instance=RELEASE-NAME" -o jsonpath="{.items[0].metadata.name}")
6+
export CONTAINER_PORT=$(kubectl get pod --namespace NAMESPACE $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
7+
echo "Visit http://127.0.0.1:8080 to use your application"
8+
kubectl --namespace NAMESPACE port-forward $POD_NAME 8080:$CONTAINER_PORT
9+
10+
To expose your Appsmith service to be accessible from the Internet, please refer to our docs here https://docs.appsmith.com/getting-started/setup/installation-guides/kubernetes/publish-appsmith-online.
11+
2: |
12+
apiVersion: v1
13+
data:
14+
APPSMITH_DB_URL: |
15+
mongodb+srv://root:password@appsmith-mongodb.NAMESPACE.svc.cluster.local/appsmith?retryWrites=true&authSource=admin&ssl=false
16+
APPSMITH_DISABLE_IFRAME_WIDGET_SANDBOX: "false"
17+
APPSMITH_KEYCLOAK_DB_DRIVER: postgresql
18+
APPSMITH_KEYCLOAK_DB_PASSWORD: password
19+
APPSMITH_KEYCLOAK_DB_URL: RELEASE-NAME-postgresql.NAMESPACE.svc.cluster.local:5432/keycloak
20+
APPSMITH_KEYCLOAK_DB_USERNAME: root
21+
APPSMITH_REDIS_URL: redis://RELEASE-NAME-redis-master.NAMESPACE.svc.cluster.local:6379
22+
kind: ConfigMap
23+
metadata:
24+
labels:
25+
app.kubernetes.io/instance: RELEASE-NAME
26+
app.kubernetes.io/managed-by: Helm
27+
app.kubernetes.io/name: appsmith
28+
appsmith.sh/chart: appsmith-3.6.3
29+
name: RELEASE-NAME-appsmith
30+
namespace: NAMESPACE
31+
3: |
32+
apiVersion: apps/v1
33+
kind: StatefulSet
34+
metadata:
35+
labels:
36+
app.kubernetes.io/instance: RELEASE-NAME
37+
app.kubernetes.io/managed-by: Helm
38+
app.kubernetes.io/name: appsmith
39+
appsmith.sh/chart: appsmith-3.6.3
40+
name: RELEASE-NAME-appsmith
41+
namespace: NAMESPACE
42+
spec:
43+
replicas: 1
44+
selector:
45+
matchLabels:
46+
app.kubernetes.io/instance: RELEASE-NAME
47+
app.kubernetes.io/name: appsmith
48+
serviceName: RELEASE-NAME-appsmith
49+
template:
50+
metadata:
51+
labels:
52+
app.kubernetes.io/instance: RELEASE-NAME
53+
app.kubernetes.io/name: appsmith
54+
spec:
55+
containers:
56+
- env:
57+
- name: APPSMITH_ENABLE_EMBEDDED_DB
58+
value: "0"
59+
- name: JGROUPS_DISCOVERY_PROTOCOL
60+
value: kubernetes.KUBE_PING
61+
- name: APPSMITH_HEADLESS_SVC
62+
value: RELEASE-NAME-appsmith-headless
63+
envFrom:
64+
- configMapRef:
65+
name: RELEASE-NAME-appsmith
66+
image: index.docker.io/appsmith/appsmith-ee:latest
67+
imagePullPolicy: IfNotPresent
68+
livenessProbe:
69+
failureThreshold: 3
70+
httpGet:
71+
path: /api/v1/health
72+
port: 80
73+
periodSeconds: 60
74+
name: appsmith
75+
ports:
76+
- containerPort: 80
77+
name: http
78+
protocol: TCP
79+
- containerPort: 443
80+
name: https
81+
protocol: TCP
82+
- containerPort: 2019
83+
name: metrics
84+
protocol: TCP
85+
readinessProbe:
86+
failureThreshold: 3
87+
httpGet:
88+
path: /api/v1/health
89+
port: 80
90+
periodSeconds: 60
91+
resources:
92+
limits: {}
93+
requests:
94+
cpu: 500m
95+
memory: 3000Mi
96+
securityContext: {}
97+
startupProbe:
98+
failureThreshold: 3
99+
httpGet:
100+
path: /api/v1/health
101+
port: 80
102+
periodSeconds: 60
103+
volumeMounts:
104+
- mountPath: /appsmith-stacks
105+
name: data
106+
initContainers:
107+
- command:
108+
- sh
109+
- -c
110+
- until redis-cli -h RELEASE-NAME-redis-master.NAMESPACE.svc.cluster.local ping ; do echo waiting for redis; sleep 2; done
111+
image: docker.io/redis:7.0.15
112+
name: redis-init-container
113+
- command:
114+
- sh
115+
- -c
116+
- until mongosh --host appsmith-mongodb.NAMESPACE.svc.cluster.local --eval 'db.runCommand({ping:1})' ; do echo waiting for mongo; sleep 2; done
117+
image: docker.io/bitnami/mongodb:6.0.13
118+
name: mongo-init-container
119+
- command:
120+
- sh
121+
- -c
122+
- until pg_isready -U $postgresuser -d $postgresdb -h RELEASE-NAME-postgresql.NAMESPACE.svc.cluster.local; do echo waiting for postgresql; sleep 2; done
123+
image: docker.io/bitnami/postgresql:14.5.0-debian-11-r21
124+
name: psql-init-container
125+
securityContext: {}
126+
serviceAccountName: RELEASE-NAME-appsmith
127+
volumes: null
128+
updateStrategy: null
129+
volumeClaimTemplates:
130+
- metadata:
131+
name: data
132+
spec:
133+
accessModes:
134+
- ReadWriteOnce
135+
resources:
136+
requests:
137+
storage: 10Gi
138+
4: |
139+
apiVersion: v1
140+
kind: Service
141+
metadata:
142+
labels:
143+
app.kubernetes.io/instance: RELEASE-NAME
144+
app.kubernetes.io/managed-by: Helm
145+
app.kubernetes.io/name: appsmith
146+
appsmith.sh/chart: appsmith-3.6.3
147+
name: RELEASE-NAME-appsmith-headless
148+
namespace: NAMESPACE
149+
spec:
150+
clusterIP: None
151+
clusterIPs:
152+
- None
153+
internalTrafficPolicy: Cluster
154+
ipFamilies:
155+
- IPv4
156+
ipFamilyPolicy: SingleStack
157+
ports:
158+
- name: http
159+
port: 8080
160+
targetPort: 8080
161+
selector:
162+
app.kubernetes.io/instance: RELEASE-NAME
163+
app.kubernetes.io/name: appsmith
164+
type: ClusterIP
165+
5: |
166+
apiVersion: policy/v1beta1
167+
kind: PodDisruptionBudget
168+
metadata:
169+
name: RELEASE-NAME-appsmith-pdb
170+
namespace: NAMESPACE
171+
spec:
172+
minAvailable: 1
173+
selector:
174+
matchLabels:
175+
app.kubernetes.io/instance: RELEASE-NAME
176+
app.kubernetes.io/name: appsmith
177+
6: |
178+
apiVersion: v1
179+
kind: Service
180+
metadata:
181+
labels:
182+
app.kubernetes.io/instance: RELEASE-NAME
183+
app.kubernetes.io/managed-by: Helm
184+
app.kubernetes.io/name: appsmith
185+
appsmith.sh/chart: appsmith-3.6.3
186+
name: RELEASE-NAME-appsmith
187+
namespace: NAMESPACE
188+
spec:
189+
ports:
190+
- name: appsmith
191+
nodePort: null
192+
port: 80
193+
targetPort: http
194+
selector:
195+
app.kubernetes.io/instance: RELEASE-NAME
196+
app.kubernetes.io/name: appsmith
197+
type: ClusterIP
198+
7: |
199+
apiVersion: v1
200+
kind: ServiceAccount
201+
metadata:
202+
labels:
203+
app.kubernetes.io/instance: RELEASE-NAME
204+
app.kubernetes.io/managed-by: Helm
205+
app.kubernetes.io/name: appsmith
206+
appsmith.sh/chart: appsmith-3.6.3
207+
name: RELEASE-NAME-appsmith
208+
namespace: NAMESPACE
209+
secrets:
210+
- name: RELEASE-NAME-appsmith
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# snapshot tests to capture expected changes to defaults
2+
3+
# exclude dependent charts from the snapshot
4+
excludeTemplates:
5+
- charts/*
6+
tests:
7+
- name: manifest should match snapshot from default values
8+
asserts:
9+
- matchSnapshot: {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
templates:
2+
- deployment.yaml
3+
tests:
4+
- name: runAsUser should be 9999
5+
set:
6+
podSecurityContext:
7+
sysctls:
8+
- name: net.ipv4.ip_unprivileged_port_start
9+
value: "80"
10+
securityContext:
11+
runAsNonRoot: true
12+
runAsUser: 9999
13+
asserts:
14+
- equal:
15+
path: spec.template.spec.containers[?(@.name == "appsmith")].securityContext
16+
value:
17+
runAsUser: 9999
18+
runAsNonRoot: true
19+
- equal:
20+
path: spec.template.spec.securityContext
21+
value:
22+
sysctls:
23+
- name: net.ipv4.ip_unprivileged_port_start
24+
value: "80"
25+
- equal:
26+
path: spec.template.spec.containers[?(@.name == "appsmith")].env[?(@.name == "LD_PRELOAD")].value
27+
value: "/usr/local/lib/libnss_wrapper.so"

0 commit comments

Comments
 (0)