@@ -89,5 +89,14 @@ jobs:
|
||||
TAG="sha-${GITHUB_SHA:0:12}"
|
||||
docker tag eventhub:latest "${REGISTRY}/eventhub:${TAG}"
|
||||
docker tag eventhub:latest "${REGISTRY}/eventhub:ift"
|
||||
docker tag eventhub:latest "${REGISTRY}/eventhub:dev"
|
||||
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub:${TAG}"
|
||||
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub:ift"
|
||||
bash scripts/retry-docker-build.sh 5 30 -- docker push "${REGISTRY}/eventhub:dev"
|
||||
|
||||
- name: Prune old registry images
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: bash scripts/run-registry-prune.sh
|
||||
|
||||
@@ -108,3 +108,9 @@ jobs:
|
||||
export REGISTRY_USER='${{ secrets.REGISTRY_USER }}'
|
||||
export REGISTRY_PASSWORD='${{ secrets.REGISTRY_PASSWORD }}'
|
||||
bash /opt/eventhub-ift/devops/scripts/deploy-service.sh ift core ${{ steps.meta.outputs.tag }}
|
||||
|
||||
- name: Prune old registry images
|
||||
env:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: bash scripts/run-registry-prune.sh
|
||||
|
||||
@@ -52,12 +52,23 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
for img in ${IMAGES}; do
|
||||
if docker buildx imagetools inspect "${REGISTRY}/${img}:stage" >/dev/null 2>&1; then
|
||||
docker buildx imagetools create \
|
||||
-t "${REGISTRY}/${img}:stage-previous" \
|
||||
"${REGISTRY}/${img}:stage"
|
||||
fi
|
||||
docker buildx imagetools create \
|
||||
-t "${REGISTRY}/${img}:${REL}" \
|
||||
-t "${REGISTRY}/${img}:stage" \
|
||||
"${REGISTRY}/${img}:${SHA}"
|
||||
done
|
||||
|
||||
- name: Prune old registry images
|
||||
env:
|
||||
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: bash scripts/run-registry-prune.sh
|
||||
|
||||
- name: Deploy core on stage via SSH
|
||||
uses: appleboy/ssh-action@v0.1.5
|
||||
with:
|
||||
|
||||
@@ -20,6 +20,7 @@ rebuild_image() {
|
||||
docker buildx build -f "${dockerfile}" --push \
|
||||
-t "${REGISTRY}/${name}:${TAG}" \
|
||||
-t "${REGISTRY}/${name}:ift" \
|
||||
-t "${REGISTRY}/${name}:dev" \
|
||||
--provenance=false --sbom=false \
|
||||
"${context}"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# CI helper: clone EventHubDevOps и запустить prune-registry-images.sh
|
||||
set -euo pipefail
|
||||
|
||||
DEVOPS_REPO="${DEVOPS_REPO:-https://git.sabilin.com/EventHub/EventHubDevOps.git}"
|
||||
DEVOPS_REF="${DEVOPS_REF:-master}"
|
||||
|
||||
if [[ -z "${REGISTRY_USER:-}" || -z "${REGISTRY_PASSWORD:-}" ]]; then
|
||||
echo "REGISTRY_USER/PASSWORD required for registry prune"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
WORKDIR="$(mktemp -d)"
|
||||
trap 'rm -rf "${WORKDIR}"' EXIT
|
||||
|
||||
repo_path="${DEVOPS_REPO#https://}"
|
||||
git clone --depth 1 --branch "${DEVOPS_REF}" \
|
||||
"https://${REGISTRY_USER}:${REGISTRY_PASSWORD}@${repo_path}" \
|
||||
"${WORKDIR}/devops"
|
||||
|
||||
bash "${WORKDIR}/devops/scripts/prune-registry-images.sh"
|
||||
Reference in New Issue
Block a user