Fix the entrypoint.sh

This commit is contained in:
dvirlabs 2025-06-18 06:02:46 +03:00
parent 54409e935a
commit 7a8f9782c9
2 changed files with 23 additions and 6 deletions

View File

@ -1,10 +1,15 @@
FROM woodpeckerci/plugin-kaniko:latest
FROM alpine:3.19
USER root
# מתקין את הכלים שאתה צריך לפעולת העדכון (למשל yq, git)
# התקנת כלים שאתה צריך
RUN apk add --no-cache bash git yq curl
# הורדת Kaniko
RUN mkdir -p /kaniko && \
curl -sSL -o /kaniko/executor https://github.com/GoogleContainerTools/kaniko/releases/download/v1.21.0/executor && \
chmod +x /kaniko/executor
ENV PATH="/kaniko:$PATH"
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e
echo "🚀 Starting wp-kaniko-sync"
@ -6,7 +6,6 @@ echo "🚀 Starting wp-kaniko-sync"
TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
echo "🧩 Using tag: $TAG"
echo "🔨 Building Docker image for ${PLUGIN_CONTEXT}"
/kaniko/executor \
--dockerfile="${PLUGIN_DOCKERFILE}" \
--context="${PLUGIN_CONTEXT}" \
@ -17,3 +16,16 @@ echo "🔨 Building Docker image for ${PLUGIN_CONTEXT}"
--cleanup
echo "✅ Image pushed successfully"
if [[ -n "$PLUGIN_GIT_REPO" ]]; then
git config --global user.name "woodpecker-bot"
git config --global user.email "ci@dvirlabs.com"
git clone "https://${PLUGIN_GIT_USERNAME}:${PLUGIN_GIT_TOKEN}@${PLUGIN_GIT_REPO}"
cd $(basename "$PLUGIN_GIT_REPO" .git)
yq -i ".$PLUGIN_VALUES_PATH = \"$TAG\"" "$PLUGIN_VALUES_FILE"
git add "$PLUGIN_VALUES_FILE"
git commit -m "${PLUGIN_NAME}: update tag to $TAG" || echo "⚠️ No changes"
git push origin HEAD
fi