Skip to content

chore: update the group of the ops to "operations" #13596

chore: update the group of the ops to "operations"

chore: update the group of the ops to "operations" #13596

name: Pull Request
on:
pull_request:
types: [ labeled ]
branches:
- main
- release-*
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
BASE_BRANCH: origin/main
GO_VERSION: "1.21"
jobs:
trigger-mode:
name: trigger mode
if: github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'pre-approve')
runs-on: ubuntu-latest
outputs:
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }}
git-commit: ${{ steps.get_git_info.outputs.git_commit }}
git-version: ${{ steps.get_git_info.outputs.git_version }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
all_but_latest: true
access_token: ${{ github.token }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Get trigger mode
id: get_trigger_mode
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
if [[ "${HEAD_REF}" != "main" ]]; then
git checkout -b ${HEAD_REF} --track origin/${HEAD_REF}
fi
TRIGGER_MODE=`bash .github/utils/utils.sh --type 6 \
--branch-name "${HEAD_REF}" \
--base-branch "${{ env.BASE_BRANCH }}"`
echo $TRIGGER_MODE
echo trigger_mode=$TRIGGER_MODE >> $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
pr-pre-check:
needs: trigger-mode
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[test]') }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
ops: [ 'manifests', 'mod-vendor', 'generate', 'lint', 'staticcheck', 'test' ]
steps:
- uses: actions/checkout@v4
- name: install lib
run: |
sudo rm /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libbtrfs-dev \
libdevmapper-dev
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
- name: Install golangci-lint
if: matrix.ops == 'lint'
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
- name: make ${{ matrix.ops }}
run: |
make ${{ matrix.ops }}
FILE_CHANGES=`git diff --name-only ${{ github.sha }}`
if [[ ("${{ matrix.ops }}" == 'generate' || "${{ matrix.ops }}" == 'manifests') && -n "$FILE_CHANGES" ]]; then
echo $FILE_CHANGES
echo "make "${{ matrix.ops }}" causes inconsistent files"
exit 1
fi
- name: ignore cover pkgs
if: matrix.ops == 'test'
run: |
bash .github/utils/utils.sh --type 14 \
--file cover.out \
--ignore-pkgs "${{ vars.IGNORE_COVERAGE_PKG }}"
- name: upload coverage report
if: matrix.ops == 'test'
uses: codecov/codecov-action@v3
continue-on-error: true
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./cover_new.out
flags: unittests
name: codecov-report
verbose: true
check-image:
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
MAKE_OPS_PRE: "generate"
IMG: "apecloud/kubeblocks"
GO_VERSION: "1.21"
BUILDX_PLATFORMS: "linux/amd64"
DOCKERFILE_PATH: "./docker/Dockerfile"
BUILDX_ARGS: |
VERSION=${{ needs.trigger-mode.outputs.git-version }}
GIT_COMMIT=${{ needs.trigger-mode.outputs.git-commit }}
GIT_VERSION=${{ needs.trigger-mode.outputs.git-version }}
secrets: inherit
check-tools-image:
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
MAKE_OPS_PRE: "module generate test-go-generate"
IMG: "apecloud/kubeblocks-tools"
GO_VERSION: "1.21"
BUILDX_PLATFORMS: "linux/amd64"
DOCKERFILE_PATH: "./docker/Dockerfile-tools"
secrets: inherit
check-dataprotection-image:
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
IMG: "apecloud/kubeblocks-dataprotection"
BUILDX_PLATFORMS: "linux/amd64"
DOCKERFILE_PATH: "./docker/Dockerfile-dataprotection"
secrets: inherit
check-helm:
name: check helm
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[deploy]')
uses: apecloud/apecloud-cd/.github/workflows/[email protected]
with:
MAKE_OPS: "bump-chart-ver"
VERSION: "v0.8.0-check"
CHART_NAME: "kubeblocks"
CHART_DIR: "deploy/helm"
APECD_REF: "v0.1.43"
MAKE_OPS_POST: "install"
GO_VERSION: "1.21"
secrets: inherit
pr-check:
name: make test
needs: [ trigger-mode, pr-pre-check, check-image, check-tools-image, check-dataprotection-image, check-helm ]
if: ${{ github.event.action == 'labeled' && (github.event.label.name == 'approved' || github.event.label.name == 'pre-approve') && always() }}
runs-on: ubuntu-latest
steps:
- name: pr pre check
run: |
if [[ "${{ needs.pr-pre-check.result }}" == "failure" || "${{ needs.pr-pre-check.result }}" == "cancelled" ]]; then
echo "make test fail"
exit 1
fi
- name: release image check
run: |
if [[ "${{ needs.check-image.result }}" == "failure" || "${{ needs.check-image.result }}" == "cancelled" ]]; then
echo "release image fail"
exit 1
fi
if [[ "${{ needs.check-tools-image.result }}" == "failure" || "${{ needs.check-tools-image.result }}" == "cancelled" ]]; then
echo "release tools image fail"
exit 1
fi
if [[ "${{ needs.check-dataprotection-image.result }}" == "failure" || "${{ needs.check-dataprotection-image.result }}" == "cancelled" ]]; then
echo "release dataprotection image fail"
exit 1
fi
- name: release helm check
run: |
if [[ "${{ needs.check-helm.result }}" == "failure" || "${{ needs.check-helm.result }}" == "cancelled" ]]; then
echo "release helm fail"
exit 1
fi