Release Images #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-datascript | ||
- 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 }} | ||
steps: | ||
- 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 | ||
release-image: | ||
Check failure on line 55 in .github/workflows/release-image.yml
|
||
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile' }} | ||
needs: release-version | ||
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | ||
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" | ||
secrets: inherit | ||
release-tools-image: | ||
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-tools' }} | ||
needs: release-version | ||
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | ||
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-datascript-image: | ||
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-datascript' }} | ||
needs: release-version | ||
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | ||
with: | ||
IMG: "apecloud/kubeblocks-datascript" | ||
VERSION: "${{ needs.release-version.outputs.release-version }}" | ||
APECD_REF: "v0.1.24" | ||
DOCKERFILE_PATH: "./docker/Dockerfile-datascript" | ||
secrets: inherit | ||
release-dataprotection-image: | ||
if: ${{ inputs.dockerfile == '' || inputs.dockerfile == 'Dockerfile-dataprotection' }} | ||
needs: release-version | ||
uses: apecloud/apecloud-cd/.github/workflows/[email protected] | ||
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/[email protected] | ||
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/[email protected] | ||
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-datascript-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-datascript-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/[email protected] | ||
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/[email protected] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
test-type: [ apecloud-mysql|postgresql|redis|mongodb|kafka|pulsar|weaviate|qdrant|smartengine|mysqlscale|tidb|xinference , | ||
greptimedb|nebula|risingwave|starrocks|etcd|oceanbase|foxlake|omysql|asmysql|openldap|milvus|clickhouse|opengauss , | ||
polardbx|pika|opensearch|elasticsearch|tdengine|vllm|orioledb|official-pg|ggml|zookeeper|mariadb|oracle|flink ] | ||
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 }}" | ||