From 89ffdaff0fb58d9c0a3f008b7217d386f1b3bbac Mon Sep 17 00:00:00 2001 From: Pankaj Date: Mon, 12 Aug 2024 19:18:07 +0530 Subject: [PATCH] Refactor startup script --- .github/workflows/test_kubernetes.yml | 4 ++-- scripts/test/kubernetes-setup.sh | 21 +++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test_kubernetes.yml b/.github/workflows/test_kubernetes.yml index 0ac147c59..eb92d2b1b 100644 --- a/.github/workflows/test_kubernetes.yml +++ b/.github/workflows/test_kubernetes.yml @@ -2,8 +2,8 @@ name: Kubernetes Integration Tests on: - push: # Run on pushes to the default branch - branches: [kube_mode_ci] +# push: # Run on pushes to the default branch +# branches: [kube_mode_ci] pull_request_target: # Also run on pull requests originated from forks branches: [kube_mode_ci] diff --git a/scripts/test/kubernetes-setup.sh b/scripts/test/kubernetes-setup.sh index 24763ddf9..9f951be2a 100644 --- a/scripts/test/kubernetes-setup.sh +++ b/scripts/test/kubernetes-setup.sh @@ -39,13 +39,16 @@ wait_for_nodes_ready() { kubectl config set-context default +# Create a docker image containing the dbt project files and dbt profile +cd dev && docker build -t dbt-jaffle-shop:1.0.0 -f Dockerfile.postgres_profile_docker_k8s . +# Make the build image available in the Kind K8s cluster +kind load docker-image dbt-jaffle-shop:1.0.0 + # Deploy a Postgres pod to Kind helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update helm install postgres bitnami/postgresql -f scripts/test/values.yaml -sleep 60 - # Retrieve the Postgres password and set it as an environment variable POSTGRES_PASSWORD=$(kubectl get secret --namespace default postgres-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d) export POSTGRES_PASSWORD @@ -55,16 +58,10 @@ export POSTGRES_PASSWORD kubectl port-forward --namespace default svc/postgres-postgresql 5432:5432 & kubectl create secret generic postgres-secrets --from-literal=host=postgres-postgresql.default.svc.cluster.local --from-literal=password=$POSTGRES_PASSWORD -# Create a docker image containing the dbt project files and dbt profile -cd dev && docker build -t dbt-jaffle-shop:1.0.0 -f Dockerfile.postgres_profile_docker_k8s . - -wait_for_nodes_ready - -# Make the build image available in the Kind K8s cluster -kind load docker-image dbt-jaffle-shop:1.0.0 - -# Wait for the kind cluster to be in 'Ready' state -wait_for_nodes_ready +#wait_for_nodes_ready +# +## Wait for the kind cluster to be in 'Ready' state +#wait_for_nodes_ready # For Debugging echo "nodes"