From acbbabf043693fb55b45e3b85f9e85245be56ed6 Mon Sep 17 00:00:00 2001 From: "sammy.huang" Date: Wed, 3 Jan 2024 19:46:50 +0800 Subject: [PATCH] enhance: [skip e2e]abstract bump builder version into a composite action (#29573) fix: #29608 Signed-off-by: Sammy Huang --- .../actions/bump-builder-version/action.yaml | 55 +++++++++++++++++++ .github/workflows/publish-builder.yaml | 36 ++---------- .github/workflows/publish-gpu-builder.yaml | 36 ++---------- 3 files changed, 65 insertions(+), 62 deletions(-) create mode 100644 .github/actions/bump-builder-version/action.yaml diff --git a/.github/actions/bump-builder-version/action.yaml b/.github/actions/bump-builder-version/action.yaml new file mode 100644 index 0000000000..ec93ffb532 --- /dev/null +++ b/.github/actions/bump-builder-version/action.yaml @@ -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 }}" \ No newline at end of file diff --git a/.github/workflows/publish-builder.yaml b/.github/workflows/publish-builder.yaml index 8e4d9d03c0..0a89a5f9e0 100644 --- a/.github/workflows/publish-builder.yaml +++ b/.github/workflows/publish-builder.yaml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/publish-gpu-builder.yaml b/.github/workflows/publish-gpu-builder.yaml index 48bc27d6be..2587457b8f 100644 --- a/.github/workflows/publish-gpu-builder.yaml +++ b/.github/workflows/publish-gpu-builder.yaml @@ -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 }} \ No newline at end of file