Merge branch 'ozalboher:main' into main #13
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 | |
on: | |
push: | |
branches: [main] | |
jobs: | |
CI: | |
runs-on: ubuntu-20.04 | |
name: CI | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: build docker image | |
run: | | |
docker build -t giladalboher/integratorportal:v1.0.${{ github.run_id }} . | |
- name: Update Deployment Manifest | |
run: | | |
sed -i "s|image: giladalboher/integratorportal:v1.0.*|image: giladalboher/integratorportal:v1.0.${{ github.run_id }}|" configs/intergratorportal.yaml | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
ecr: auto | |
logout: true | |
- name: docker push | |
run: | | |
docker push giladalboher/integratorportal:v1.0.${{ github.run_id }} | |
- name: Start minikube | |
uses: medyagh/setup-minikube@master | |
- name: Try the cluster ! | |
run: kubectl get pods -A | |
- name: Deploy to minikube | |
run: | | |
cd configs | |
kubectl create namespace integratorportal | |
kubectl apply -f intergratorportal.yaml | |
- name: Wait for Pods to be running | |
run: | | |
SECONDS=0 | |
TIMEOUT=60 | |
POD_COUNT=$(kubectl get pods -n integratorportal --no-headers -o custom-columns=:metadata.name | wc -l) | |
while [[ $(kubectl get pods -n integratorportal -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}' | grep -o "True" | wc -l) -ne $POD_COUNT ]]; do | |
if [[ $SECONDS -gt $TIMEOUT ]]; then | |
echo "Timed out waiting for pods to be ready" | |
pod_name=$(kubectl get pods -n integratorportal -l app=integratorportal -o jsonpath='{.items[0].metadata.name}') | |
kubectl describe pods $pod_name -n integratorportal | |
exit 1 | |
fi | |
kubectl get pods -n integratorportal && sleep 1; | |
done | |
- name: Commit & Push changes | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.ACTIONS_KEY }} | |
branch: ${{ github.ref }} |