blob: c5e9d0c7bd1707808f1ea3f45d2327541396e9a2 [file] [log] [blame]
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Deployment Test
on:
push:
tags:
- v*
branches:
- main
paths:
- deployment/helm/**
- .github/workflows/deploy-test.yml
pull_request:
paths:
- deployment/helm/**
- .github/workflows/deploy-test.yml
jobs:
deploy-with-helm:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Creating kind cluster
uses: container-tools/kind-action@v1
- name: Cluster information
run: |
kubectl cluster-info
kubectl get nodes
kubectl get pods -n kube-system
helm version
kubectl version
kubectl get storageclasses
- name: Checkout
uses: actions/checkout@v2
# Currently needs 6mins to build all images, so maybe enabled later in scheduled jobs.
# - name: Build container images
# run: |
# docker build -t kind-registry:5000/deploy-test-lake:latest .
# docker build -t kind-registry:5000/deploy-test-grafana:latest grafana
# docker build -t kind-registry:5000/deploy-test-ui:latest config-ui
# docker push kind-registry:5000/deploy-test-lake:latest
# docker push kind-registry:5000/deploy-test-grafana:latest
# docker push kind-registry:5000/deploy-test-ui:latest
- name: Helm install devlake
run: |
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
echo Node IP: ${NODE_IP}
helm install --wait --timeout 300s deploy-test deployment/helm \
--set service.uiPort=30000 \
--set service.grafanaPort=30001 \
--set service.grafanaEndpoint=http://${NODE_IP}:30001 \
--set option.localtime=""
kubectl get pods -o wide
kubectl get services -o wide
# TODO: using some e2e test code to replace it
- name: Curl with endpoints
run: |
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
failed=0
for retry in {1..10} ; do
failed=0
# home
curl --fail http://${NODE_IP}:30000 || failed=1
# API for devlake
curl --fail http://${NODE_IP}:30000/api/blueprints || failed=1
# API for grafana
curl --fail http://${NODE_IP}:30001/api/health || failed=1
if [ $failed -eq 0 ] ; then
break
else
sleep 3
fi
done
if [ $failed -ne 0 ] ; then
echo 'Test apis failed, please check logs from the PODS'
exit 1
fi
- name: Show logs for pods
if: ${{ always() }}
run: |
for pod in $(kubectl get pods -o jsonpath='{.items[*].metadata.name}') ; do
echo describe for $pod
kubectl describe pod $pod
echo logs for $pod
kubectl logs $pod || echo ""
done