Skip to content

Commit

Permalink
[ci] Label images with date on 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 ad7e220 commit 1ea5fc8
Show file tree
Hide file tree
Showing 6 changed files with 741 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflow_templates/deploy-channel.multi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,37 @@ Jobs for visual control allowed editions when approving deploy to environments.
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
{!{- end }!}

{!{ range $werfEnv := slice "CE" "EE" "FE" "BE" "SE" }!}
- name: Set release date label for release ({!{ $werfEnv }!})
if: ${{ needs.detect_editions.outputs.DEPLOY_{!{ $werfEnv }!} == 'true' }}
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
WERF_ENV: {!{ $werfEnv }!}
run: |
PROD_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z "${DECKHOUSE_REGISTRY_HOST}" ]]; then
PROD_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
echo "⚓️ 🧪 [$(date -u)] DECKHOUSE_REGISTRY_HOST is empty. Publish using Github Container Registry: '${PROD_REGISTRY_PATH}'"
fi
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]')
SOURCE_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}:${CI_COMMIT_TAG};
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}
{!{- end }!}

{!{/*
Add 'publish' step for each edition to repuplish semver tag images to channel tag:
- Pull deckhouse images from dev registry.
Expand Down
142 changes: 142 additions & 0 deletions .github/workflows/deploy-alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,148 @@ jobs:
docker image push ${SOURCE_RELEASE_VERSION_IMAGE}
- name: Set release date label for release (CE)
if: ${{ needs.detect_editions.outputs.DEPLOY_CE == 'true' }}
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
WERF_ENV: CE
run: |
PROD_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z "${DECKHOUSE_REGISTRY_HOST}" ]]; then
PROD_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
echo "⚓️ 🧪 [$(date -u)] DECKHOUSE_REGISTRY_HOST is empty. Publish using Github Container Registry: '${PROD_REGISTRY_PATH}'"
fi
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]')
SOURCE_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}:${CI_COMMIT_TAG};
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}
- name: Set release date label for release (EE)
if: ${{ needs.detect_editions.outputs.DEPLOY_EE == 'true' }}
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
WERF_ENV: EE
run: |
PROD_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z "${DECKHOUSE_REGISTRY_HOST}" ]]; then
PROD_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
echo "⚓️ 🧪 [$(date -u)] DECKHOUSE_REGISTRY_HOST is empty. Publish using Github Container Registry: '${PROD_REGISTRY_PATH}'"
fi
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]')
SOURCE_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}:${CI_COMMIT_TAG};
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}
- name: Set release date label for release (FE)
if: ${{ needs.detect_editions.outputs.DEPLOY_FE == 'true' }}
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
WERF_ENV: FE
run: |
PROD_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z "${DECKHOUSE_REGISTRY_HOST}" ]]; then
PROD_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
echo "⚓️ 🧪 [$(date -u)] DECKHOUSE_REGISTRY_HOST is empty. Publish using Github Container Registry: '${PROD_REGISTRY_PATH}'"
fi
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]')
SOURCE_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}:${CI_COMMIT_TAG};
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}
- name: Set release date label for release (BE)
if: ${{ needs.detect_editions.outputs.DEPLOY_BE == 'true' }}
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
WERF_ENV: BE
run: |
PROD_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z "${DECKHOUSE_REGISTRY_HOST}" ]]; then
PROD_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
echo "⚓️ 🧪 [$(date -u)] DECKHOUSE_REGISTRY_HOST is empty. Publish using Github Container Registry: '${PROD_REGISTRY_PATH}'"
fi
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]')
SOURCE_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}:${CI_COMMIT_TAG};
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}
- name: Set release date label for release (SE)
if: ${{ needs.detect_editions.outputs.DEPLOY_SE == 'true' }}
env:
DECKHOUSE_REGISTRY_HOST: ${{secrets.DECKHOUSE_REGISTRY_HOST}}
CI_COMMIT_TAG: ${{needs.git_info.outputs.ci_commit_tag}}
WERF_ENV: SE
run: |
PROD_REGISTRY_PATH="${DECKHOUSE_REGISTRY_HOST}/deckhouse"
if [[ -z "${DECKHOUSE_REGISTRY_HOST}" ]]; then
PROD_REGISTRY_PATH="${GHA_TEST_REGISTRY_PATH}"
echo "⚓️ 🧪 [$(date -u)] DECKHOUSE_REGISTRY_HOST is empty. Publish using Github Container Registry: '${PROD_REGISTRY_PATH}'"
fi
REGISTRY_SUFFIX=$(echo ${WERF_ENV} | tr '[:upper:]' '[:lower:]')
SOURCE_IMAGE=${PROD_REGISTRY_PATH}/${REGISTRY_SUFFIX}:${CI_COMMIT_TAG};
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}
- name: Publish release images for CE
if: ${{ needs.detect_editions.outputs.DEPLOY_CE == 'true' }}
Expand Down
Loading

0 comments on commit 1ea5fc8

Please sign in to comment.