ci: drop nightly and sha image tags, deploy only on v* tags
Build & Push Docker Image / build (push) Successful in 2m18s
Build & Push Docker Image / build (push) Successful in 2m18s
Branch pushes now build and push only 'latest'; tag pushes add the v*-tag and update the k8s manifest. Removes the daily nightly-* and per-commit sha-* tags that accumulated registry storage.
This commit is contained in:
@@ -38,33 +38,29 @@ jobs:
|
||||
FULL_SHA=$(git rev-parse HEAD)
|
||||
IMAGE="git.kubebase.de/${{ gitea.repository }}"
|
||||
DATE_STAMP=$(date -u +"%Y%m%d")
|
||||
VERSION="dev-$(date -u +"%Y%m%d-%H%M")"
|
||||
TAGS="-t ${IMAGE}:latest"
|
||||
if [ "${{ gitea.ref_type }}" = "tag" ]; then
|
||||
VERSION="${{ gitea.ref_name }}"
|
||||
VERSION_TAG="${{ gitea.ref_name }}"
|
||||
else
|
||||
VERSION="dev-$(date -u +"%Y%m%d-%H%M")"
|
||||
VERSION_TAG="nightly-${DATE_STAMP}"
|
||||
TAGS="${TAGS} -t ${IMAGE}:${VERSION}"
|
||||
fi
|
||||
TAGS="-t ${IMAGE}:sha-${SHA} -t ${IMAGE}:latest -t ${IMAGE}:${VERSION_TAG}"
|
||||
docker build --no-cache \
|
||||
--build-arg COMMIT_SHA="$FULL_SHA" \
|
||||
--build-arg BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
|
||||
--build-arg VERSION="$VERSION" \
|
||||
$TAGS .
|
||||
docker push "${IMAGE}:sha-${SHA}"
|
||||
docker push "${IMAGE}:latest"
|
||||
docker push "${IMAGE}:${VERSION_TAG}"
|
||||
if [ "${{ gitea.ref_type }}" = "tag" ]; then
|
||||
docker push "${IMAGE}:${VERSION}"
|
||||
fi
|
||||
|
||||
- name: Update k8s manifest in admin/apps
|
||||
if: gitea.ref_type == 'tag'
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||
run: |
|
||||
SHA=$(git rev-parse --short HEAD)
|
||||
if [ "${{ gitea.ref_type }}" = "tag" ]; then
|
||||
NEWTAG="${{ gitea.ref_name }}"
|
||||
else
|
||||
NEWTAG="sha-${SHA}"
|
||||
fi
|
||||
NEWTAG="${{ gitea.ref_name }}"
|
||||
git clone "https://admin:${GITEA_TOKEN}@git.kubebase.de/admin/apps.git" /tmp/apps
|
||||
cd /tmp/apps
|
||||
cd apps/system/toolrate/overlays/k3s
|
||||
|
||||
Reference in New Issue
Block a user