This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit a8925f1bcbcaa2c8a59df229398f38888a3a5d0b Author: phantomjinx <[email protected]> AuthorDate: Wed Jan 26 10:16:14 2022 +0000 Only show problematic report when skip is turned on * If skip-problematic is not set then insert a brief log entry instead * Adds ability to skip-problematic and other inputs to manual executions of upstream test workflows --- .../kamel-report-problematic/report-problematic.sh | 20 +++--- .github/workflows/builder.yml | 20 ++++++ .github/workflows/knative.yml | 20 ++++++ .github/workflows/kubernetes.yml | 23 +++++++ .../manual-exec-process-inputs.sh} | 71 ++++++++++------------ .github/workflows/upgrade.yml | 20 ++++++ 6 files changed, 127 insertions(+), 47 deletions(-) diff --git a/.github/actions/kamel-report-problematic/report-problematic.sh b/.github/actions/kamel-report-problematic/report-problematic.sh index a745c38..53f8837 100755 --- a/.github/actions/kamel-report-problematic/report-problematic.sh +++ b/.github/actions/kamel-report-problematic/report-problematic.sh @@ -72,13 +72,17 @@ do done < <(find "${TEST_DIR}" -name "*.go" -print0) -if [ ${#PROBLEMATIC[*]} -gt 0 ]; then - echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ===" - for prob in "${PROBLEMATIC[@]}" - do - echo " ${prob}" - done - echo "===" +if [ "${CAMEL_K_TEST_SKIP_PROBLEMATIC}" == "true" ]; then + if [ ${#PROBLEMATIC[*]} -gt 0 ]; then + echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ===" + for prob in "${PROBLEMATIC[@]}" + do + echo " ${prob}" + done + echo "===" + else + echo "=== No Tests marked as Problematic ===" + fi else - echo "=== No Tests marked as Problematic ===" + echo "=== All tests to be executed, including those marked as problematic (${#PROBLEMATIC[*]}) ===" fi diff --git a/.github/workflows/builder.yml b/.github/workflows/builder.yml index de177a6..1c9e5f8 100644 --- a/.github/workflows/builder.yml +++ b/.github/workflows/builder.yml @@ -44,6 +44,18 @@ on: - 'NOTICE' workflow_dispatch: inputs: + pre-built-kamel-image: + description: 'Kamel image url for skipping building of kamel stages. Used for debugging' + required: false + skip-problematic: + description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)' + required: false + default: false + test-filters: + description: | + Filter the tests in this test suite by assigning the test pattern to TEST_KNATIVE_RUN, + eg. TEST_KNATIVE_RUN=TestBasic will only run tests prefixed with 'TestBasic' + required: false concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -64,6 +76,14 @@ jobs: persist-credentials: false submodules: recursive + - name: Convert input parameters to env vars + shell: bash + run: | + ./.github/workflows/manual-exec-process-inputs.sh \ + -i "${{ github.event.inputs.pre-built-kamel-image }}" \ + -p "${{ github.event.inputs.skip-problematic }}" \ + -t "${{ github.event.inputs.test-filters }}" + - name: Execute Builder Tests uses: ./.github/actions/e2e-builder with: diff --git a/.github/workflows/knative.yml b/.github/workflows/knative.yml index 717f1bc..0c3c5c5 100644 --- a/.github/workflows/knative.yml +++ b/.github/workflows/knative.yml @@ -44,6 +44,18 @@ on: - 'NOTICE' workflow_dispatch: inputs: + pre-built-kamel-image: + description: 'Kamel image url for skipping building of kamel stages. Used for debugging' + required: false + skip-problematic: + description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)' + required: false + default: false + test-filters: + description: | + Filter the tests in this test suite by assigning the test pattern to TEST_KNATIVE_RUN, + eg. TEST_KNATIVE_RUN=TestBasic will only run tests prefixed with 'TestBasic' + required: false concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -60,6 +72,14 @@ jobs: persist-credentials: false submodules: recursive + - name: Convert input parameters to env vars + shell: bash + run: | + ./.github/workflows/manual-exec-process-inputs.sh \ + -i "${{ github.event.inputs.pre-built-kamel-image }}" \ + -p "${{ github.event.inputs.skip-problematic }}" \ + -t "${{ github.event.inputs.test-filters }}" + - name: Execute KNative Tests uses: ./.github/actions/e2e-knative with: diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml index db6d8f4..b309a2a 100644 --- a/.github/workflows/kubernetes.yml +++ b/.github/workflows/kubernetes.yml @@ -44,6 +44,21 @@ on: - 'NOTICE' workflow_dispatch: inputs: + pre-built-kamel-image: + description: 'Kamel image url for skipping building of kamel stages. Used for debugging' + required: false + skip-problematic: + description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)' + required: false + default: false + test-filters: + description: | + List of comma-separated key/value pairs to filter the tests in this test suite: + TEST_INTEGRATION_COMMON_RUN, TEST_INTEGRATION_COMMON_BUILD_RUN, TEST_INTEGRATION_COMMON_CLI_RUN + TEST_INTEGRATION_COMMON_CONFIG_RUN, TEST_INTEGRATION_COMMON_LANG_RUN, TEST_INTEGRATION_COMMON_TRAITS_RUN + TEST_SERVICE_RUN, TEST_QUARKUS_RUN, TEST_KUSTOMIZE_RUN + eg. TEST_KUSTOMIZE_RUN=TestBasic will only run tests prefixed with 'TestBasic' + required: false concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -61,6 +76,14 @@ jobs: persist-credentials: false submodules: recursive + - name: Convert input parameters to env vars + shell: bash + run: | + ./.github/workflows/manual-exec-process-inputs.sh \ + -i "${{ github.event.inputs.pre-built-kamel-image }}" \ + -p "${{ github.event.inputs.skip-problematic }}" \ + -t "${{ github.event.inputs.test-filters }}" + - name: Execute Tests uses: ./.github/actions/e2e-kubernetes with: diff --git a/.github/actions/kamel-report-problematic/report-problematic.sh b/.github/workflows/manual-exec-process-inputs.sh similarity index 55% copy from .github/actions/kamel-report-problematic/report-problematic.sh copy to .github/workflows/manual-exec-process-inputs.sh index a745c38..186e268 100755 --- a/.github/actions/kamel-report-problematic/report-problematic.sh +++ b/.github/workflows/manual-exec-process-inputs.sh @@ -17,18 +17,26 @@ # limitations under the License. # --------------------------------------------------------------------------- -#### +set -e + # -# Find all test that are labelled as problematic +# Used to unit testing this script # -#### - -set -e +if [ -z "$GITHUB_ENV" ]; then + GITHUB_ENV="/tmp/GITHUB_ENV" + rm -f "${GITHUB_ENV}" +fi -while getopts ":t:" opt; do +while getopts ":i:p:t:" opt; do case "${opt}" in + i) + PRE_BUILT_IMAGE=${OPTARG} + ;; + p) + SKIP_PROBLEMATIC=${OPTARG} + ;; t) - TEST_SUITE=${OPTARG} + TEST_FILTERS=${OPTARG} ;; :) echo "ERROR: Option -$OPTARG requires an argument" @@ -42,43 +50,28 @@ while getopts ":t:" opt; do done shift $((OPTIND-1)) -if [ -z "${TEST_SUITE}" ]; then - echo "Error: ${0} -t <test-suite>" - exit 1 +if [ -n "${PRE_BUILT_IMAGE}" ]; then + echo "DEBUG_USE_EXISTING_IMAGE=${PRE_BUILT_IMAGE}" >> $GITHUB_ENV fi -TEST_DIR="./e2e/${TEST_SUITE}" - -if [ ! -d "${TEST_DIR}" ]; then - echo "No e2e directory available ... exiting" - exit 0 +# +# Avoid problematic tests only if parameter set to true +# +if [ "${SKIP_PROBLEMATIC}" == "true" ]; then + echo "CAMEL_K_TEST_SKIP_PROBLEMATIC=true" >> $GITHUB_ENV fi -PROBLEMATIC=() -while IFS= read -r -d '' f -do - - func="" - while IFS= read -r line - do - if [[ "${line}" =~ ^" * " ]]; then - continue - elif [[ "${line}" =~ ^func* ]]; then - func=$(echo "${line}" | sed -n "s/func \([a-zA-Z0-9]\+\).*/\1/p") - elif [[ "${line}" =~ CAMEL_K_TEST_SKIP_PROBLEMATIC ]]; then - PROBLEMATIC[${#PROBLEMATIC[*]}]="${f}::${func}" - fi - done < ${f} - -done < <(find "${TEST_DIR}" -name "*.go" -print0) +# +# Adds -run args to filter tests in test suites +# +if [ -n "${TEST_FILTERS}" ]; then + filters=($(echo ${TEST_FILTERS} | tr "," "\n")) -if [ ${#PROBLEMATIC[*]} -gt 0 ]; then - echo "=== Problematic Tests (${#PROBLEMATIC[*]}) ===" - for prob in "${PROBLEMATIC[@]}" + #Print the split string + for filter in "${filters[@]}" do - echo " ${prob}" + pair=($(echo ${filter} | tr "=" " ")) + echo "Adding run filter for ${pair[0]} tests" + echo "${pair[0]}=-run ${pair[1]}" >> $GITHUB_ENV done - echo "===" -else - echo "=== No Tests marked as Problematic ===" fi diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml index 5b62587..ce1dffa 100644 --- a/.github/workflows/upgrade.yml +++ b/.github/workflows/upgrade.yml @@ -44,6 +44,18 @@ on: - 'NOTICE' workflow_dispatch: inputs: + pre-built-kamel-image: + description: 'Kamel image url for skipping building of kamel stages. Used for debugging' + required: false + skip-problematic: + description: 'Whether tests marked as problematic should be skipped - false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)' + required: false + default: false + test-filters: + description: | + Filter the tests in this test suite by assigning the test pattern to TEST_UPGRADE_RUN, + eg. TEST_UPGRADE_RUN=TestBasic will only run tests prefixed with 'TestBasic' + required: false concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} @@ -60,6 +72,14 @@ jobs: persist-credentials: false submodules: recursive + - name: Convert input parameters to env vars + shell: bash + run: | + ./.github/workflows/manual-exec-process-inputs.sh \ + -i "${{ github.event.inputs.pre-built-kamel-image }}" \ + -p "${{ github.event.inputs.skip-problematic }}" \ + -t "${{ github.event.inputs.test-filters }}" + - name: Execute Upgrade Tests uses: ./.github/actions/e2e-upgrade with:
