Skip to content

Release Images

Release Images #1344

Workflow file for this run

name: Release Images
on:
schedule:
- cron: '0 0 * * 1-5' # Runs at 00:00 UTC on Mon to Friday
workflow_dispatch:
inputs:
release_version:
description: 'The release version of image'
required: false
default: 'latest'
dockerfile:
description: 'release specify Dockerfile or empty to release all images'
required: false
default: ''
type: choice
options:
- ""
- Dockerfile
- Dockerfile-charts
- Dockerfile-dataprotection
- Dockerfile-dev
- Dockerfile-tools
release:
types:
- published
env:
GH_TOKEN: ${{ github.token }}
RELEASE_VERSION: ${{ github.ref_name }}
jobs:
release-version:
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.get_release_version.outputs.release_version }}
release-version-bump: ${{ steps.get_release_version.outputs.release_version_bump }}
git-commit: ${{ steps.get_git_info.outputs.git_commit }}
git-version: ${{ steps.get_git_info.outputs.git_version }}
steps:
- uses: actions/checkout@v4
- name: Get Release Version
id: get_release_version
run: |
RELEASE_VERSION="latest"
if [[ ! -z "${{ inputs.release_version }}" ]]; then
RELEASE_VERSION="${{ inputs.release_version }}"
elif [[ "${{ env.RELEASE_VERSION }}" == "main" ]]; then
RELEASE_VERSION="latest"
elif [[ ! -z "${{ env.RELEASE_VERSION }}" ]]; then
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
fi
echo release_version=$RELEASE_VERSION >> $GITHUB_OUTPUT
RELEASE_VERSION_BUMP="${RELEASE_VERSION/v/}"
echo release_version_bump=$RELEASE_VERSION_BUMP >> $GITHUB_OUTPUT
- name: get git info
id: get_git_info
run: |
GIT_COMMIT=$(git rev-list -1 HEAD)
GIT_VERSION=$(git describe --always --abbrev=0 --tag)
echo git_commit=$GIT_COMMIT >> $GITHUB_OUTPUT
echo git_version=$GIT_VERSION >> $GITHUB_OUTPUT
release-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache.yml@v0.1.64
with:
MAKE_OPS_PRE: "generate"
IMG: "apecloud/kubeblocks"
VERSION: "${{ needs.release-version.outputs.release-version }}"
GO_VERSION: "1.21"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile"
BUILDX_ARGS: |
VERSION=${{ needs.release-version.outputs.release-version }}
GIT_COMMIT=${{ needs.release-version.outputs.git-commit }}
GIT_VERSION=${{ needs.release-version.outputs.git-version }}
secrets: inherit
release-tools-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-tools' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache.yml@v0.1.24
with:
MAKE_OPS_PRE: "module generate test-go-generate"
IMG: "apecloud/kubeblocks-tools"
VERSION: "${{ needs.release-version.outputs.release-version }}"
GO_VERSION: "1.21"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-tools"
secrets: inherit
release-dataprotection-image:
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-dataprotection' }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache.yml@v0.1.24
with:
IMG: "apecloud/kubeblocks-dataprotection"
VERSION: "${{ needs.release-version.outputs.release-version }}"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-dataprotection"
secrets: inherit
release-charts-image:
if: ${{ github.event_name == 'workflow_dispatch' && (inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-charts') }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache.yml@v0.1.24
with:
MAKE_OPS_PRE: "helm-package VERSION=${{ needs.release-version.outputs.release-version-bump }}"
IMG: "apecloud/kubeblocks-charts"
VERSION: "${{ needs.release-version.outputs.release-version }}"
GO_VERSION: "1.21"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-charts"
secrets: inherit
release-dev-image:
if: ${{ github.event_name == 'workflow_dispatch' && (inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-dev') }}
needs: release-version
uses: apecloud/apecloud-cd/.github/workflows/release-image-cache.yml@v0.1.24
with:
IMG: "apecloud/kubeblocks-dev"
VERSION: "${{ needs.release-version.outputs.release-version }}"
APECD_REF: "v0.1.24"
DOCKERFILE_PATH: "./docker/Dockerfile-dev"
CONTEXT: "./docker"
secrets: inherit
release-message:
runs-on: ubuntu-latest
needs: [ release-image, release-tools-image, release-dataprotection-image ]
outputs:
content-result: ${{ steps.release_message.outputs.content_result }}
release-version: ${{ steps.release_message.outputs.release_version }}
if: ${{ always() && github.event.action == 'published' }}
steps:
- uses: actions/checkout@v4
- name: release message
id: release_message
run: |
ARTIFACT_KEY="${{ env.RELEASE_VERSION }}-image"
touch ${ARTIFACT_KEY}
echo 'artifact_key='${ARTIFACT_KEY} >> $GITHUB_OUTPUT
CONTENT="error"
if [[ "${{ needs.release-image.result }}" == "success" && "${{ needs.release-tools-image.result }}" == "success" && "${{ needs.release-dataprotection-image.result }}" == "success" ]]; then
CONTENT="success"
echo "success" > ${ARTIFACT_KEY}
else
echo "error" > ${ARTIFACT_KEY}
fi
echo 'content_result='$CONTENT >> $GITHUB_OUTPUT
echo release_version=${{ env.RELEASE_VERSION }} >> $GITHUB_OUTPUT
- name: delete cache
continue-on-error: true
run: |
bash .github/utils/utils.sh --type 17 --tag-name "${{ steps.release_message.outputs.artifact_key }}"
- name: Save Artifact
id: cache-artifact-save
uses: actions/cache/save@v3
with:
path: |
${{ steps.release_message.outputs.artifact_key }}
key: ${{ steps.release_message.outputs.artifact_key }}
send-message:
needs: [ release-message ]
if: ${{ always() && github.event.action == 'published' }}
uses: apecloud/apecloud-cd/.github/workflows/feishui-message.yml@v0.1.38
with:
TYPE: "2"
CONTENT: "release image ${{ needs.release-message.outputs.release-version }} ${{ needs.release-message.outputs.content-result }}"
APECD_REF: "v0.1.38"
secrets: inherit
release-result:
if: github.event.action == 'published'
needs: [ release-message ]
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, chart]
steps:
- name: Restore ${{ matrix.type }} Artifact
id: cache-artifact-restore
uses: actions/cache/restore@v3
with:
path: |
${{ env.RELEASE_VERSION }}-${{ matrix.type }}
key: ${{ env.RELEASE_VERSION }}-${{ matrix.type }}
- name: check release result
run: |
release_result=$( cat ${{ env.RELEASE_VERSION }}-${{ matrix.type }} )
if [[ "$release_result" != "success" ]]; then
exit 1
fi
e2e-kbcli:
needs: [ release-message, release-result ]
uses: apecloud/apecloud-cd/.github/workflows/trigger-workflow.yml@v0.1.35
strategy:
fail-fast: false
matrix:
test-type: [ apecloud-mysql|postgresql|redis|mongodb|kafka|pulsar|mysqlscale|weaviate|qdrant|smartengine,
greptimedb|nebula|risingwave|starrocks|etcd|oceanbase|foxlake|orioledb|oracle-mysql|official-pg|asmysql|openldap,
polardbx|opensearch|elasticsearch|vllm|tdengine|milvus|clickhouse|pika|ggml|zookeeper|mariadb|tidb|xinference,
oracle|opengauss|influxdb|flink|solr|doris|halo|mogdb|oceanbase-ent|starrocks-ent|apecloud-postgresql|yashandb|redis-cluster|camellia-redis-proxy|dmdb|minio ]
with:
GITHUB_REPO: "apecloud/kubeblocks"
BRANCH_NAME: "main"
WORKFLOW_ID: "e2e-kbcli.yml"
APECD_REF: "v0.1.35"
VERSION: "${{ needs.release-message.outputs.release-version }}"
EXTRA_ARGS: "TEST_TYPE=${{ matrix.test-type }}#CLOUD_PROVIDER=${{ vars.CLOUD_PROVIDER }}"
secrets: inherit
delete-cache:
needs: e2e-kbcli
runs-on: ubuntu-latest
strategy:
matrix:
type: [image, chart]
steps:
- uses: actions/checkout@v4
- name: delete ${{ matrix.type }} cache
continue-on-error: true
run: |
bash .github/utils/utils.sh --type 17 --tag-name "${{ env.RELEASE_VERSION }}-${{ matrix.type }}"