Skip to content

fix(plugin): evaluate clock-based time conditions without request values #21390

fix(plugin): evaluate clock-based time conditions without request values

fix(plugin): evaluate clock-based time conditions without request values #21390

Workflow file for this run

# 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: it
on:
workflow_dispatch:
inputs:
case:
description: 'Integration case (all preserves the complete matrix).'
type: choice
default: all
options:
- all
- shenyu-integrated-test-http
pull_request:
push:
branches:
- master
paths-ignore:
- '*.md'
- '**/README*.md'
- 'docs/**'
- '**/docs/**'
- '.github/ISSUE_TEMPLATE/**'
- '.github/PULL_REQUEST_TEMPLATE.md'
concurrency:
# Give every non-PR run its own group, including runs still waiting for a runner.
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
changes:
if: github.repository == 'apache/shenyu'
runs-on: ubuntu-latest
outputs:
integration: ${{ steps.filter.outputs.integration }}
run_integration: ${{ steps.cases.outputs.run_integration }}
integration_matrix: ${{ steps.cases.outputs.integration_matrix }}
steps:
- uses: actions/checkout@v4
- uses: ./actions/paths-filter
id: filter
with:
list-files: "json"
predicate-quantifier: every
filters: |
integration:
- '{shenyu-integrated-test/**,shenyu-*/**,db/**,pom.xml,**/pom.xml,shenyu-examples/**,.github/workflows/integrated-test.yml,.github/scripts/**,actions/**,mvnw,mvnw.cmd,.mvn/**}'
- '!.asf.yaml'
- '!.gitignore'
- '!.licenserc.yaml'
- '!LICENSE'
- '!NOTICE'
- '!.github/ISSUE_TEMPLATE/**'
- '!*.md'
- '!**/README*.md'
- '!docs/**'
- '!**/docs/**'
- '!.github/PULL_REQUEST_TEMPLATE.md'
- name: Resolve integrated test cases
id: cases
if: steps.filter.outputs.integration == 'true' || github.event_name == 'workflow_dispatch'
env:
CHANGED_FILES_JSON: ${{ github.event_name == 'workflow_dispatch' && '["pom.xml"]' || steps.filter.outputs.integration_files }}
CI_CASE_MODE: integration
REQUESTED_CASE: ${{ inputs.case }}
run: |
bash .github/scripts/resolve-test-case-matrix.sh
if [[ "$REQUESTED_CASE" != "all" && -n "$REQUESTED_CASE" ]]; then
echo "integration_matrix=$(jq -cn --arg case "$REQUESTED_CASE" '{include: [{case: $case}]}')" >> "$GITHUB_OUTPUT"
fi
build:
needs: changes
strategy:
matrix: ${{ fromJSON(needs.changes.outputs.integration_matrix || '{"include":[]}') }}
runs-on: ubuntu-latest
if: github.repository == 'apache/shenyu' && needs.changes.outputs.run_integration == 'true'
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Free disk space
run: bash .github/scripts/free-disk-space.sh
- uses: ./actions/setup-java-with-retry
with:
java-version: 17
distribution: "temurin"
cache: "maven"
cache-dependency-path: |
**/pom.xml
- name: Ensure Maven wrapper JAR
shell: bash
run: bash .github/scripts/ensure-maven-wrapper.sh
- name: Build with Maven
shell: bash
run: |
exec bash .github/scripts/maven-with-retry.sh ./mvnw -B -T 1C clean install -Prelease,docker -Dmaven.javadoc.skip=true -Dmaven.test.skip=true
- name: Resolve required example projects
id: examples
env:
INTEGRATION_CASE: ${{ matrix.case }}
run: echo "projects=$(python3 .github/scripts/resolve-example-projects.py "$INTEGRATION_CASE")" >> "$GITHUB_OUTPUT"
- name: Build examples
shell: bash
run: |
exec bash .github/scripts/maven-with-retry.sh ./mvnw -B -T 1C clean install -Pexample -Dmaven.javadoc.skip=true -Dmaven.test.skip=true -pl "${{ steps.examples.outputs.projects }}" -am -f ./shenyu-examples/pom.xml
- name: Build integrated tests
shell: bash
run: |
exec bash .github/scripts/maven-with-retry.sh ./mvnw -B -ntp -T 1C clean install -Pit -Dmaven.test.skip=true \
-pl :${{ matrix.case }} -am -f ./shenyu-integrated-test/pom.xml
- name: Verify integrated test image
run: docker image inspect apache/${{ matrix.case }}:latest --format '{{.Id}}'
- name: Start docker compose
run: |
if ! docker compose -f ./shenyu-integrated-test/${{ matrix.case }}/docker-compose.yml up -d; then
docker compose -f ./shenyu-integrated-test/${{ matrix.case }}/docker-compose.yml ps --all || true
docker compose -f ./shenyu-integrated-test/${{ matrix.case }}/docker-compose.yml logs --no-color --tail=200 || true
exit 1
fi
- name: Wait for docker compose start up completely
run: bash ./shenyu-integrated-test/${{ matrix.case }}/script/healthcheck.sh
- name: Disk space info
run: |
df --human-readable
- name: Run test
id: test
shell: bash
run: |
exec bash .github/scripts/maven-with-retry.sh ./mvnw -B -ntp -T 1C test -Pit -DfailIfNoTests=true \
-f ./shenyu-integrated-test/${{ matrix.case }}/pom.xml
continue-on-error: true
- name: Retry combination tests after a transient gRPC bind conflict
id: retry-combination
if: steps.test.outcome == 'failure' && matrix.case == 'shenyu-integrated-test-combination'
shell: bash
run: |
compose_file="./shenyu-integrated-test/${{ matrix.case }}/docker-compose.yml"
if ! docker compose -f "$compose_file" logs shenyu-examples-grpc 2>&1 | grep -Fq 'bind(..) failed: Address already in use'; then
echo "No transient gRPC bind conflict was recorded; keeping the original test failure."
exit 1
fi
docker compose -f "$compose_file" restart shenyu-examples-grpc
for attempt in $(seq 1 30); do
if docker compose -f "$compose_file" logs shenyu-examples-grpc 2>&1 | grep -Fq 'Grpc server started successfully'; then
break
fi
sleep 2
done
if ! docker compose -f "$compose_file" logs shenyu-examples-grpc 2>&1 | grep -Fq 'Grpc server started successfully'; then
echo "The gRPC example did not start after restarting its container."
exit 1
fi
exec bash .github/scripts/maven-with-retry.sh ./mvnw -B -ntp -T 1C test -Pit -DfailIfNoTests=true \
-f ./shenyu-integrated-test/${{ matrix.case }}/pom.xml
- name: Check test result
run: |
docker compose -f ./shenyu-integrated-test/${{ matrix.case }}/docker-compose.yml logs --tail="all"
if [[ ${{steps.test.outcome}} == "failure" && ${{steps.retry-combination.outcome}} != "success" ]]; then
echo "Test Failed"
exit 1
else
echo "Test Successful"
exit 0
fi