Skip to content

Commit

Permalink
[Tool] Branch ubuntu image (backport #43499) (#43500)
Browse files Browse the repository at this point in the history
Signed-off-by: andyziye <[email protected]>
Co-authored-by: andyziye <[email protected]>
  • Loading branch information
mergify[bot] and andyziye authored Apr 2, 2024
1 parent a825814 commit 21c5b49
Show file tree
Hide file tree
Showing 6 changed files with 550 additions and 32 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/ci-merged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ jobs:
runs-on: [self-hosted, normal]
name: Thirdparty Update Image
if: github.event.pull_request.merged == true
continue-on-error: false
strategy:
fail-fast: false
matrix:
linux: [ centos7, ubuntu ]
env:
PR_NUMBER: ${{ github.event.number }}
BRANCH: ${{ github.base_ref }}
Expand All @@ -103,11 +108,11 @@ jobs:
- 'thirdparty/**'
- 'docker/dockerfiles/dev-env/dev-env.Dockerfile'
- name: update image
- name: update image (${{ matrix.linux }})
if: steps.changes.outputs.thirdparty == 'true'
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
./bin/elastic-update-image.sh $BRANCH $PR_NUMBER
./bin/elastic-update-image.sh $BRANCH $PR_NUMBER ${{ matrix.linux }}
- name: Clean ENV
if: always()
Expand Down
72 changes: 54 additions & 18 deletions .github/workflows/ci-pipeline-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,28 +128,33 @@ jobs:
PR_NUMBER: ${{ github.event.number }}
BRANCH: ${{ github.base_ref }}
REPO: ${{ github.repository }}
outputs:
ip: ${{ steps.update-image.outputs.ip }}
instance_id: ${{ steps.update-image.outputs.instance_id }}
image_cache_id: ${{ steps.update-image.outputs.image_cache_id }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
build_type: [ Release, ASAN ]
steps:
- name: clean
run: |
rm -rf ${{ github.workspace }}
mkdir -p ${{ github.workspace }}
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Update Image
- name: Update Image (${{ matrix.build_type }})
id: update-image
if: needs.be-checker.outputs.output2 == 'true'
env:
linux_distro: ${{ matrix.build_type }}
run: |
if [[ "${{ needs.be-checker.outputs.output2 }}" == 'true' ]]; then
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
./bin/run-pr-update-image.sh
fi
cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
./bin/run-pr-update-image.sh
- name: Upload Thirdparty Result
uses: actions/upload-artifact@v4
with:
name: THIRDPARTY-RESULT-${{ matrix.build_type }}
path: image_cache.info
retention-days: 1
overwrite: true

- name: Clean ENV
if: always()
Expand All @@ -160,9 +165,40 @@ jobs:
fi
rm -rf ${{ github.workspace }}/*
thirdparty-info:
runs-on: [ self-hosted, normal ]
needs:
- thirdparty-update
name: Thirdparty Info
outputs:
centos7_image_cache_id: ${{ steps.info.outputs.centos7_image_cache_id }}
ubuntu_image_cache_id: ${{ steps.info.outputs.ubuntu_image_cache_id }}
steps:
- name: Check Result
run: |
if [[ "${{ needs.thirdparty-update.result }}" == 'failure' ]]; then
echo "::error:: Thirdparty Update Error!"
exit 1
fi
- name: Download Thirdparty Artifact
uses: actions/download-artifact@v4
with:
pattern: THIRDPARTY-RESULT-*
path: outputs

- name: Read Info
id: info
if: needs.thirdparty-update.result == 'success'
run: |
image_cache_id=$(cat "./outputs/THIRDPARTY-RESULT-centos7/image_cache.info" || echo "")
echo "centos7_image_cache_id=${image_cache_id}" >> $GITHUB_OUTPUT
image_cache_id=$(cat "./outputs/THIRDPARTY-RESULT-ubuntu/image_cache.info" || echo "")
echo "ubuntu_image_cache_id=${image_cache_id}" >> $GITHUB_OUTPUT
be-ut:
runs-on: [self-hosted, normal]
needs: [ be-checker, thirdparty-update ]
needs: [ be-checker, thirdparty-info ]
timeout-minutes: 180
name: BE UT
env:
Expand All @@ -182,7 +218,7 @@ jobs:
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
if [[ "${{ needs.be-checker.outputs.output2 }}" == 'true' ]]; then
export image_cache_id=${{ needs.thirdparty-update.outputs.image_cache_id }}
export image_cache_id=${{ needs.thirdparty-info.outputs.centos7_image_cache_id }}
export image_tag=$BRANCH-$PR_NUMBER
fi
./bin/elastic-ut.sh --pr ${PR_NUMBER} --module be --branch ${{ steps.branch.outputs.branch }} --repository ${{ github.repository }}
Expand All @@ -198,7 +234,7 @@ jobs:
if: always()
with:
name: BE UT LOG
path: ${{ steps.run_ut.outputs.RES_LOG }}
path: ${{ steps.run_ut.outputs.BE_LOG }}
retention-days: 1
overwrite: true

Expand All @@ -207,6 +243,7 @@ jobs:
run: |
rm -f ${{ steps.run_ut.outputs.RES_FILE }}
rm -f ${{ steps.run_ut.outputs.RES_LOG }}
rm -rf ${{ steps.run_ut.outputs.BE_LOG }}
rm -rf ${{ github.workspace }}/*
fe-checker:
Expand Down Expand Up @@ -432,7 +469,6 @@ jobs:
env:
PR_NUMBER: ${{ github.event.number }}
BRANCH: ${{ github.base_ref }}
CONF_FILE: ${{ needs.deploy.outputs.deploy_conf_file }}
steps:
- name: upload info
if: always()
Expand Down
64 changes: 54 additions & 10 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,37 @@ jobs:
runs-on: [self-hosted, normal]
needs: [ be-checker, clang-format ]
name: Thirdparty Update
continue-on-error: true
strategy:
fail-fast: false
matrix:
linux: [ centos7, ubuntu ]
env:
PR_NUMBER: ${{ github.event.number }}
BRANCH: ${{ github.base_ref }}
REPO: ${{ github.repository }}
outputs:
image_cache_id: ${{ steps.update-image.outputs.image_cache_id }}
steps:
- name: clean
run: |
rm -rf ${{ github.workspace }}
mkdir -p ${{ github.workspace }}
- name: Update Image
- name: Update Image (${{ matrix.linux }})
id: update-image
if: needs.be-checker.outputs.thirdparty_filter == 'true'
env:
linux_distro: ${{ matrix.linux }}
run: |
cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
./bin/run-pr-update-image.sh
- name: Upload Thirdparty Result
uses: actions/upload-artifact@v4
with:
name: THIRDPARTY-RESULT-${{ matrix.linux }}
path: image_cache.info
retention-days: 1
overwrite: true

- name: Clean ENV
if: always() && needs.be-checker.outputs.thirdparty_filter == 'true'
Expand All @@ -162,9 +175,40 @@ jobs:
./bin/elastic-cluster.sh --delete
rm -rf ${{ github.workspace }}/*
thirdparty-info:
runs-on: [self-hosted, normal]
needs:
- thirdparty-update
name: Thirdparty Info
outputs:
centos7_image_cache_id: ${{ steps.info.outputs.centos7_image_cache_id }}
ubuntu_image_cache_id: ${{ steps.info.outputs.ubuntu_image_cache_id }}
steps:
- name: Check Result
run: |
if [[ "${{ needs.thirdparty-update.result }}" == 'failure' ]]; then
echo "::error:: Thirdparty Update Error!"
exit 1
fi
- name: Download Thirdparty Artifact
uses: actions/download-artifact@v4
with:
pattern: THIRDPARTY-RESULT-*
path: outputs

- name: Read Info
id: info
if: needs.thirdparty-update.result == 'success'
run: |
image_cache_id=$(cat "./outputs/THIRDPARTY-RESULT-centos7/image_cache.info" || echo "")
echo "centos7_image_cache_id=${image_cache_id}" >> $GITHUB_OUTPUT
image_cache_id=$(cat "./outputs/THIRDPARTY-RESULT-ubuntu/image_cache.info" || echo "")
echo "ubuntu_image_cache_id=${image_cache_id}" >> $GITHUB_OUTPUT
be-ut:
runs-on: [self-hosted, normal]
needs: [ be-checker, thirdparty-update ]
needs: thirdparty-info
timeout-minutes: 90
name: BE UT
env:
Expand All @@ -177,8 +221,8 @@ jobs:
timeout-minutes: 90
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
if [[ "${{ needs.be-checker.outputs.thirdparty_filter }}" == 'true' ]]; then
export image_cache_id=${{ needs.thirdparty-update.outputs.image_cache_id }}
if [[ "${{ needs.thirdparty-info.outputs.centos7_image_cache_id }}" != '' ]]; then
export image_cache_id=${{ needs.thirdparty-info.outputs.centos7_image_cache_id }}
export image_tag=$BRANCH-$PR_NUMBER
fi
./bin/elastic-ut.sh --pr ${PR_NUMBER} --module be --repository ${{ github.repository }} --with-gcov
Expand Down Expand Up @@ -208,7 +252,7 @@ jobs:
clang-tidy:
runs-on: [self-hosted, normal]
needs: [ be-checker, thirdparty-update ]
needs: [ be-checker, thirdparty-info ]
if: success() && needs.be-checker.outputs.src_filter == 'true'
timeout-minutes: 90
name: Clang-Tidy
Expand All @@ -234,7 +278,7 @@ jobs:
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
if [[ "${{ needs.be-checker.outputs.thirdparty_filter }}" == 'true' ]]; then
export image_cache_id=${{ needs.thirdparty-update.outputs.image_cache_id }}
export image_cache_id=${{ needs.thirdparty-info.outputs.centos7_image_cache_id }}
export image_tag=$BRANCH-$PR_NUMBER
fi
./bin/elastic-build.sh --pr ${PR_NUMBER} --repository ${{ github.repository }} --be --clang-tidy
Expand Down Expand Up @@ -477,7 +521,7 @@ jobs:
build:
runs-on: [self-hosted, normal]
needs: [be-checker, fe-checker, test-checker, clang-tidy, fe-ut, thirdparty-update]
needs: [be-checker, fe-checker, test-checker, clang-tidy, fe-ut, thirdparty-info]
name: BUILD
env:
PR_NUMBER: ${{ github.event.number }}
Expand Down Expand Up @@ -527,7 +571,7 @@ jobs:
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull && source lib/init.sh
if [[ "${{ needs.be-checker.outputs.thirdparty_filter }}" == 'true' ]]; then
export image_cache_id=${{ needs.thirdparty-update.outputs.image_cache_id }}
export image_cache_id=${{ needs.thirdparty-info.outputs.centos7_image_cache_id }}
export image_tag=$BRANCH-$PR_NUMBER
fi
Expand Down
Loading

0 comments on commit 21c5b49

Please sign in to comment.