Add CI Workflow #204
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dashboard-check | |
on: | |
push: | |
branches: | |
- "*.*" | |
pull_request: | |
branches: | |
- "master" | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
inputs: | |
folders: | |
description: 'Folders' | |
required: true | |
default: 'mongodb' | |
type: string | |
kubedb_version: | |
description: 'KubeDB Version' | |
required: true | |
default: 'v2024.8.21' #needs to be dynamic | |
type: string | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}-dashboard-check | |
cancel-in-progress: true | |
jobs: | |
config: | |
name: Configure Inputs | |
runs-on: ubuntu-latest | |
outputs: | |
folders: ${{ steps.defaulter.outputs.folders }} | |
kubedb_version : ${{ steps.defaulter.outputs.kubedb_version }} | |
steps: | |
- name: Defaulter | |
id: defaulter | |
env: | |
FOLDERS: "mongodb" | |
KUBEDB_VERSION: ${{ inputs.kubedb_version }} | |
run: | | |
echo "folders=${FOLDERS:-mongodb}" >> $GITHUB_OUTPUT | |
echo "kubedb_version=${KUBEDB_VERSION:-v2024.8.21}" >> $GITHUB_OUTPUT | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
needs: config | |
strategy: | |
fail-fast: false | |
matrix: | |
k8s: [v1.27.3] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: workflow | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
detached: true | |
- name: Set up Go 1.22 | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.22' | |
id: go | |
- name: Install Homebrew | |
run: | | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
- uses: Homebrew/actions/setup-homebrew@master | |
- name: Prepare host | |
run: | | |
brew instal gh kubectl helm kind | |
- name: Prepare git | |
env: | |
GITHUB_USER: 1gtm | |
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }} | |
run: | | |
set -x | |
git config --global user.name "1gtm" | |
git config --global user.email "[email protected]" | |
git config --global \ | |
url."https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com".insteadOf \ | |
"https://github.com" | |
- name: Create Kubernetes ${{ matrix.k8s }} cluster | |
id: kind | |
uses: engineerd/[email protected] | |
with: | |
version: v0.20.0 | |
config: hack/kubernetes/kind.yaml | |
image: kindest/node:${{ matrix.k8s }} | |
- name: Prepare cluster for testing | |
id: local-path | |
run: | | |
echo "waiting for nodes to be ready ..." | |
kubectl wait --for=condition=Ready nodes --all --timeout=5m | |
kubectl get nodes | |
kubectl wait --for=condition=Ready pods -n kube-system --all --timeout=10m | |
kubectl get pods -n kube-system | |
- name: Install cert-manager | |
run: | | |
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml | |
- name: Issue License | |
env: | |
BYTEBUILDERS_LICENSE_TOKEN: ${{ secrets.BYTEBUILDERS_LICENSE_TOKEN }} | |
run: | | |
export KUBECONFIG="${HOME}/.kube/config" | |
CLUSTER_UID=$(kubectl get ns kube-system -o=jsonpath='{.metadata.uid}') | |
curl -X POST -o /tmp/kubedb-license.txt -d "name=1gtm&[email protected]&product=kubedb-enterprise&cluster=${CLUSTER_UID}&tos=true&token=${BYTEBUILDERS_LICENSE_TOKEN}" https://license-issuer.appscode.com/issue-license | |
curl -X POST -o /tmp/platform-license.txt -d "name=1gtm&[email protected]&product=platform&cluster=${CLUSTER_UID}&tos=true&token=${BYTEBUILDERS_LICENSE_TOKEN}" https://license-issuer.appscode.com/issue-license | |
cat /tmp/kubedb-license.txt | |
# - name: Install Longhorn | |
# run: | | |
# helm repo add longhorn https://charts.longhorn.io | |
# helm repo update | |
# helm install longhorn longhorn/longhorn --namespace longhorn-system --create-namespace --version 1.6.2 --wait --burst-limit=10000 | |
- name: Install KubeDB | |
run: | | |
helm install kubedb oci://ghcr.io/appscode-charts/kubedb \ | |
--version ${{ needs.config.outputs.kubedb_version }} \ | |
--namespace kubedb --create-namespace \ | |
--set-file global.license=/tmp/kubedb-license.txt \ | |
--set global.featureGates.Druid=true \ | |
--set global.featureGates.FerretDB=true \ | |
--set global.featureGates.Memcached=true \ | |
--set global.featureGates.MSSQLServer=true \ | |
--set global.featureGates.PerconaXtraDB=true \ | |
--set global.featureGates.PgBouncer=true \ | |
--set global.featureGates.Pgpool=true \ | |
--set global.featureGates.ProxySQL=true \ | |
--set global.featureGates.RabbitMQ=true \ | |
--set global.featureGates.Singlestore=true \ | |
--set global.featureGates.Solr=true \ | |
--set global.featureGates.ZooKeeper=true \ | |
--wait --burst-limit=10000 --debug | |
- name: Install KubeDB CLI | |
run: | | |
cd .. | |
git clone https://github.com/kubedb/cli.git | |
cd cli | |
git checkout mssql-dashboard | |
go install ./... | |
- name: Install Prometheus | |
run: | | |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts | |
helm repo update | |
helm install prometheus prometheus-community/kube-prometheus-stack -n monitoring --create-namespace --wait --burst-limit=10000 | |
- name: Install Panopticon | |
run: | | |
helm repo add appscode https://charts.appscode.com/stable/ | |
helm repo update | |
helm install panopticon appscode/panopticon \ | |
-n kubeops --create-namespace \ | |
--set monitoring.agent=prometheus.io/operator \ | |
--set monitoring.serviceMonitor.labels.release=prometheus \ | |
--set-file license=/tmp/kubedb-license.txt \ | |
--wait --burst-limit=10000 | |
sleep 5s | |
kubectl wait --for=condition=ready pod -l "app.kubernetes.io/name=panopticon,app.kubernetes.io/instance=panopticon" -n kubeops --timeout=10m | |
- name: Apply MetricsConfigurations | |
run: | | |
helm repo add appscode https://charts.appscode.com/stable/ | |
helm repo update | |
helm upgrade -i kubedb-metrics appscode/kubedb-metrics -n kubedb --create-namespace --version=${{ needs.config.outputs.kubedb }} --wait | |
- name: Prepare smaples | |
run: | | |
cd .. | |
git clone https://github.com/kubedb/samples.git | |
cd samples | |
git checkout mssql-monitoring | |
- name: Check Dashboard Metrics | |
env: | |
SINGLESTORE_LICENSE_USERNAME: ${{ secrets.SINGLESTORE_LICENSE_USERNAME }} | |
SINGLESTORE_LICENSE_PASSWORD: ${{ secrets.SINGLESTORE_LICENSE_PASSWORD }} | |
FOLDERS: ${{ needs.config.outputs.folders }} | |
run: | | |
echo "SINGLESTORE_LICENSE_USERNAME=$(echo $SINGLESTORE_LICENSE_USERNAME)" >> ./hack/scripts/.env | |
echo "SINGLESTORE_LICENSE_PASSWORD=$(echo $SINGLESTORE_LICENSE_PASSWORD)" >> ./hack/scripts/.env | |
echo "FOLDERS=$(echo $FOLDERS)" >> ./hack/scripts/.env | |
bash hack/scripts/check-dashboard.sh |