From 94d8c5caa936ffeff912a89cce62d59dd4d70316 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 1 Dec 2025 15:13:56 +0100 Subject: [PATCH 1/7] ci: github actions --- .github/workflows/integration-tests.yml | 74 +++++++++++++ .../workflows/secure-integration-tests.yml | 104 ++++++++++++++++++ 2 files changed, 178 insertions(+) create mode 100644 .github/workflows/integration-tests.yml create mode 100644 .github/workflows/secure-integration-tests.yml diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 000000000..dbd2b2ad8 --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,74 @@ +name: Integration Tests + +on: + push: + branches: + - main + - "[0-9]+.[0-9]+" + pull_request: + branches: + - main + - "[0-9]+.[0-9]+" + workflow_dispatch: + +jobs: + integration-tests: + name: Integration Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + elastic_stack_version: + - "7.current" + - "8.previous" + - "8.current" + - "9.current" + snapshot: [false, true] + include: + - elastic_stack_version: "main" + snapshot: true + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up environment variables + run: | + echo "INTEGRATION=true" >> $GITHUB_ENV + echo "LOG_LEVEL=info" >> $GITHUB_ENV + echo "ELASTIC_STACK_VERSION=${{ matrix.elastic_stack_version }}" >> $GITHUB_ENV + if [ "${{ matrix.snapshot }}" = "true" ]; then + echo "SNAPSHOT=true" >> $GITHUB_ENV + fi + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run docker-setup.sh + id: docker_setup + run: | + set -e + bash .ci/docker-setup.sh + continue-on-error: true + + - name: Check if test should be skipped + id: check_skip + if: steps.docker_setup.outcome == 'failure' + run: | + if [ ${{ steps.docker_setup.outputs.exit_code }} -eq 99 ]; then + echo "skip=true" >> $GITHUB_OUTPUT + echo "Test skipped - Docker image not available for this configuration" + else + exit 1 + fi + + - name: Run integration tests + if: steps.check_skip.outputs.skip != 'true' + run: | + bash .ci/docker-run.sh + + - name: Cleanup + if: always() + run: | + cd .ci + docker compose down -v || true diff --git a/.github/workflows/secure-integration-tests.yml b/.github/workflows/secure-integration-tests.yml new file mode 100644 index 000000000..eb8c58e41 --- /dev/null +++ b/.github/workflows/secure-integration-tests.yml @@ -0,0 +1,104 @@ +name: Secure Integration Tests + +on: + push: + branches: + - main + - "[0-9]+.[0-9]+" + pull_request: + branches: + - main + - "[0-9]+.[0-9]+" + workflow_dispatch: + +jobs: + secure-integration-tests: + name: Secure Integration Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} ${{ matrix.es_ssl_key_invalid && '(Invalid SSL)' || '' }} ${{ matrix.es_ssl_supported_protocols && format('({0})', matrix.es_ssl_supported_protocols) || '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + # Regular secure integration tests + - elastic_stack_version: "7.current" + snapshot: false + - elastic_stack_version: "8.current" + snapshot: false + - elastic_stack_version: "9.current" + snapshot: false + + # SSL configuration tests for 8.current + - elastic_stack_version: "8.current" + snapshot: false + es_ssl_key_invalid: true + - elastic_stack_version: "8.current" + snapshot: false + es_ssl_supported_protocols: "TLSv1.3" + + # SSL configuration tests for 9.current + - elastic_stack_version: "9.current" + snapshot: false + es_ssl_key_invalid: true + - elastic_stack_version: "9.current" + snapshot: false + es_ssl_supported_protocols: "TLSv1.3" + + # Snapshot tests + - elastic_stack_version: "8.current" + snapshot: true + - elastic_stack_version: "9.current" + snapshot: true + - elastic_stack_version: "main" + snapshot: true + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up environment variables + run: | + echo "SECURE_INTEGRATION=true" >> $GITHUB_ENV + echo "INTEGRATION=true" >> $GITHUB_ENV + echo "LOG_LEVEL=info" >> $GITHUB_ENV + echo "ELASTIC_STACK_VERSION=${{ matrix.elastic_stack_version }}" >> $GITHUB_ENV + if [ "${{ matrix.snapshot }}" = "true" ]; then + echo "SNAPSHOT=true" >> $GITHUB_ENV + fi + if [ "${{ matrix.es_ssl_key_invalid }}" = "true" ]; then + echo "ES_SSL_KEY_INVALID=true" >> $GITHUB_ENV + fi + if [ -n "${{ matrix.es_ssl_supported_protocols }}" ]; then + echo "ES_SSL_SUPPORTED_PROTOCOLS=${{ matrix.es_ssl_supported_protocols }}" >> $GITHUB_ENV + fi + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run docker-setup.sh + id: docker_setup + run: | + set -e + bash .ci/docker-setup.sh + continue-on-error: true + + - name: Check if test should be skipped + id: check_skip + if: steps.docker_setup.outcome == 'failure' + run: | + if [ ${{ steps.docker_setup.outputs.exit_code }} -eq 99 ]; then + echo "skip=true" >> $GITHUB_OUTPUT + echo "Test skipped - Docker image not available for this configuration" + else + exit 1 + fi + + - name: Run secure integration tests + if: steps.check_skip.outputs.skip != 'true' + run: | + bash .ci/docker-run.sh + + - name: Cleanup + if: always() + run: | + cd .ci + docker compose down -v || true From 8059a1ad1168b45a88192963781f0b30e2d619c7 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 1 Dec 2025 15:22:14 +0100 Subject: [PATCH 2/7] refactor --- .github/actions/setup/action.yml | 86 +++++++++++++++++ .github/workflows/integration-tests.yml | 54 +++-------- .../workflows/secure-integration-tests.yml | 96 ++++--------------- 3 files changed, 114 insertions(+), 122 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 000000000..dc4bc95dc --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,86 @@ +name: 'Setup Integration Test Environment' +description: 'Common setup steps for integration and secure integration tests' + +inputs: + elastic_stack_version: + description: 'Elasticsearch stack version to test against' + required: true + snapshot: + description: 'Whether to use snapshot version' + required: false + default: 'false' + secure_integration: + description: 'Enable secure integration testing' + required: false + default: 'false' + es_ssl_key_invalid: + description: 'Use invalid SSL key for testing' + required: false + default: 'false' + es_ssl_supported_protocols: + description: 'SSL/TLS protocols to test' + required: false + default: '' + +outputs: + skip: + description: 'Whether the test should be skipped' + value: ${{ steps.check_skip.outputs.skip }} + +runs: + using: 'composite' + steps: + - name: Set up environment variables + shell: bash + env: + ELASTIC_STACK_VERSION: ${{ inputs.elastic_stack_version }} + SNAPSHOT: ${{ inputs.snapshot }} + SECURE_INTEGRATION: ${{ inputs.secure_integration }} + ES_SSL_KEY_INVALID: ${{ inputs.es_ssl_key_invalid }} + ES_SSL_SUPPORTED_PROTOCOLS: ${{ inputs.es_ssl_supported_protocols }} + run: | + echo "INTEGRATION=true" >> $GITHUB_ENV + echo "LOG_LEVEL=info" >> $GITHUB_ENV + echo "ELASTIC_STACK_VERSION=${ELASTIC_STACK_VERSION}" >> $GITHUB_ENV + + if [ "${SNAPSHOT}" = "true" ]; then + echo "SNAPSHOT=true" >> $GITHUB_ENV + fi + + if [ "${SECURE_INTEGRATION}" = "true" ]; then + echo "SECURE_INTEGRATION=true" >> $GITHUB_ENV + fi + + if [ "${ES_SSL_KEY_INVALID}" = "true" ]; then + echo "ES_SSL_KEY_INVALID=true" >> $GITHUB_ENV + fi + + if [ -n "${ES_SSL_SUPPORTED_PROTOCOLS}" ]; then + echo "ES_SSL_SUPPORTED_PROTOCOLS=${ES_SSL_SUPPORTED_PROTOCOLS}" >> $GITHUB_ENV + fi + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Run docker-setup.sh + id: docker_setup + shell: bash + run: | + set -e + cd .ci + wget -q https://raw.githubusercontent.com/elastic/logstash/main/.ci/docker-setup.sh -O .ci/docker-setup.shhttps://raw.githubusercontent.com/logstash-plugins/.ci/refs/heads/1.x/docker-setup.sh || exit 1 + chmod 755 docker-setup.sh + bash .ci/docker-setup.sh + continue-on-error: true + + - name: Check if test should be skipped + id: check_skip + if: steps.docker_setup.outcome == 'failure' + shell: bash + run: | + if [ ${{ steps.docker_setup.outputs.exit_code }} -eq 99 ]; then + echo "skip=true" >> $GITHUB_OUTPUT + echo "Test skipped - Docker image not available for this configuration" + else + exit 1 + fi diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index dbd2b2ad8..cf52d86e9 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -2,13 +2,9 @@ name: Integration Tests on: push: - branches: - - main - - "[0-9]+.[0-9]+" pull_request: branches: - main - - "[0-9]+.[0-9]+" workflow_dispatch: jobs: @@ -27,48 +23,20 @@ jobs: include: - elastic_stack_version: "main" snapshot: true - + steps: - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up environment variables - run: | - echo "INTEGRATION=true" >> $GITHUB_ENV - echo "LOG_LEVEL=info" >> $GITHUB_ENV - echo "ELASTIC_STACK_VERSION=${{ matrix.elastic_stack_version }}" >> $GITHUB_ENV - if [ "${{ matrix.snapshot }}" = "true" ]; then - echo "SNAPSHOT=true" >> $GITHUB_ENV - fi - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run docker-setup.sh - id: docker_setup - run: | - set -e - bash .ci/docker-setup.sh - continue-on-error: true + uses: actions/checkout@v6 - - name: Check if test should be skipped - id: check_skip - if: steps.docker_setup.outcome == 'failure' - run: | - if [ ${{ steps.docker_setup.outputs.exit_code }} -eq 99 ]; then - echo "skip=true" >> $GITHUB_OUTPUT - echo "Test skipped - Docker image not available for this configuration" - else - exit 1 - fi + - name: Setup test environment + id: setup + uses: ./.github/actions/setup + with: + elastic_stack_version: ${{ matrix.elastic_stack_version }} + snapshot: ${{ matrix.snapshot }} - name: Run integration tests - if: steps.check_skip.outputs.skip != 'true' - run: | - bash .ci/docker-run.sh + if: steps.setup.outputs.skip != 'true' + run: .ci/docker-run.sh - - name: Cleanup - if: always() - run: | - cd .ci - docker compose down -v || true + # NOTE: no cleanup needed when running on ephemeral runners diff --git a/.github/workflows/secure-integration-tests.yml b/.github/workflows/secure-integration-tests.yml index eb8c58e41..e7ba25339 100644 --- a/.github/workflows/secure-integration-tests.yml +++ b/.github/workflows/secure-integration-tests.yml @@ -2,103 +2,41 @@ name: Secure Integration Tests on: push: - branches: - - main - - "[0-9]+.[0-9]+" pull_request: branches: - main - - "[0-9]+.[0-9]+" workflow_dispatch: jobs: secure-integration-tests: - name: Secure Integration Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} ${{ matrix.es_ssl_key_invalid && '(Invalid SSL)' || '' }} ${{ matrix.es_ssl_supported_protocols && format('({0})', matrix.es_ssl_supported_protocols) || '' }} + name: Secure Integration Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: + elastic_stack_version: + - "7.current" + - "8.current" + - "9.current" + snapshot: [false, true] include: - # Regular secure integration tests - - elastic_stack_version: "7.current" - snapshot: false - - elastic_stack_version: "8.current" - snapshot: false - - elastic_stack_version: "9.current" - snapshot: false - - # SSL configuration tests for 8.current - - elastic_stack_version: "8.current" - snapshot: false - es_ssl_key_invalid: true - - elastic_stack_version: "8.current" - snapshot: false - es_ssl_supported_protocols: "TLSv1.3" - - # SSL configuration tests for 9.current - - elastic_stack_version: "9.current" - snapshot: false - es_ssl_key_invalid: true - - elastic_stack_version: "9.current" - snapshot: false - es_ssl_supported_protocols: "TLSv1.3" - - # Snapshot tests - - elastic_stack_version: "8.current" - snapshot: true - - elastic_stack_version: "9.current" - snapshot: true - elastic_stack_version: "main" snapshot: true steps: - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up environment variables - run: | - echo "SECURE_INTEGRATION=true" >> $GITHUB_ENV - echo "INTEGRATION=true" >> $GITHUB_ENV - echo "LOG_LEVEL=info" >> $GITHUB_ENV - echo "ELASTIC_STACK_VERSION=${{ matrix.elastic_stack_version }}" >> $GITHUB_ENV - if [ "${{ matrix.snapshot }}" = "true" ]; then - echo "SNAPSHOT=true" >> $GITHUB_ENV - fi - if [ "${{ matrix.es_ssl_key_invalid }}" = "true" ]; then - echo "ES_SSL_KEY_INVALID=true" >> $GITHUB_ENV - fi - if [ -n "${{ matrix.es_ssl_supported_protocols }}" ]; then - echo "ES_SSL_SUPPORTED_PROTOCOLS=${{ matrix.es_ssl_supported_protocols }}" >> $GITHUB_ENV - fi - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Run docker-setup.sh - id: docker_setup - run: | - set -e - bash .ci/docker-setup.sh - continue-on-error: true + uses: actions/checkout@v6 - - name: Check if test should be skipped - id: check_skip - if: steps.docker_setup.outcome == 'failure' - run: | - if [ ${{ steps.docker_setup.outputs.exit_code }} -eq 99 ]; then - echo "skip=true" >> $GITHUB_OUTPUT - echo "Test skipped - Docker image not available for this configuration" - else - exit 1 - fi + - name: Setup test environment + id: setup + uses: ./.github/actions/setup + with: + elastic_stack_version: ${{ matrix.elastic_stack_version }} + snapshot: ${{ matrix.snapshot }} + secure_integration: true - name: Run secure integration tests - if: steps.check_skip.outputs.skip != 'true' - run: | - bash .ci/docker-run.sh + if: steps.setup.outputs.skip != 'true' + run: .ci/docker-run.sh - - name: Cleanup - if: always() - run: | - cd .ci - docker compose down -v || true + # NOTE: no cleanup needed when running on ephemeral runners From 6ab0c51e280a5e813665ee17881236a89e157858 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Mon, 1 Dec 2025 15:30:18 +0100 Subject: [PATCH 3/7] add unit-tests --- .github/actions/setup/action.yml | 45 +++++++++++---- .github/workflows/integration-tests.yml | 4 +- .../workflows/secure-integration-tests.yml | 3 +- .github/workflows/unit-tests.yml | 55 +++++++++++++++++++ 4 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/unit-tests.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index dc4bc95dc..e056b9bca 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,5 +1,5 @@ -name: 'Setup Integration Test Environment' -description: 'Common setup steps for integration and secure integration tests' +name: 'Setup Test Environment' +description: 'Common setup steps for unit, integration and secure integration tests' inputs: elastic_stack_version: @@ -9,6 +9,14 @@ inputs: description: 'Whether to use snapshot version' required: false default: 'false' + docker_env: + description: 'Docker environment file (e.g., dockerjdk21.env)' + required: false + default: '' + integration: + description: 'Enable integration testing' + required: false + default: 'false' secure_integration: description: 'Enable secure integration testing' required: false @@ -35,26 +43,35 @@ runs: env: ELASTIC_STACK_VERSION: ${{ inputs.elastic_stack_version }} SNAPSHOT: ${{ inputs.snapshot }} + DOCKER_ENV: ${{ inputs.docker_env }} + INTEGRATION: ${{ inputs.integration }} SECURE_INTEGRATION: ${{ inputs.secure_integration }} ES_SSL_KEY_INVALID: ${{ inputs.es_ssl_key_invalid }} ES_SSL_SUPPORTED_PROTOCOLS: ${{ inputs.es_ssl_supported_protocols }} run: | - echo "INTEGRATION=true" >> $GITHUB_ENV echo "LOG_LEVEL=info" >> $GITHUB_ENV echo "ELASTIC_STACK_VERSION=${ELASTIC_STACK_VERSION}" >> $GITHUB_ENV if [ "${SNAPSHOT}" = "true" ]; then echo "SNAPSHOT=true" >> $GITHUB_ENV fi - + + if [ -n "${DOCKER_ENV}" ]; then + echo "DOCKER_ENV=${DOCKER_ENV}" >> $GITHUB_ENV + fi + + if [ "${INTEGRATION}" = "true" ]; then + echo "INTEGRATION=true" >> $GITHUB_ENV + fi + if [ "${SECURE_INTEGRATION}" = "true" ]; then echo "SECURE_INTEGRATION=true" >> $GITHUB_ENV fi - + if [ "${ES_SSL_KEY_INVALID}" = "true" ]; then echo "ES_SSL_KEY_INVALID=true" >> $GITHUB_ENV fi - + if [ -n "${ES_SSL_SUPPORTED_PROTOCOLS}" ]; then echo "ES_SSL_SUPPORTED_PROTOCOLS=${ES_SSL_SUPPORTED_PROTOCOLS}" >> $GITHUB_ENV fi @@ -62,15 +79,23 @@ runs: - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Bootstrap CI assets + shell: bash + run: | + mkdir -p .ci + curl -sL https://github.com/logstash-plugins/.ci/archive/1.x.tar.gz | \ + sh -c 'if tar --version 2>/dev/null | grep -q "GNU tar"; then + TAR_KEEP="--skip-old-files"; TAR_WILDCARDS="--wildcards"; + else + TAR_KEEP="-k"; TAR_WILDCARDS=""; + fi; tar -xzvf - $TAR_KEEP --strip-components=1 -C .ci $TAR_WILDCARDS "*Dockerfile*" "*docker*" "*.sh" "*logstash-versions*"' + - name: Run docker-setup.sh id: docker_setup shell: bash run: | - set -e - cd .ci - wget -q https://raw.githubusercontent.com/elastic/logstash/main/.ci/docker-setup.sh -O .ci/docker-setup.shhttps://raw.githubusercontent.com/logstash-plugins/.ci/refs/heads/1.x/docker-setup.sh || exit 1 - chmod 755 docker-setup.sh bash .ci/docker-setup.sh + echo "exit_code=$?" >> $GITHUB_OUTPUT continue-on-error: true - name: Check if test should be skipped diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cf52d86e9..34a7dec60 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -34,9 +34,11 @@ jobs: with: elastic_stack_version: ${{ matrix.elastic_stack_version }} snapshot: ${{ matrix.snapshot }} + integration: true - name: Run integration tests if: steps.setup.outputs.skip != 'true' - run: .ci/docker-run.sh + run: | + bash .ci/docker-run.sh # NOTE: no cleanup needed when running on ephemeral runners diff --git a/.github/workflows/secure-integration-tests.yml b/.github/workflows/secure-integration-tests.yml index e7ba25339..d0dcc4db8 100644 --- a/.github/workflows/secure-integration-tests.yml +++ b/.github/workflows/secure-integration-tests.yml @@ -37,6 +37,7 @@ jobs: - name: Run secure integration tests if: steps.setup.outputs.skip != 'true' - run: .ci/docker-run.sh + run: | + bash .ci/docker-run.sh # NOTE: no cleanup needed when running on ephemeral runners diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml new file mode 100644 index 000000000..3aab033ea --- /dev/null +++ b/.github/workflows/unit-tests.yml @@ -0,0 +1,55 @@ +name: Unit Tests + +on: + push: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + unit-tests: + name: Unit Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + elastic_stack_version: + - "9.current" + - "9.previous" + - "8.current" + - "8.previous" + - "7.current" + docker_env: ["dockerjdk21.env"] + snapshot: [false] + exclude: + # 7.x doesn't support JDK 21, use default JDK + - elastic_stack_version: "7.current" + docker_env: "dockerjdk21.env" + include: + # 7.current with default JDK + - elastic_stack_version: "7.current" + docker_env: "" + snapshot: false + # Main snapshot with JDK 21 + - elastic_stack_version: "main" + docker_env: "dockerjdk21.env" + snapshot: true + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Setup test environment + id: setup + uses: ./.github/actions/setup + with: + elastic_stack_version: ${{ matrix.elastic_stack_version }} + snapshot: ${{ matrix.snapshot || false }} + docker_env: ${{ matrix.docker_env || '' }} + + - name: Run unit tests + if: steps.setup.outputs.skip != 'true' + run: bash .ci/docker-run.sh + + # NOTE: no cleanup needed when running on ephemeral runners From 89496d3290aaee57e4a83f980553e8eda317c5b2 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 10 Dec 2025 15:07:34 +0100 Subject: [PATCH 4/7] refactor --- .github/actions/setup/action.yml | 111 ------------------ .github/workflows/integration-tests.yml | 10 +- .../workflows/secure-integration-tests.yml | 12 +- .github/workflows/unit-tests.yml | 24 ++-- 4 files changed, 23 insertions(+), 134 deletions(-) delete mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml deleted file mode 100644 index e056b9bca..000000000 --- a/.github/actions/setup/action.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: 'Setup Test Environment' -description: 'Common setup steps for unit, integration and secure integration tests' - -inputs: - elastic_stack_version: - description: 'Elasticsearch stack version to test against' - required: true - snapshot: - description: 'Whether to use snapshot version' - required: false - default: 'false' - docker_env: - description: 'Docker environment file (e.g., dockerjdk21.env)' - required: false - default: '' - integration: - description: 'Enable integration testing' - required: false - default: 'false' - secure_integration: - description: 'Enable secure integration testing' - required: false - default: 'false' - es_ssl_key_invalid: - description: 'Use invalid SSL key for testing' - required: false - default: 'false' - es_ssl_supported_protocols: - description: 'SSL/TLS protocols to test' - required: false - default: '' - -outputs: - skip: - description: 'Whether the test should be skipped' - value: ${{ steps.check_skip.outputs.skip }} - -runs: - using: 'composite' - steps: - - name: Set up environment variables - shell: bash - env: - ELASTIC_STACK_VERSION: ${{ inputs.elastic_stack_version }} - SNAPSHOT: ${{ inputs.snapshot }} - DOCKER_ENV: ${{ inputs.docker_env }} - INTEGRATION: ${{ inputs.integration }} - SECURE_INTEGRATION: ${{ inputs.secure_integration }} - ES_SSL_KEY_INVALID: ${{ inputs.es_ssl_key_invalid }} - ES_SSL_SUPPORTED_PROTOCOLS: ${{ inputs.es_ssl_supported_protocols }} - run: | - echo "LOG_LEVEL=info" >> $GITHUB_ENV - echo "ELASTIC_STACK_VERSION=${ELASTIC_STACK_VERSION}" >> $GITHUB_ENV - - if [ "${SNAPSHOT}" = "true" ]; then - echo "SNAPSHOT=true" >> $GITHUB_ENV - fi - - if [ -n "${DOCKER_ENV}" ]; then - echo "DOCKER_ENV=${DOCKER_ENV}" >> $GITHUB_ENV - fi - - if [ "${INTEGRATION}" = "true" ]; then - echo "INTEGRATION=true" >> $GITHUB_ENV - fi - - if [ "${SECURE_INTEGRATION}" = "true" ]; then - echo "SECURE_INTEGRATION=true" >> $GITHUB_ENV - fi - - if [ "${ES_SSL_KEY_INVALID}" = "true" ]; then - echo "ES_SSL_KEY_INVALID=true" >> $GITHUB_ENV - fi - - if [ -n "${ES_SSL_SUPPORTED_PROTOCOLS}" ]; then - echo "ES_SSL_SUPPORTED_PROTOCOLS=${ES_SSL_SUPPORTED_PROTOCOLS}" >> $GITHUB_ENV - fi - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Bootstrap CI assets - shell: bash - run: | - mkdir -p .ci - curl -sL https://github.com/logstash-plugins/.ci/archive/1.x.tar.gz | \ - sh -c 'if tar --version 2>/dev/null | grep -q "GNU tar"; then - TAR_KEEP="--skip-old-files"; TAR_WILDCARDS="--wildcards"; - else - TAR_KEEP="-k"; TAR_WILDCARDS=""; - fi; tar -xzvf - $TAR_KEEP --strip-components=1 -C .ci $TAR_WILDCARDS "*Dockerfile*" "*docker*" "*.sh" "*logstash-versions*"' - - - name: Run docker-setup.sh - id: docker_setup - shell: bash - run: | - bash .ci/docker-setup.sh - echo "exit_code=$?" >> $GITHUB_OUTPUT - continue-on-error: true - - - name: Check if test should be skipped - id: check_skip - if: steps.docker_setup.outcome == 'failure' - shell: bash - run: | - if [ ${{ steps.docker_setup.outputs.exit_code }} -eq 99 ]; then - echo "skip=true" >> $GITHUB_OUTPUT - echo "Test skipped - Docker image not available for this configuration" - else - exit 1 - fi diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 34a7dec60..5b0446d6b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -9,19 +9,19 @@ on: jobs: integration-tests: - name: Integration Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} + name: Integration Test - ES ${{ matrix.elastic-stack-version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - elastic_stack_version: + elastic-stack-version: - "7.current" - "8.previous" - "8.current" - "9.current" snapshot: [false, true] include: - - elastic_stack_version: "main" + - elastic-stack-version: "main" snapshot: true steps: @@ -30,9 +30,9 @@ jobs: - name: Setup test environment id: setup - uses: ./.github/actions/setup + uses: logstash-plugins/.ci/setup@feature/github-actions with: - elastic_stack_version: ${{ matrix.elastic_stack_version }} + elastic-stack-version: ${{ matrix.elastic-stack-version }} snapshot: ${{ matrix.snapshot }} integration: true diff --git a/.github/workflows/secure-integration-tests.yml b/.github/workflows/secure-integration-tests.yml index d0dcc4db8..50cb40bf8 100644 --- a/.github/workflows/secure-integration-tests.yml +++ b/.github/workflows/secure-integration-tests.yml @@ -9,18 +9,18 @@ on: jobs: secure-integration-tests: - name: Secure Integration Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} + name: Secure Integration Test - ES ${{ matrix.elastic-stack-version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - elastic_stack_version: + elastic-stack-version: - "7.current" - "8.current" - "9.current" snapshot: [false, true] include: - - elastic_stack_version: "main" + - elastic-stack-version: "main" snapshot: true steps: @@ -29,11 +29,11 @@ jobs: - name: Setup test environment id: setup - uses: ./.github/actions/setup + uses: logstash-plugins/.ci/setup@feature/github-actions with: - elastic_stack_version: ${{ matrix.elastic_stack_version }} + elastic-stack-version: ${{ matrix.elastic-stack-version }} snapshot: ${{ matrix.snapshot }} - secure_integration: true + secure-integration: true - name: Run secure integration tests if: steps.setup.outputs.skip != 'true' diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 3aab033ea..0e655a9c9 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -9,31 +9,31 @@ on: jobs: unit-tests: - name: Unit Test - ES ${{ matrix.elastic_stack_version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} + name: Unit Test - ES ${{ matrix.elastic-stack-version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: - elastic_stack_version: + elastic-stack-version: - "9.current" - "9.previous" - "8.current" - "8.previous" - "7.current" - docker_env: ["dockerjdk21.env"] + docker-env: ["dockerjdk21.env"] snapshot: [false] exclude: # 7.x doesn't support JDK 21, use default JDK - - elastic_stack_version: "7.current" - docker_env: "dockerjdk21.env" + - elastic-stack-version: "7.current" + docker-env: "dockerjdk21.env" include: # 7.current with default JDK - - elastic_stack_version: "7.current" - docker_env: "" + - elastic-stack-version: "7.current" + docker-env: "" snapshot: false # Main snapshot with JDK 21 - - elastic_stack_version: "main" - docker_env: "dockerjdk21.env" + - elastic-stack-version: "main" + docker-env: "dockerjdk21.env" snapshot: true steps: @@ -42,11 +42,11 @@ jobs: - name: Setup test environment id: setup - uses: ./.github/actions/setup + uses: logstash-plugins/.ci/setup@feature/github-actions with: - elastic_stack_version: ${{ matrix.elastic_stack_version }} + elastic-stack-version: ${{ matrix.elastic-stack-version }} snapshot: ${{ matrix.snapshot || false }} - docker_env: ${{ matrix.docker_env || '' }} + docker-env: ${{ matrix.docker-env || '' }} - name: Run unit tests if: steps.setup.outputs.skip != 'true' From f08d34a5650bcfb34b2dca4774081812e0144455 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 10 Dec 2025 15:56:59 +0100 Subject: [PATCH 5/7] refactor --- .github/workflows/unit-tests.yml | 49 +++----------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 0e655a9c9..228fb671a 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -8,48 +8,7 @@ on: workflow_dispatch: jobs: - unit-tests: - name: Unit Test - ES ${{ matrix.elastic-stack-version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - elastic-stack-version: - - "9.current" - - "9.previous" - - "8.current" - - "8.previous" - - "7.current" - docker-env: ["dockerjdk21.env"] - snapshot: [false] - exclude: - # 7.x doesn't support JDK 21, use default JDK - - elastic-stack-version: "7.current" - docker-env: "dockerjdk21.env" - include: - # 7.current with default JDK - - elastic-stack-version: "7.current" - docker-env: "" - snapshot: false - # Main snapshot with JDK 21 - - elastic-stack-version: "main" - docker-env: "dockerjdk21.env" - snapshot: true - - steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Setup test environment - id: setup - uses: logstash-plugins/.ci/setup@feature/github-actions - with: - elastic-stack-version: ${{ matrix.elastic-stack-version }} - snapshot: ${{ matrix.snapshot || false }} - docker-env: ${{ matrix.docker-env || '' }} - - - name: Run unit tests - if: steps.setup.outputs.skip != 'true' - run: bash .ci/docker-run.sh - - # NOTE: no cleanup needed when running on ephemeral runners + tests: + uses: logstash-plugins/.ci/.github/workflows/test.yml@feature/github-actions + permissions: + contents: read From e0f6ce2f9dd02e95a342a91cc1e45073544d719c Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 10 Dec 2025 15:57:30 +0100 Subject: [PATCH 6/7] refactor --- .github/workflows/{unit-tests.yml => tests.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{unit-tests.yml => tests.yml} (100%) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/tests.yml similarity index 100% rename from .github/workflows/unit-tests.yml rename to .github/workflows/tests.yml From 4aa0dcb6cb349ce0cd45d8dc857a6a1770effe71 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Wed, 10 Dec 2025 16:02:53 +0100 Subject: [PATCH 7/7] no concurrency and timeouts --- .github/workflows/integration-tests.yml | 10 ++++++++++ .github/workflows/secure-integration-tests.yml | 10 ++++++++++ .github/workflows/tests.yml | 9 +++++++++ 3 files changed, 29 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 5b0446d6b..b5787f34a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -7,10 +7,20 @@ on: - main workflow_dispatch: +## Concurrency only allowed in the main branch. +## So old builds running for old commits within the same Pull Request are cancelled +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +permissions: + contents: read + jobs: integration-tests: name: Integration Test - ES ${{ matrix.elastic-stack-version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} runs-on: ubuntu-latest + timeout-minutes: 60 strategy: fail-fast: false matrix: diff --git a/.github/workflows/secure-integration-tests.yml b/.github/workflows/secure-integration-tests.yml index 50cb40bf8..e805161e0 100644 --- a/.github/workflows/secure-integration-tests.yml +++ b/.github/workflows/secure-integration-tests.yml @@ -7,10 +7,20 @@ on: - main workflow_dispatch: +## Concurrency only allowed in the main branch. +## So old builds running for old commits within the same Pull Request are cancelled +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +permissions: + contents: read + jobs: secure-integration-tests: name: Secure Integration Test - ES ${{ matrix.elastic-stack-version }} ${{ matrix.snapshot && '(Snapshot)' || '' }} runs-on: ubuntu-latest + timeout-minutes: 60 strategy: fail-fast: false matrix: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 228fb671a..1d9b80667 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,15 @@ on: - main workflow_dispatch: +## Concurrency only allowed in the main branch. +## So old builds running for old commits within the same Pull Request are cancelled +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +permissions: + contents: read + jobs: tests: uses: logstash-plugins/.ci/.github/workflows/test.yml@feature/github-actions