Skip to content

Commit

Permalink
first version od tests adjustement
Browse files Browse the repository at this point in the history
  • Loading branch information
dbadura committed Dec 18, 2024
1 parent 4fc041e commit c34619e
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 27 deletions.
38 changes: 38 additions & 0 deletions .github/scripts/deploy_busola.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# This script install busola on k8s

# standard bash error handling
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

IMG_TAG=$1

#kubectl create configmap ENV #TODO: Fix it

echo "### Deploying busola from: ${IMG_TAG}"

cd resources
(cd base/web && kustomize edit set image busola-web=europe-docker.pkg.dev/kyma-project/prod/busola-web:"${IMG_TAG}")
(cd base/backend && kustomize edit set image busola-backend=europe-docker.pkg.dev/kyma-project/prod/busola-backend:"${IMG_TAG}")
kustomize build base/ | kubectl apply -f-

kubectl apply -f ingress/ingress.yaml

# WAIT FOR busola to be deployed
kubectl wait --for=condition=Available deployment/web
kubectl wait --for=condition=Available deployment/backend

# return ip address busola and save it to output
IP=$(kubectl get ingress ingress-busola -ojson | jq .status.loadBalancer.ingress[].ip | tr -d '/"')

echo "IP address: ${IP}"

# check if busola is available with curl
curl --fail "${IP}"

if [[ ! -z "${GITHUB_OUTPUT:-}" ]]; then
echo "IP=${IP}}" > "${GITHUB_OUTPUT}"
fi;
13 changes: 13 additions & 0 deletions .github/scripts/prepare_kubeconfig.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# standard bash error handling
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

IP=${1}
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml

#To access kubernetes inside the cluster change the api server addrees available inside the cluster
yq --inplace '.clusters[].cluster.server = "https://kubernetes.default.svc:443"' tests/integration/fixtures/kubeconfig.yaml
12 changes: 7 additions & 5 deletions .github/workflows/pull-kyma-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,20 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: setup_busola
- name: deploy_busola
shell: bash

run: |
./.github/scripts/setup-busola.sh | tee busola-build.log
./.github/scripts/deploy_busola.sh | tee busola-deploy.log
env:
ENV: dev
- name: prepare_kubeconfig
run: |
prepare_kubeconfig.sh
- name: run_tests
shell: bash
run: |
k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml
export CYPRESS_DOMAIN=http://localhost:3001
export CYPRESS_DOMAIN=http://${{steps.deploy_busola.IP}}
cd tests/integration
npm ci && npm run "test:kyma-e2e"
- name: Uploads artifacts
Expand Down
6 changes: 0 additions & 6 deletions resources/base/backend/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ spec:
env:
- name: ADDRESS
value: 0.0.0.0
- name: NODE_ENV
valueFrom:
configMapKeyRef:
optional: true
key: NODE_ENV
name: busola-backend-config
volumeMounts:
- name: config
mountPath: /app/config
Expand Down
4 changes: 4 additions & 0 deletions resources/base/backend/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ resources:
- deployment.yaml
- hpa.yaml
- service.yaml
images:
- name: busola-backend
newName: europe-docker.pkg.dev/kyma-project/prod/busola-backend
newTag: v0.0.1
2 changes: 1 addition & 1 deletion resources/base/web/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
containers:
- name: busola
image: busola-web
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
env:
- name: ENVIRONMENT
valueFrom:
Expand Down
4 changes: 4 additions & 0 deletions resources/base/web/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ resources:
- deployment.yaml
- hpa.yaml
- service.yaml
images:
- name: busola-web
newName: europe-docker.pkg.dev/kyma-project/prod/busola-web
newTag: v0.0.1
5 changes: 0 additions & 5 deletions resources/ingress/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: ingress-busola
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/force-ssl-redirect: 'true'
nginx.ingress.kubernetes.io/server-snippet: 'server_tokens off;' # hide nginx version
nginx.ingress.kubernetes.io/enable-cors: 'false'
spec:
rules:
- http:
Expand Down
10 changes: 0 additions & 10 deletions resources/ingress/ingressClass.yaml

This file was deleted.

0 comments on commit c34619e

Please sign in to comment.