| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: Comment to trigger teamcity |
| |
| on: |
| issue_comment: |
| types: [created, edited] |
| |
| permissions: |
| contents: read |
| pull-requests: write |
| statuses: write |
| |
| jobs: |
| check-comment-if-need-to-trigger-teamcity: |
| |
| # This job only runs for pull request comments, and comment body contains 'run' |
| if: ${{ github.event.issue.pull_request && (contains(github.event.comment.body, 'run') || contains(github.event.comment.body, 'skip buildall') || contains(github.event.comment.body, 'skip check_coverage')) }} |
| |
| runs-on: ubuntu-latest |
| env: |
| COMMENT_BODY: ${{ github.event.comment.body }} |
| COMMENT_USER_ID: ${{ github.event.comment.user.id }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| |
| steps: |
| - name: "Parse PR comment" |
| id: parse |
| run: | |
| COMMENT_BODY=$(echo "${COMMENT_BODY}" | xargs) |
| PULL_REQUEST_NUM="$(echo "${{ github.event.issue.pull_request.url }}" | awk -F/ '{print $NF}')" |
| COMMIT_ID_FROM_TRIGGER="$(curl -s -H "Authorization:Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${PULL_REQUEST_NUM}" | jq -r '.head.sha')" |
| TARGET_BRANCH="$(curl -s -H "Authorization:Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${PULL_REQUEST_NUM}" | jq -r '.base.ref')" |
| if [[ "${COMMENT_BODY}" == *'run buildall'* || |
| "${COMMENT_BODY}" == *'run compile'* || |
| "${COMMENT_BODY}" == *'run beut'* || |
| "${COMMENT_BODY}" == *'run feut'* || |
| "${COMMENT_BODY}" == *'run cloudut'* || |
| "${COMMENT_BODY}" == *'run p0'* || |
| "${COMMENT_BODY}" == *'run p1'* || |
| "${COMMENT_BODY}" == *'run external'* || |
| "${COMMENT_BODY}" == *'run cloud_p0'* || |
| "${COMMENT_BODY}" == *'run cloud_p1'* || |
| "${COMMENT_BODY}" == *'run vault_p0'* || |
| "${COMMENT_BODY}" == *'run nonConcurrent'* || |
| "${COMMENT_BODY}" == *'run check_coverage'* || |
| "${COMMENT_BODY}" == *'run performance'* ]]; then |
| echo "comment_trigger=true" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip_coverage=false" | tee -a "$GITHUB_OUTPUT" |
| elif [[ "${COMMENT_BODY}" == *'skip buildall'* ]]; then |
| echo "comment_skip_coverage=false" | tee -a "$GITHUB_OUTPUT" |
| if [[ "${COMMENT_USER_ID}" == '27881198' || |
| "${COMMENT_USER_ID}" == '2899462' || |
| "${COMMENT_USER_ID}" == '37901441' ]]; then |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=true" | tee -a "$GITHUB_OUTPUT" |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip buildall." |
| elif [[ "${COMMENT_USER_ID}" == '9208457' && "${TARGET_BRANCH}" == *'branch-2.1'* ]]; then |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip buildall for branch-2.1" |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=true" | tee -a "$GITHUB_OUTPUT" |
| elif [[ "${COMMENT_USER_ID}" == '98214048' && "${TARGET_BRANCH}" == *'branch-3.0'* ]]; then |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip buildall for branch-3.0" |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=true" | tee -a "$GITHUB_OUTPUT" |
| elif [[ "${COMMENT_USER_ID}" == '101034200' && "${TARGET_BRANCH}" == *'branch-3.1'* ]]; then |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip buildall for branch-3.1" |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=true" | tee -a "$GITHUB_OUTPUT" |
| elif [[ ("${COMMENT_USER_ID}" == '9208457' || "${COMMENT_USER_ID}" == '2899462') && "${TARGET_BRANCH}" == *'branch-4.0'* ]]; then |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip buildall for branch-4.0" |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=true" | tee -a "$GITHUB_OUTPUT" |
| elif [[ "${COMMENT_USER_ID}" == '9208457' && "${TARGET_BRANCH}" == *'branch-4.1'* ]]; then |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is allowed to skip buildall for branch-4.1" |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "COMMENT_USER_ID ${COMMENT_USER_ID} is not allowed to skip buildall." |
| exit |
| fi |
| elif [[ "${COMMENT_BODY}" == *'skip check_coverage'* ]] && |
| [[ "${COMMENT_USER_ID}" == '37901441' || |
| "${COMMENT_USER_ID}" == '27881198' || |
| "${COMMENT_USER_ID}" == '9208457' || |
| "${COMMENT_USER_ID}" == '10553413' || |
| "${COMMENT_USER_ID}" == '1736049' || |
| "${COMMENT_USER_ID}" == '64513324' || |
| "${COMMENT_USER_ID}" == '2274896' || |
| "${COMMENT_USER_ID}" == '98214048' || |
| "${COMMENT_USER_ID}" == '19986811' || |
| "${COMMENT_USER_ID}" == '48427519' || |
| "${COMMENT_USER_ID}" == '6919662' || |
| "${COMMENT_USER_ID}" == '101034200' || |
| "${COMMENT_USER_ID}" == '2899462' ]]; then |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip_coverage=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "comment_trigger=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip=false" | tee -a "$GITHUB_OUTPUT" |
| echo "comment_skip_coverage=false" | tee -a "$GITHUB_OUTPUT" |
| echo "find no keyword in comment body, skip this action." |
| exit |
| fi |
| |
| echo "PULL_REQUEST_NUM=${PULL_REQUEST_NUM}" | tee -a "$GITHUB_OUTPUT" |
| echo "COMMIT_ID_FROM_TRIGGER=${COMMIT_ID_FROM_TRIGGER}" | tee -a "$GITHUB_OUTPUT" |
| echo "TARGET_BRANCH=${TARGET_BRANCH}" | tee -a "$GITHUB_OUTPUT" |
| COMMENT_BODY_DELIMITER=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) |
| { |
| echo "COMMENT_BODY<<${COMMENT_BODY_DELIMITER}" |
| echo "${COMMENT_BODY}" |
| echo "${COMMENT_BODY_DELIMITER}" |
| } | tee -a "$GITHUB_OUTPUT" |
| |
| reg="run (buildall|compile|p0|p1|feut|beut|cloudut|external|clickbench|cloud_p0|cloud_p1|vault_p0|nonConcurrent|performance|check_coverage)( [1-9]*[0-9]+)*" |
| COMMENT_TRIGGER_TYPE="$(echo -e "${COMMENT_BODY}" | xargs | grep -E "${reg}" | awk -F' ' '{print $2}' | sed -n 1p | sed 's/\r//g')" |
| COMMENT_REPEAT_TIMES="$(echo -e "${COMMENT_BODY}" | xargs | grep -E "${reg}" | awk -F' ' '{print $3}' | sed -n 1p | sed 's/\r//g')" |
| if [[ -n "${COMMENT_REPEAT_TIMES}" && ! "${COMMENT_REPEAT_TIMES}" =~ ^[0-9]+$ ]]; then |
| echo "COMMENT_REPEAT_TIMES '${COMMENT_REPEAT_TIMES}' is not a valid number, ignoring." |
| COMMENT_REPEAT_TIMES="" |
| fi |
| echo "COMMENT_TRIGGER_TYPE=${COMMENT_TRIGGER_TYPE}" | tee -a "$GITHUB_OUTPUT" |
| echo "COMMENT_REPEAT_TIMES=${COMMENT_REPEAT_TIMES}" | tee -a "$GITHUB_OUTPUT" |
| |
| - name: "Checkout master" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) || fromJSON(steps.parse.outputs.comment_skip) || fromJSON(steps.parse.outputs.comment_skip_coverage) }} |
| uses: actions/checkout@v4 |
| |
| - name: "Check if pr need run build" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) }} |
| id: changes |
| run: | |
| source regression-test/pipeline/common/github-utils.sh |
| set -x |
| if _get_pr_changed_files "${{ steps.parse.outputs.PULL_REQUEST_NUM }}"; then |
| if file_changed_fe_ut; then |
| echo "changed_fe_ut=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_fe_ut=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_be_ut; then |
| echo "changed_be_ut=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_be_ut=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_cloud_ut; then |
| echo "changed_cloud_ut=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_cloud_ut=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_regression_p0; then |
| echo "changed_p0=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_external=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_nonConcurrent=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_p0=false" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_external=false" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_nonConcurrent=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_regression_p1; then |
| echo "changed_p1=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_p1=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_performance; then |
| echo "changed_performance=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_performance=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_cloud_p0; then |
| echo "changed_cloud_p0=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_vault_p0=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_cloud_p0=false" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_vault_p0=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_cloud_p1; then |
| echo "changed_cloud_p1=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "changed_cloud_p1=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| if file_changed_regression_p0 && file_changed_be_ut && file_changed_cloud_p0; then |
| echo "need_check_coverage=true" | tee -a "$GITHUB_OUTPUT" |
| else |
| echo "need_check_coverage=false" | tee -a "$GITHUB_OUTPUT" |
| fi |
| else |
| echo "INFO: failed to _get_pr_changed_files, default trigger all" |
| echo "changed_fe_ut=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_be_ut=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_cloud_ut=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_p0=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_external=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_p1=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_performance=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_cloud_p0=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_cloud_p1=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_vault_p0=true" | tee -a "$GITHUB_OUTPUT" |
| echo "changed_nonConcurrent=true" | tee -a "$GITHUB_OUTPUT" |
| echo "need_check_coverage=true" | tee -a "$GITHUB_OUTPUT" |
| fi |
| |
| # - name: "Setup tmate session" |
| # if: ${{ failure() }} |
| # uses: mxschmitt/action-tmate@v3 |
| |
| - name: "Check for sensitive pipeline script changes" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) }} |
| id: security_check |
| env: |
| PULL_REQUEST_NUM: ${{ steps.parse.outputs.PULL_REQUEST_NUM }} |
| COMMENT_TRIGGER_TYPE: ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} |
| run: | |
| # This check is intentionally written inline (not sourced from any repository file) |
| # so it cannot be bypassed by modifying files in a PR. |
| # Matches .sh files under regression-test/pipeline/ but excludes files under conf/ subdirectories. |
| source regression-test/pipeline/common/github-utils.sh |
| |
| if [[ ! -f all_files ]]; then |
| echo "WARNING: all_files not found (GitHub API call likely failed in previous step)." |
| echo "Skipping sensitive check — previous step already defaulted to trigger-all." |
| exit 0 |
| fi |
| |
| changed_sensitive=false |
| while IFS= read -r f; do |
| if [[ "${f}" == regression-test/pipeline/*.sh || |
| "${f}" == regression-test/pipeline/*/*.sh || |
| "${f}" == regression-test/pipeline/*/*/*.sh ]]; then |
| if [[ "${f}" != *'/conf/'* ]]; then |
| echo "Sensitive pipeline script changed: ${f}" |
| changed_sensitive=true |
| break |
| fi |
| fi |
| done < all_files |
| |
| if ${changed_sensitive} && [[ "${COMMENT_TRIGGER_TYPE}" != "buildall" ]]; then |
| msg="⚠️ **Security Notice**: This PR modifies pipeline scripts that are executed by TeamCity with credentials access (ak/sk, tokens, etc.).\n\nTo prevent injection attacks, single test triggers (\`run p0\`, \`run feut\`, etc.) are blocked when pipeline scripts are modified.\n\nPlease review the pipeline script changes carefully. If they are safe, a committer can use \`run buildall\` to explicitly acknowledge and trigger the pipeline." |
| create_an_issue_comment "${PULL_REQUEST_NUM}" "${msg}" |
| exit 1 |
| fi |
| |
| - name: "skip check coverage" |
| if: ${{ fromJSON(steps.parse.outputs.comment_skip_coverage) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| set -x |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" check_coverage |
| |
| - name: "Trigger or Skip feut" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["feut", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_fe_ut }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "feut" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| |
| - name: "Trigger or Skip beut" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["beut", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_be_ut }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "beut" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip cloudut" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["cloudut", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_cloud_ut }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "cloudut" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip compile" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["compile", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| set -x |
| if [[ "${{ steps.changes.outputs.changed_p0 }}" == "true" ]] || [[ "${{ steps.changes.outputs.changed_cloud_p0 }}" == "true" ]]; then |
| changed="true" |
| else |
| changed="false" |
| fi |
| trigger_or_skip_build \ |
| "${changed}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "compile" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip p0" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["p0", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger p0" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_p0 }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "p0" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip p1" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["p1", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| COMMIT_ID_FROM_TRIGGER=${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }} |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger p1" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_p1 }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "p1" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip external" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["external", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger external" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_external }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "external" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip cloud_p0" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["cloud_p0", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger cloud_p0" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_cloud_p0 }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "cloud_p0" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| |
| - name: "Trigger or Skip vault_p0" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["vault_p0", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger vault_p0" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_vault_p0 }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "vault_p0" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip nonConcurrent" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["nonConcurrent", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger nonConcurrent" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_nonConcurrent }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "nonConcurrent" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip check_coverage" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["check_coverage", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, check_coverage will be triggered after p0,cloud_p0,external,nonConcurrent,beut" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.need_check_coverage }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "check_coverage" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip cloud_p1" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["cloud_p1", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| if [[ ${{ steps.parse.outputs.COMMENT_TRIGGER_TYPE }} == "buildall" ]]; then |
| echo "COMMENT_TRIGGER_TYPE is buildall, trigger compile is enough, compile will trigger cloud_p1" && exit |
| fi |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_cloud_p1 }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "cloud_p1" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Trigger or Skip performance" |
| if: ${{ fromJSON(steps.parse.outputs.comment_trigger) && contains(fromJSON('["performance", "buildall"]'), steps.parse.outputs.COMMENT_TRIGGER_TYPE) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| set -x |
| trigger_or_skip_build \ |
| "${{ steps.changes.outputs.changed_performance }}" \ |
| "${{ steps.parse.outputs.PULL_REQUEST_NUM }}" \ |
| "${{ steps.parse.outputs.TARGET_BRANCH }}" \ |
| "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" \ |
| "performance" \ |
| "${{ steps.parse.outputs.COMMENT_REPEAT_TIMES }}" |
| |
| - name: "Skip buildall" |
| if: ${{ fromJSON(steps.parse.outputs.comment_skip) }} |
| run: | |
| source ./regression-test/pipeline/common/teamcity-utils.sh |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" feut |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" beut |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" compile |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" p0 |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" p1 |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" external |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" performance |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" cloud_p0 |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" cloud_p1 |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" cloudut |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" vault_p0 |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" nonConcurrent |
| skip_build "${{ steps.parse.outputs.COMMIT_ID_FROM_TRIGGER }}" check_coverage |