From f983fa2ecc5c316527711fd60de4187c66c809ba Mon Sep 17 00:00:00 2001 From: Ivan Filipovic Date: Mon, 20 Apr 2026 22:09:48 +0200 Subject: [PATCH] fix: repair docker login syntax --- .gitea/workflows/ci.yml | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 60a6460..aab44fe 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -9,7 +9,6 @@ env: IMAGE: git.fpmoz.sum.ba/${{ github.repository }} jobs: - # ── JOB 1: Build i Push Docker image ────────────────── build: runs-on: ubuntu-latest @@ -18,14 +17,20 @@ jobs: uses: actions/checkout@v4 - name: Login u Gitea registry - run: echo "${{ secrets.REGISTRY_PASS }}" | docker login ${{ env.REGISTRY }} -u ${{ secrets.REGISTRY_USER }} --password-stdin + run: | + echo ${{ secrets.REGISTRY_PASS }} | \ + docker login $REGISTRY \ + -u ${{ secrets.REGISTRY_USER }} --password-stdin - name: Build i Push image run: | TAG=${{ github.sha }} - docker build -t $IMAGE:$TAG -t $IMAGE:latest . - docker push $IMAGE:$TAG - docker push $IMAGE:latest + IMAGE_LC=$(echo "$IMAGE" | tr '[:upper:]' '[:lower:]') + + docker build -t $IMAGE_LC:$TAG -t $IMAGE_LC:latest . + docker push $IMAGE_LC:$TAG + docker push $IMAGE_LC:latest + echo $TAG > tag.txt - name: Spremi image tag @@ -47,21 +52,28 @@ jobs: with: 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 run: | mkdir -p ~/.kube - cat <<'EOF' > ~/.kube/config.base64 - ${{ secrets.KUBE_CONFIG }} - EOF - base64 -d < ~/.kube/config.base64 > ~/.kube/config + echo "$KUBE_CONFIG" | base64 -d > ~/.kube/config chmod 600 ~/.kube/config + env: + KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }} - name: Update image tag u manifestu run: | TAG=$(cat tag.txt) - sed -i "s|image:.*|image: $IMAGE:$TAG|" k8s/deployment.yaml + IMAGE_LC=$(echo "$IMAGE" | tr '[:upper:]' '[:lower:]') + sed -i "s|image:.*|image: $IMAGE_LC:$TAG|" k8s/deployment.yaml - name: Deploy na k3s run: | - kubectl apply -f k8s/ - kubectl rollout status deployment/hello-cicd -n student-${{ github.actor }} --timeout=120s \ No newline at end of file + kubectl apply -f k8s/ -n student-martabulic + kubectl rollout status deployment/hello-cicd \ + -n student-ivanivso7 --timeout=120s \ No newline at end of file