Skip to content

Pull Request

Pull Request #8299

name: CICD-PULL-REQUEST
on:
pull_request_review:
types: [submitted]
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
jobs:
trigger-mode:
name: trigger mode
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
outputs:
trigger-mode: ${{ steps.get_trigger_mode.outputs.trigger_mode }}
matrix: ${{ steps.get_trigger_mode.outputs.matrix }}
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
with:
all_but_latest: true
access_token: ${{ github.token }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get trigger mode
id: get_trigger_mode
run: |
TRIGGER_MODE=`bash .github/utils/utils.sh --type 6 \
--branch-name "${{ github.event.pull_request.head.ref }}" \
--base-commit "${{ github.event.pull_request.base.sha }}"`
echo $TRIGGER_MODE
echo trigger_mode=$TRIGGER_MODE >> $GITHUB_OUTPUT
TEST_PACKAGES=`bash .github/utils/utils.sh --type 16 \
--trigger-type "$TRIGGER_MODE" \
--test-pkgs "internal|apis|controllers|cmd" \
--test-check "mod-vendor|lint"`
echo "$TEST_PACKAGES"
echo "matrix={\"include\":[$TEST_PACKAGES]}" >> $GITHUB_OUTPUT
test-parallel:
name: make test
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[test]')
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix: ${{ fromJSON(needs.trigger-mode.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- name: install lib
run: |
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.51.2
- name: make test ${{ matrix.ops }}
if: ${{ ! contains(matrix.ops, '/') }}
run: |
make ${{ matrix.ops }}
- name: make ${{ matrix.ops }}
if: ${{ contains(matrix.ops, '/') }}
run: |
make test TEST_PACKAGES=./${{ matrix.ops }}/...
make-test:
name: make test
needs: [ trigger-mode, test-parallel ]
if: ${{ contains(needs.trigger-mode.outputs.trigger-mode, '[test]') && always() }}
runs-on: ubuntu-latest
steps:
- name: make test check
run: |
if [[ "${{ needs.test-parallel.result }}" == "failure" || "${{ needs.test-parallel.result }}" == "cancelled" ]]; then
echo "make test fail"
exit 1
fi
check-image:
name: check image
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.2
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "build-manager-image"
IMG: "apecloud/kubeblocks"
VERSION: "check"
GO_VERSION: "1.20"
BUILDX_PLATFORMS: "linux/amd64"
APECD_REF: "v0.1.2"
secrets: inherit
check-tools-image:
name: check image
needs: trigger-mode
if: contains(needs.trigger-mode.outputs.trigger-mode, '[docker]')
uses: apecloud/apecloud-cd/.github/workflows/release-image-check.yml@v0.1.2
with:
MAKE_OPS_PRE: "generate"
MAKE_OPS: "build-tools-image"
IMG: "apecloud/kubeblocks-tools"
VERSION: "check"
GO_VERSION: "1.20"
BUILDX_PLATFORMS: "linux/amd64"
APECD_REF: "v0.1.2"
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/release-charts-check.yml@v0.1.2
with:
MAKE_OPS: "bump-chart-ver"
VERSION: "v0.4.0-check"
CHART_NAME: "kubeblocks"
CHART_DIR: "deploy/helm"
DEP_REPO: "helm dep update deploy/delphic"
APECD_REF: "v0.1.2"
secrets: inherit