fix: 1
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
# .gitea/workflows/ci.yml
|
||||||
name: CI/CD Pipeline
|
name: CI/CD Pipeline
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -9,12 +10,10 @@ env:
|
|||||||
IMAGE: git.fpmoz.sum.ba/${{ github.repository }}
|
IMAGE: git.fpmoz.sum.ba/${{ github.repository }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# ── JOB 1: Build i Push Docker image ──────────────────
|
# ── JOB 1: Build i Push Docker image ──────────────────
|
||||||
build:
|
build:
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout koda
|
- name: Checkout koda
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo ${{ secrets.REGISTRY_PASS }} | \
|
echo ${{ secrets.REGISTRY_PASS }} | \
|
||||||
docker login $REGISTRY \
|
docker login $REGISTRY \
|
||||||
-u ${{ secrets.REGISTRY_USER }} --stdin
|
-u ${{ secrets.REGISTRY_USER }} --password-stdin
|
||||||
|
|
||||||
- name: Build i Push image
|
- name: Build i Push image
|
||||||
run: |
|
run: |
|
||||||
@@ -33,24 +32,30 @@ jobs:
|
|||||||
echo $TAG > tag.txt
|
echo $TAG > tag.txt
|
||||||
|
|
||||||
- name: Spremi image tag
|
- name: Spremi image tag
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image-tag
|
name: image-tag
|
||||||
path: tag.txt
|
path: tag.txt
|
||||||
|
|
||||||
# ── JOB 2: Deploy na k3s ───────────────────────────────
|
# ── JOB 2: Deploy na k3s ───────────────────────────────
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout koda
|
- name: Checkout koda
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Preuzmi image tag
|
- name: Preuzmi image tag
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: image-tag
|
name: image-tag
|
||||||
|
|
||||||
|
- name: Instaliraj kubectl
|
||||||
|
run: |
|
||||||
|
curl -LO "https://dl.k8s.io/release/$(curl -sL https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||||
|
chmod +x kubectl
|
||||||
|
mv kubectl /usr/local/bin/
|
||||||
|
|
||||||
- name: Postavi kubeconfig
|
- name: Postavi kubeconfig
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.kube
|
mkdir -p ~/.kube
|
||||||
@@ -64,7 +69,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Deploy na k3s
|
- name: Deploy na k3s
|
||||||
run: |
|
run: |
|
||||||
kubectl apply -f k8s/
|
kubectl create namespace student-${{ github.actor }} --dry-run=client -o yaml | kubectl apply -f -
|
||||||
|
kubectl apply -f k8s/ -n student-${{ github.actor }}
|
||||||
kubectl rollout status deployment/hello-cicd \
|
kubectl rollout status deployment/hello-cicd \
|
||||||
-n student-${{ github.actor }} --timeout=120s
|
-n student-${{ github.actor }} --timeout=120s
|
||||||
|
|
||||||
Reference in New Issue
Block a user