Integration Test CI - Microk8s #28
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: Integration Test CI | |
run-name: Integration Test CI - Microk8s | |
# Solo se ejecuta desde el workflow de Docker Image CI | |
on: | |
workflow_run: | |
workflows: ["Docker Image CI"] | |
types: | |
- completed | |
# on: workflow_dispatch | |
jobs: | |
on-success: | |
runs-on: ubuntu-latest | |
# Creo que el if no es necesario, ya que si el test del workflow anterior falla, este no se ejecuta | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install microk8s | |
run: | | |
sudo snap install microk8s --channel 1.29-strict/stable | |
- name: Change permissions | |
run: | | |
sudo microk8s status --wait-ready | |
GROUP=snap_microk8s # microk8s for non-strict | |
sudo usermod -a -G $GROUP $USER | |
newgrp $GROUP | |
mkdir ~/.kube | |
sudo chown -f -R $USER ~/.kube | |
# no funciona agregar el usuario al grupo porque debemos reiniciar la sesión, asi que usamos sudo | |
- name: Enable addons | |
run: | | |
sudo microk8s enable hostpath-storage | |
sudo microk8s enable dns | |
- name: Change microk8s config | |
run: | | |
sudo sysctl -w fs.inotify.max_user_instances=1280 | sudo tee /etc/sysctl.d/microk8s.conf | |
sudo sysctl -w fs.inotify.max_user_watches=655360 | sudo tee -a /etc/sysctl.d/microk8s.conf | |
- name: Wait | |
run: sleep 8 | |
- name: Check kubectl version | |
run: | | |
sudo microk8s.kubectl version | |
# ------ la parte de microk8s ------ | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Check repo | |
run: | | |
echo "💡 The ${{ github.repository }} repository has been cloned to the runner." | |
echo "🖥️ The workflow is now ready to test your code on the runner." | |
ls ${{ github.workspace }} | |
- name: apply mongo | |
run: | | |
sudo microk8s.kubectl apply -f ${{ github.workspace }}/kubernetes/kmongo.yaml | |
- name: Wait | |
run: sleep 6 | |
- name: apply backend | |
run: | | |
sudo microk8s.kubectl apply -f ${{ github.workspace }}/kubernetes/backend.yaml | |
- name: wait | |
run: sleep 6 | |
- name: apply frontend | |
run: | | |
sudo microk8s.kubectl apply -f ${{ github.workspace }}/kubernetes/frontend.yaml | |
- name: wait | |
run: sleep 20 | |
- name: Check All | |
run: | | |
sudo microk8s.kubectl get all | |
- name: Integration Test | |
run: | | |
echo "🧐 No supimos como hacer los tests de integración" | |
- name: Finish | |
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." |