diff --git a/.github/scripts/deploy_busola.sh b/.github/scripts/deploy_busola.sh new file mode 100755 index 0000000000..f6c2d948e6 --- /dev/null +++ b/.github/scripts/deploy_busola.sh @@ -0,0 +1,44 @@ +#!/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 + +trap print_k8s_resources EXIT + +print_k8s_resources() +{ + kubectl get all + kubectl get deployment -oyaml +} + +ENV=${ENV?"env is not set"} +IMG_TAG=$1 +IMG_DIR=${IMG_DIR:-"dev"} + +kubectl delete configmap environment --ignore-not-found=true +kubectl create configmap environment --from-literal=ENVIRONMENT="${ENV}" +echo "### Deploying busola from: ${IMG_DIR}/${IMG_TAG}" + +cd resources +(cd base && kustomize edit set image busola=europe-docker.pkg.dev/kyma-project/"${IMG_DIR}"/busola:"${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/busola + +# return ip address busola and save it to output +kubectl wait --for=jsonpath='{.status.loadBalancer.ingress}' ingress/busola +IP=$(kubectl get ingress busola -ojson | jq .status.loadBalancer.ingress[].ip | tr -d '/"') +echo "IP address: ${IP}" + +if [[ -n "${GITHUB_OUTPUT:-}" ]]; then + echo "IP=${IP}" >> "${GITHUB_OUTPUT}" + echo "IP saved" + fi; diff --git a/.github/scripts/prepare_kubeconfig.sh b/.github/scripts/prepare_kubeconfig.sh new file mode 100755 index 0000000000..63b06e272c --- /dev/null +++ b/.github/scripts/prepare_kubeconfig.sh @@ -0,0 +1,12 @@ +#!/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 + +k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml + +#To access kubernetes cluster inside the same cluster change the api server address to url available inside the cluster. +yq --inplace '.clusters[].cluster.server = "https://kubernetes.default.svc:443"' tests/integration/fixtures/kubeconfig.yaml diff --git a/.github/workflows/pull-integration-cluster-k3d.yml b/.github/workflows/pull-integration-cluster-k3d.yml index 596c3f10dd..58f9248c44 100644 --- a/.github/workflows/pull-integration-cluster-k3d.yml +++ b/.github/workflows/pull-integration-cluster-k3d.yml @@ -43,7 +43,7 @@ jobs: shell: bash run: | .github/scripts/setup_local_busola.sh - - name: run_tests + - name: Run tests shell: bash run: | k3d kubeconfig get k3dCluster > tests/integration/fixtures/kubeconfig.yaml diff --git a/.github/workflows/pull-kyma-integration-tests.yml b/.github/workflows/pull-kyma-integration-tests.yml index a7e779d7aa..2aebbfe2f4 100644 --- a/.github/workflows/pull-kyma-integration-tests.yml +++ b/.github/workflows/pull-kyma-integration-tests.yml @@ -32,18 +32,20 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: Setup Busola + - name: Deploy Busola + id: deploy_busola shell: bash - run: | - .github/scripts/setup-busola.sh | tee busola-build.log env: ENV: dev + run: | + .github/scripts/deploy_busola.sh PR-${{ github.event.number }} | tee busola-deploy.log + - name: Prepare kubeconfig + run: | + .github/scripts/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.outputs.IP }} cd tests/integration npm ci && npm run "test:kyma-e2e" - name: Uploads artifacts diff --git a/.github/workflows/pull-smoke-test-stage.yml b/.github/workflows/pull-smoke-test-stage.yml index 663c836339..2fe2d11463 100644 --- a/.github/workflows/pull-smoke-test-stage.yml +++ b/.github/workflows/pull-smoke-test-stage.yml @@ -32,13 +32,13 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - name: setup_busola + - name: Setup Busola shell: bash run: | ./.github/scripts/setup-busola.sh | tee busola-build.log env: ENV: stage - - name: run_tests + - name: Run tests shell: bash run: | k3d kubeconfig get kyma > tests/integration/fixtures/kubeconfig.yaml diff --git a/backend/index.js b/backend/index.js index 8c2b4e3e2c..092717bd21 100644 --- a/backend/index.js +++ b/backend/index.js @@ -51,6 +51,7 @@ if (gzipEnabled) ); if (process.env.NODE_ENV === 'development') { + console.log('Use development settings of cors'); app.use(cors({ origin: '*' })); } diff --git a/resources/base/busola/deployment.yaml b/resources/base/busola/deployment.yaml index 2450819668..bffc67b461 100644 --- a/resources/base/busola/deployment.yaml +++ b/resources/base/busola/deployment.yaml @@ -34,6 +34,10 @@ spec: memory: 21Mi ports: - containerPort: 3001 + startupProbe: + httpGet: + port: 3001 + path: / volumes: - name: config configMap: