From 663237272239b992e138d70eeb474c5c98494268 Mon Sep 17 00:00:00 2001 From: Omer Preminger Date: Tue, 23 May 2023 12:37:12 -0400 Subject: [PATCH] remove scripts/should-e2e-run and "check-changes" in CircleCI cfg --- .circleci/config.yml | 24 ---------- scripts/should-e2e-run | 100 ----------------------------------------- 2 files changed, 124 deletions(-) delete mode 100755 scripts/should-e2e-run diff --git a/.circleci/config.yml b/.circleci/config.yml index 8740fc32c5..c42bcdb0a6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -53,28 +53,6 @@ commands: - run: name: Update submodules command: git submodule update --init - check-changes: - steps: - - run: - name: Check changes - command: |- - rc=0 - scripts/should-e2e-run "${CIRCLE_PROJECT_USERNAME}" "${CIRCLE_PROJECT_REPONAME}" "${CIRCLE_BRANCH}" "${CIRCLE_PULL_REQUEST}" || rc=$? - case $rc in - 0) - echo "Verifying critical changes" - ;; - - 1) - echo "No critical changes, skipping tests" - circleci step halt - ;; - - *) - echo "E: scripts/should-e2e-run returned with exit code $rc. Abort." - exit $rc - ;; - esac check-pkg-no-buildcfg: steps: - run: @@ -237,7 +215,6 @@ jobs: executor: ubuntu-machine steps: - checkout - - check-changes - go/install: version: << pipeline.parameters.go-version >> - stop-background-apt @@ -253,7 +230,6 @@ jobs: executor: ubuntu-machine-large steps: - checkout - - check-changes - go/install: version: << pipeline.parameters.go-version >> - stop-background-apt diff --git a/scripts/should-e2e-run b/scripts/should-e2e-run deleted file mode 100755 index fb30245a57..0000000000 --- a/scripts/should-e2e-run +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -set -e - -usage() { - cat <<-EOT - E: Invalid usage. Abort. - - Usage: - - $0 {github_username} {github_reponame} {github_branch} [github_pr_url] - - If a {github_pr_url} is provided, it's used to obtain additional - information like the target branch and the labels. Otherwise it - is assumed that the code is already merged and that only the - most recent commit should be examined. - EOT -} - -# Give the possibility to force E2E run -if ! test -z "${FORCE_E2E}" ; then - echo "FORCE_E2E set, forcing e2e tests." - exit 0 -fi - -# Skip e2e by default -require_e2e=false - -GITHUB_USERNAME=$1 -GITHUB_REPONAME=$2 -GITHUB_BRANCH=$3 -GITHUB_PR_URL=$4 - -if test -z "${GITHUB_USERNAME}" ; then - usage "$0" - exit 2 -elif test -z "${GITHUB_REPONAME}" ; then - usage "$0" - exit 2 -elif test -z "${GITHUB_BRANCH}" ; then - usage "$0" - exit 2 -fi - -if test -z "${GITHUB_PR_URL}" ; then - echo "Running directly against branch ${GITHUB_BRANCH}" - TARGET_BRANCH="${GITHUB_BRANCH}" - BASE_COMMIT="HEAD~" - # Assume E2E is required for all runs against a branch; below we - # constrain this to specific branches. - require_e2e=true -else - PR_NUMBER=$(echo "${GITHUB_PR_URL}" | sed -e 's,.*/,,') - - pull_info_file=$(mktemp) - trap "rm -f ${pull_info_file}" EXIT - - curl -s "https://api.github.com/repos/${GITHUB_USERNAME}/${GITHUB_REPONAME}/pulls/${PR_NUMBER}" > "${pull_info_file}" - - # Keep the matching lines instead of simply looking at the exit - # code for debugging purposes - E2E_LABELS=$(jq -r '.labels[].name' < "${pull_info_file}" | grep --line-regexp --fixed-strings ci:e2e || true) - - if test -n "${E2E_LABELS}" ; then - echo "Honoring request to run E2E tests from pull request labels" - exit 0 - fi - - TARGET_BRANCH=$(jq -r .base.ref < "${pull_info_file}") - BASE_COMMIT="origin/${TARGET_BRANCH}" -fi - -case "${TARGET_BRANCH}" in - main) - if git --no-pager diff --name-only HEAD "${BASE_COMMIT}" | - grep -q -E -f .ci/e2e_triggers - then - # There are changes in critical components, require e2e - require_e2e=true - fi - ;; - - release-*) - # Require E2E for all changes going into a release branch - require_e2e=true - ;; - - *) - # The branch is not main or release, skip e2e - require_e2e=false - ;; -esac - -if ${require_e2e} ; then - echo "Critical changes detected." - exit 0 -else - echo "No critical changes detected." - exit 1 -fi