Skip to content

fix: LLM schema

fix: LLM schema #25

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
env:
IMAGE_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/who-goes-to-try-backend
NAMESPACE: who-goes-to-try
DEPLOYMENT_NAME: who-goes-to-try-backend
jobs:
build-and-deploy:
name: Build, Push & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Validate required secrets (push to main)
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
set -euo pipefail
[ -n "${DOCKERHUB_USERNAME:-}" ] || { echo "Missing secret DOCKERHUB_USERNAME"; exit 1; }
[ -n "${DOCKERHUB_TOKEN:-}" ] || { echo "Missing secret DOCKERHUB_TOKEN"; exit 1; }
[ -n "${KUBECONFIG_DATA:-}" ] || { echo "Missing secret KUBECONFIG_DATA"; exit 1; }
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_DATA }}
- name: Log in to Docker Hub
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set image tag
id: vars
run: echo "tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: |
${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }}
${{ env.IMAGE_NAME }}:latest
- name: Setup kubectl
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: azure/setup-kubectl@v4
with:
version: "latest"
- name: Configure kubeconfig
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
shell: bash
run: |
set -euo pipefail
mkdir -p "$HOME/.kube"
echo "${KUBECONFIG_DATA}" | base64 -d > "$HOME/.kube/config"
chmod 600 "$HOME/.kube/config"
# Some hackathon clusters use a self-signed / unknown CA.
# If your KUBECONFIG_DATA does not include a trusted CA, disable TLS verification.
CLUSTER_NAME="$(kubectl config view -o jsonpath='{.clusters[0].name}')"
kubectl config set-cluster "${CLUSTER_NAME}" --insecure-skip-tls-verify=true
env:
KUBECONFIG_DATA: ${{ secrets.KUBECONFIG_DATA }}
- name: Apply Kubernetes manifests
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
kubectl apply -f k8s/deployment.yaml --validate=false
kubectl apply -f k8s/service.yaml --validate=false
kubectl apply -f k8s/combined_ingress.yaml --validate=false
- name: Update image to latest build
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
kubectl set image deployment/${{ env.DEPLOYMENT_NAME }} \
${{ env.DEPLOYMENT_NAME }}=${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }} \
-n ${{ env.NAMESPACE }}
- name: Wait for rollout to finish
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
kubectl rollout status deployment/${{ env.DEPLOYMENT_NAME }} \
-n ${{ env.NAMESPACE }} \
--timeout=120s
- name: Show running pods
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: kubectl get pods -n ${{ env.NAMESPACE }}