hotfix: CI/CD #14
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: CI/CD with Minikube and Helm | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install Docker | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ca-certificates curl gnupg lsb-release | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
- name: Set up Docker group | |
run: | | |
sudo groupadd docker || true | |
sudo usermod -aG docker $USER | |
newgrp docker | |
- name: Start Docker | |
run: | | |
sudo systemctl start docker | |
sudo systemctl enable docker | |
docker --version | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y curl apt-transport-https conntrack | |
- name: Set up Minikube | |
run: | | |
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 | |
sudo install minikube-linux-amd64 /usr/local/bin/minikube && rm minikube-linux-amd64 | |
sudo chown -R $USER:$USER $HOME/.kube $HOME/.minikube || true | |
mkdir -p $HOME/.kube $HOME/.minikube | |
minikube start --driver=docker | |
minikube status | |
minikube kubectl -- get pods -A | |
- name: Set up Kubectl | |
run: | | |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | |
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl | |
kubectl version --client | |
- name: Set up Helm | |
run: | | |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null | |
sudo apt-get install apt-transport-https --yes | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list | |
sudo apt-get update | |
sudo apt-get install helm | |
helm version | |
- name: Install cert-manager | |
run: | | |
kubectl apply --validate=false -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.5/cert-manager.crds.yaml | |
helm repo add jetstack https://charts.jetstack.io | |
helm repo update | |
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --version v1.12.5 | |
kubectl wait --namespace cert-manager --for=condition=available deployment/cert-manager --timeout=120s | |
- name: Deploy with Helm | |
run: | | |
helm upgrade --install demo ./k8s --wait | |
helm list | |
- name: Run Tests | |
run: | | |
kubectl get pods |