Skip to content

Commit

Permalink
[ci] Label images with date on each release
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Portnov <[email protected]>
  • Loading branch information
Taior committed Nov 27, 2024
1 parent 1ea5fc8 commit 1b6bf40
Show file tree
Hide file tree
Showing 6 changed files with 338 additions and 234 deletions.
22 changes: 13 additions & 9 deletions .github/workflow_templates/deploy-channel.multi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,19 @@ Jobs for visual control allowed editions when approving deploy to environments.
SOURCE_INSTALL_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_TAG};
SOURCE_RELEASE_VERSION_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/release-channel:${CI_COMMIT_TAG};
echo "⚓️ 📤 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
if [[ ! $(docker inspect localhost:5000/registry:latest -f '{{index .Config.Labels "io.deckhouse.${DEPLOY_CHANNEL}-released"}}') ]]; then
echo "⚓️ 🏷 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
else
echo "⚓️ 🏷 [$(date -u)] Release date label already present. Skipping."
fi;
{!{- end }!}

{!{/*
Expand Down
110 changes: 65 additions & 45 deletions .github/workflows/deploy-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -484,15 +484,19 @@ jobs:
SOURCE_INSTALL_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_TAG};
SOURCE_RELEASE_VERSION_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/release-channel:${CI_COMMIT_TAG};
echo "⚓️ 📤 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
if [[ ! $(docker inspect localhost:5000/registry:latest -f '{{index .Config.Labels "io.deckhouse.${DEPLOY_CHANNEL}-released"}}') ]]; then
echo "⚓️ 🏷 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
else
echo "⚓️ 🏷 [$(date -u)] Release date label already present. Skipping."
fi;
- name: Set release date label for release (EE)
if: ${{ needs.detect_editions.outputs.DEPLOY_EE == 'true' }}
env:
Expand All @@ -512,15 +516,19 @@ jobs:
SOURCE_INSTALL_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_TAG};
SOURCE_RELEASE_VERSION_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/release-channel:${CI_COMMIT_TAG};
echo "⚓️ 📤 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
if [[ ! $(docker inspect localhost:5000/registry:latest -f '{{index .Config.Labels "io.deckhouse.${DEPLOY_CHANNEL}-released"}}') ]]; then
echo "⚓️ 🏷 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
else
echo "⚓️ 🏷 [$(date -u)] Release date label already present. Skipping."
fi;
- name: Set release date label for release (FE)
if: ${{ needs.detect_editions.outputs.DEPLOY_FE == 'true' }}
env:
Expand All @@ -540,15 +548,19 @@ jobs:
SOURCE_INSTALL_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_TAG};
SOURCE_RELEASE_VERSION_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/release-channel:${CI_COMMIT_TAG};
echo "⚓️ 📤 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
if [[ ! $(docker inspect localhost:5000/registry:latest -f '{{index .Config.Labels "io.deckhouse.${DEPLOY_CHANNEL}-released"}}') ]]; then
echo "⚓️ 🏷 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
else
echo "⚓️ 🏷 [$(date -u)] Release date label already present. Skipping."
fi;
- name: Set release date label for release (BE)
if: ${{ needs.detect_editions.outputs.DEPLOY_BE == 'true' }}
env:
Expand All @@ -568,15 +580,19 @@ jobs:
SOURCE_INSTALL_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_TAG};
SOURCE_RELEASE_VERSION_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/release-channel:${CI_COMMIT_TAG};
echo "⚓️ 📤 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
if [[ ! $(docker inspect localhost:5000/registry:latest -f '{{index .Config.Labels "io.deckhouse.${DEPLOY_CHANNEL}-released"}}') ]]; then
echo "⚓️ 🏷 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
else
echo "⚓️ 🏷 [$(date -u)] Release date label already present. Skipping."
fi;
- name: Set release date label for release (SE)
if: ${{ needs.detect_editions.outputs.DEPLOY_SE == 'true' }}
env:
Expand All @@ -596,15 +612,19 @@ jobs:
SOURCE_INSTALL_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/install:${CI_COMMIT_TAG};
SOURCE_RELEASE_VERSION_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}/release-channel:${CI_COMMIT_TAG};
echo "⚓️ 📤 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
if [[ ! $(docker inspect localhost:5000/registry:latest -f '{{index .Config.Labels "io.deckhouse.${DEPLOY_CHANNEL}-released"}}') ]]; then
echo "⚓️ 🏷 [$(date -u)] Add release date label to images."
echo "FROM ${SOURCE_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_IMAGE}" -
echo "FROM ${SOURCE_INSTALL_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_INSTALL_IMAGE}" -
echo "FROM ${SOURCE_RELEASE_VERSION_IMAGE}" | docker build --label io.deckhouse.${DEPLOY_CHANNEL}-released="$(date -u +%Y-%m-%dT%H:%M:%SZ)" -t "${SOURCE_RELEASE_VERSION_IMAGE}" -
echo "⚓️ 📤 [$(date -u)] Push images with release date label."
docker image push ${SOURCE_IMAGE}
docker image push ${SOURCE_INSTALL_IMAGE}
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
else
echo "⚓️ 🏷 [$(date -u)] Release date label already present. Skipping."
fi;
Expand Down
Loading

0 comments on commit 1b6bf40

Please sign in to comment.