This commit is contained in:
@@ -72,6 +72,11 @@ Workflow template is included at:
|
|||||||
|
|
||||||
The deploy script builds with Podman, tags `localhost/kubeviz:prod`, and restarts `kubeviz.service`.
|
The deploy script builds with Podman, tags `localhost/kubeviz:prod`, and restarts `kubeviz.service`.
|
||||||
The workflow uses `git` checkout (no Node runtime dependency). For private repos, set Gitea secret `CI_REPO_TOKEN`.
|
The workflow uses `git` checkout (no Node runtime dependency). For private repos, set Gitea secret `CI_REPO_TOKEN`.
|
||||||
|
For private base images (for example `dhi.io/golang:*`), ensure the runner user is logged in with Podman and has an auth file at either:
|
||||||
|
- `$XDG_RUNTIME_DIR/containers/auth.json` or
|
||||||
|
- `$HOME/.config/containers/auth.json`
|
||||||
|
|
||||||
|
The deploy script forwards `REGISTRY_AUTH_FILE` to `sudo podman` automatically.
|
||||||
|
|
||||||
Required sudo permissions for the Gitea runner user (example):
|
Required sudo permissions for the Gitea runner user (example):
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,23 @@ IMAGE_REPO="${IMAGE_REPO:-localhost/kubeviz}"
|
|||||||
IMAGE_TAG="${IMAGE_TAG:-prod}"
|
IMAGE_TAG="${IMAGE_TAG:-prod}"
|
||||||
SERVICE_NAME="${SERVICE_NAME:-kubeviz.service}"
|
SERVICE_NAME="${SERVICE_NAME:-kubeviz.service}"
|
||||||
|
|
||||||
|
if [ -z "${REGISTRY_AUTH_FILE:-}" ]; then
|
||||||
|
if [ -n "${XDG_RUNTIME_DIR:-}" ] && [ -f "${XDG_RUNTIME_DIR}/containers/auth.json" ]; then
|
||||||
|
REGISTRY_AUTH_FILE="${XDG_RUNTIME_DIR}/containers/auth.json"
|
||||||
|
elif [ -f "${HOME}/.config/containers/auth.json" ]; then
|
||||||
|
REGISTRY_AUTH_FILE="${HOME}/.config/containers/auth.json"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
SUDO_PODMAN=(sudo podman)
|
||||||
|
if [ -n "${REGISTRY_AUTH_FILE:-}" ] && [ -f "${REGISTRY_AUTH_FILE}" ]; then
|
||||||
|
export REGISTRY_AUTH_FILE
|
||||||
|
SUDO_PODMAN=(sudo --preserve-env=REGISTRY_AUTH_FILE podman)
|
||||||
|
echo "Using registry auth file: ${REGISTRY_AUTH_FILE}"
|
||||||
|
else
|
||||||
|
echo "Warning: no REGISTRY_AUTH_FILE found; private base image pulls may fail."
|
||||||
|
fi
|
||||||
|
|
||||||
if git rev-parse --short=12 HEAD >/dev/null 2>&1; then
|
if git rev-parse --short=12 HEAD >/dev/null 2>&1; then
|
||||||
BUILD_ID="$(git rev-parse --short=12 HEAD)"
|
BUILD_ID="$(git rev-parse --short=12 HEAD)"
|
||||||
else
|
else
|
||||||
@@ -15,10 +32,10 @@ SOURCE_IMAGE="${IMAGE_REPO}:ci-${BUILD_ID}"
|
|||||||
RELEASE_IMAGE="${IMAGE_REPO}:${IMAGE_TAG}"
|
RELEASE_IMAGE="${IMAGE_REPO}:${IMAGE_TAG}"
|
||||||
|
|
||||||
echo "Building ${SOURCE_IMAGE}"
|
echo "Building ${SOURCE_IMAGE}"
|
||||||
sudo podman build --pull=always -t "${SOURCE_IMAGE}" .
|
"${SUDO_PODMAN[@]}" build --pull=always -t "${SOURCE_IMAGE}" .
|
||||||
|
|
||||||
echo "Tagging ${RELEASE_IMAGE}"
|
echo "Tagging ${RELEASE_IMAGE}"
|
||||||
sudo podman tag "${SOURCE_IMAGE}" "${RELEASE_IMAGE}"
|
"${SUDO_PODMAN[@]}" tag "${SOURCE_IMAGE}" "${RELEASE_IMAGE}"
|
||||||
|
|
||||||
echo "Restarting ${SERVICE_NAME}"
|
echo "Restarting ${SERVICE_NAME}"
|
||||||
sudo systemctl restart "${SERVICE_NAME}"
|
sudo systemctl restart "${SERVICE_NAME}"
|
||||||
|
|||||||
Reference in New Issue
Block a user