enhance: [skip e2e]abstract bump builder version into a composite action (#29573)

fix: #29608

Signed-off-by: Sammy Huang <sammy.huang@zilliz.com>
This commit is contained in:
sammy.huang 2024-01-03 19:46:50 +08:00 committed by GitHub
parent 77ca374d6f
commit acbbabf043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 62 deletions

View File

@ -0,0 +1,55 @@
name: 'Bump Builder Version'
description: 'bump builder version in the .env file'
inputs:
tag:
description: 'Tag name'
required: true
type:
description: 'the type of builder image, cpu or gpu'
required: true
default: 'cpu'
token:
description: 'github token to create pull request'
required: true
runs:
using: "composite"
steps:
- name: Bump Builder Version when cpu type
if: ${{ inputs.type == 'cpu' }}
shell: bash
run: |
sed -i "s#^DATE_VERSION=.*#DATE_VERSION=${{ inputs.tag }}#g" .env
sed -i "s#^LATEST_DATE_VERSION=.*#LATEST_DATE_VERSION=${{ inputs.tag }}#g" .env
- name: Bump Builder Version when gpu type
if: ${{ inputs.type == 'gpu' }}
shell: bash
run: |
sed -i "s#^GPU_DATE_VERSION=.*#GPU_DATE_VERSION=${{ inputs.tag }}#g" .env
sed -i "s#^LATEST_GPU_DATE_VERSION=.*#LATEST_GPU_DATE_VERSION=${{ inputs.tag }}#g" .env
- name: git config
shell: bash
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .env
git commit -m "Update Builder image changes"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
continue-on-error: true
with:
token: ${{ inputs.token }}
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: update_${{ inputs.type }}_builder_${{ github.sha }}
delete-branch: true
title: '[automated] Update ${{ inputs.type }} Builder image changes'
body: |
Update ${{ inputs.type }} Builder image changes
See changes: https://github.com/milvus-io/milvus/commit/${{ github.sha }}
Signed-off-by: ${{ github.actor }} ${{ github.actor }}@users.noreply.github.com
- name: Check outputs
shell: bash
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

View File

@ -74,36 +74,10 @@ jobs:
-p ${{ secrets.DOCKERHUB_TOKEN }}
docker buildx build --platform linux/amd64,linux/arm64 --push -t milvusdb/milvus-env:${OS_NAME}-${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
docker buildx build --platform linux/amd64,linux/arm64 --push -t milvusdb/milvus-env:${OS_NAME}-latest -f build/docker/builder/cpu/${OS_NAME}/Dockerfile .
- name: Update Builder Image Changes
- name: Bump Builder Version
uses: ./.github/actions/bump-builder-version
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
continue-on-error: true
shell: bash
run: |
sed -i "s#^DATE_VERSION=.*#DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
sed -i "s#^LATEST_DATE_VERSION=.*#LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .env
git commit -m "Update Builder image changes"
- name: Create Pull Request
id: cpr
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
continue-on-error: true
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: update_builder_${{ github.sha }}
delete-branch: true
title: '[automated] Update Builder image changes'
body: |
Update Builder image changes
See changes: https://github.com/milvus-io/milvus/commit/${{ github.sha }}
Signed-off-by: ${{ github.actor }} ${{ github.actor }}@users.noreply.github.com
- name: Check outputs
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}"
type: cpu
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}

View File

@ -73,36 +73,10 @@ jobs:
# Building the second image
docker build -t milvusdb/milvus-env:gpu-${OS_NAME}-latest -f build/docker/builder/gpu/${OS_NAME}/Dockerfile .
docker push milvusdb/milvus-env:gpu-${OS_NAME}-latest
- name: Update Builder Image Changes
- name: Bump Builder Version
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
continue-on-error: true
shell: bash
run: |
sed -i "s#^GPU_DATE_VERSION=.*#GPU_DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
sed -i "s#^LATEST_GPU_DATE_VERSION=.*#LATEST_GPU_DATE_VERSION=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .env
git commit -m "Update Builder gpu image changes"
- name: Create Pull Request
id: cpr
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
continue-on-error: true
uses: peter-evans/create-pull-request@v3
uses: ./.github/actions/bump-builder-version
with:
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: update_gpu_builder_${{ github.sha }}
delete-branch: true
title: '[automated] Update Builder gpu image changes'
body: |
Update Builder gpu image changes
See changes: https://github.com/milvus-io/milvus/commit/${{ github.sha }}
Signed-off-by: ${{ github.actor }} ${{ github.actor }}@users.noreply.github.com
- name: Check outputs
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus' && matrix.os == 'ubuntu20.04'
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
tag: "${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}"
type: gpu
token: ${{ secrets.ALL_CONTRIBUTORS_TOKEN }}