Skip to content

renamed file

renamed file #142

Workflow file for this run

name: Build and Deploy to AKS
on:
push:
branches:
- main
jobs:
deploy_app_with_ansible:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Python dependencies
run: |
python3 -m pip install kubernetes
python3 -m pip install openshift
- name: Azure Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Install required packages
run: |
sudo apt update
sudo apt install -y ansible
ansible-galaxy collection install kubernetes.core community.general
- name: Set Docker image name
env:
DOCKER_IMAGE_NAME: ${{ secrets.DOCKER_IMAGE_NAME }}
run: |
echo "DOCKER_USERNAME=$DOCKER_USERNAME" >> $GITHUB_ENV
echo "DOCKER_PASSWORD=$DOCKER_PASSWORD" >> $GITHUB_ENV
echo "DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME" >> $GITHUB_ENV
- name: Set up kubeconfig
run: |
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }}
az aks get-credentials --resource-group projet-log8100 --name projet-log8100-cluster --file $HOME/.kube/config
echo "KUBECONFIG=$HOME/.kube/config" >> $GITHUB_ENV
- name: Cleanup old kube-prometheus-stack installation
run: |
helm uninstall kube-prometheus-stack -n prometheus || true
kubectl delete namespace prometheus --grace-period=0 --force || true
kubectl create namespace prometheus
- name: Install Helm
run: |
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Add Helm repositories
run: |
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
- name: Run Ansible playbook
run: |
cd ansible
ansible-playbook -i localhost, playbook.yml
env:
KUBECONFIG: ${{ env.KUBECONFIG }}