From 99a22db90e8c7ff12ed65fff56fc8e1013940fbb Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Thu, 19 Sep 2024 10:37:42 +0200 Subject: [PATCH] [CI] Add support for running tests with stack 9.0.0 (#11138) Add support for 9.0 stack in Buildkite scripts as well as adding the steps required in daily and weekly pipelines to start testing packages with a local stack 9.0.0-SNAPSHOT. --- .buildkite/pipeline.schedule-daily.yml | 12 +++ .buildkite/pipeline.schedule-weekly.yml | 13 +++ .buildkite/pipeline.yml | 7 +- .buildkite/scripts/common.sh | 11 ++- ...ml => bump-latest-8x-snapshot-version.yml} | 4 +- .../bump-latest-9x-snapshot-version.yml | 84 +++++++++++++++++++ catalog-info.yaml | 2 +- docs/ci_pipelines.md | 33 ++++++-- 8 files changed, 154 insertions(+), 12 deletions(-) rename .github/workflows/updatecli/updatecli.d/{bump-latest-snapshot-version.yml => bump-latest-8x-snapshot-version.yml} (95%) create mode 100644 .github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml diff --git a/.buildkite/pipeline.schedule-daily.yml b/.buildkite/pipeline.schedule-daily.yml index 26d50b1ffc8..8d7822136b4 100644 --- a/.buildkite/pipeline.schedule-daily.yml +++ b/.buildkite/pipeline.schedule-daily.yml @@ -51,6 +51,18 @@ steps: - step: "check" allow_failure: false + - label: "Check integrations local stacks - Stack Version v9.0" + trigger: "integrations" + build: + env: + SERVERLESS: "false" + FORCE_CHECK_ALL: "true" + STACK_VERSION: 9.0.0-SNAPSHOT + PUBLISH_COVERAGE_REPORTS: "false" + depends_on: + - step: "check" + allow_failure: false + - label: "Check integrations in serverless - project: Observability" key: "trigger-integrations-serverless-obs" trigger: "integrations-serverless" diff --git a/.buildkite/pipeline.schedule-weekly.yml b/.buildkite/pipeline.schedule-weekly.yml index f936b0ff848..7fd4f0b63b5 100644 --- a/.buildkite/pipeline.schedule-weekly.yml +++ b/.buildkite/pipeline.schedule-weekly.yml @@ -27,3 +27,16 @@ steps: depends_on: - step: "check" allow_failure: false + + - label: "Check integrations local stacks and non-wolfi images for Elastic Agent - Stack Version v9.0" + trigger: "integrations" + build: + env: + SERVERLESS: "false" + FORCE_CHECK_ALL: "true" + STACK_VERSION: 9.0.0-SNAPSHOT + PUBLISH_COVERAGE_REPORTS: "false" + ELASTIC_PACKAGE_DISABLE_ELASTIC_AGENT_WOLFI: "true" + depends_on: + - step: "check" + allow_failure: false diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 96c1a8f6ded..a3dda8cc9da 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -102,5 +102,8 @@ steps: # not fail build if this step fails soft_fail: true # run this step when if it is triggered by the daily job - if: > - build.source == "trigger_job" && build.env('BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG') == "integrations-schedule-daily" + # skipped for now notification for tests related to STACK_VERSION: 9 + if: | + build.source == "trigger_job" && + build.env('BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG') == "integrations-schedule-daily" && + build.env('STACK_VERSION') !~ /^9/ diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh index a8b7edea4d2..f775dd7aabd 100755 --- a/.buildkite/scripts/common.sh +++ b/.buildkite/scripts/common.sh @@ -462,12 +462,19 @@ is_supported_stack() { if [ "${kibana_version}" == "null" ]; then return 0 fi - if [[ ! "${kibana_version}" =~ \^7\. && "${STACK_VERSION}" =~ ^7\. ]]; then + if [[ ( ! "${kibana_version}" =~ \^7\. ) && "${STACK_VERSION}" =~ ^7\. ]]; then return 1 fi - if [[ ! "${kibana_version}" =~ \^8\. && "${STACK_VERSION}" =~ ^8\. ]]; then + if [[ ( ! "${kibana_version}" =~ \^8\. ) && "${STACK_VERSION}" =~ ^8\. ]]; then return 1 fi + + # TODO: Allowed temporarily to test packages with stack version 9.0 if they have as constraint ^8.0 defined too. + # This workaround should be removed once packages have been updated their constraints for 9.0 stack. + if [[ ( ! ( "${kibana_version}" =~ \^9\. || "${kibana_version}" =~ \^8\. ) ) && "${STACK_VERSION}" =~ ^9\. ]]; then + return 1 + fi + return 0 } diff --git a/.github/workflows/updatecli/updatecli.d/bump-latest-snapshot-version.yml b/.github/workflows/updatecli/updatecli.d/bump-latest-8x-snapshot-version.yml similarity index 95% rename from .github/workflows/updatecli/updatecli.d/bump-latest-snapshot-version.yml rename to .github/workflows/updatecli/updatecli.d/bump-latest-8x-snapshot-version.yml index 9af2a074fe8..4b54a0d503d 100644 --- a/.github/workflows/updatecli/updatecli.d/bump-latest-snapshot-version.yml +++ b/.github/workflows/updatecli/updatecli.d/bump-latest-8x-snapshot-version.yml @@ -1,6 +1,6 @@ --- -name: Bump latest elastic-stack test version -pipelineid: 'bump-latest-elastic-stack-version' +name: Bump latest 8.x-SNAPSHOT elastic-stack test version +pipelineid: 'bump-latest-8x-elastic-stack-version' actions: default: diff --git a/.github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml b/.github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml new file mode 100644 index 00000000000..54e9afc68b1 --- /dev/null +++ b/.github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml @@ -0,0 +1,84 @@ +--- +name: Bump latest 9.x-SNAPSHOT elastic-stack test version +pipelineid: 'bump-latest-9x-elastic-stack-version' + +actions: + default: + title: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: github/pullrequest + scmid: default + spec: + labels: + - automation + - dependency + +scms: + default: + kind: github + spec: + owner: '{{ .scm.owner }}' + repository: '{{ .scm.repository }}' + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + username: '{{ requiredEnv "GITHUB_ACTOR" }}' + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + commitusingapi: true + branch: main + +sources: + latestSnapshot: + name: Get latest snapshot + kind: json + spec: + file: https://storage.googleapis.com/artifacts-api/snapshots/main.json + key: .version + latestSnapshotMajorMinor: + name: Get latest snapshort major and minor + kind: json + spec: + file: https://storage.googleapis.com/artifacts-api/snapshots/main.json + key: .version + transformers: + - findsubmatch: + pattern: '(^\d+\.\d+)\.[^\s]+$' + captureindex: 1 + +targets: + update-snapshot-daily: + name: '[updatecli] [daily] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: file + sourceid: latestSnapshot + scmid: default + spec: + file: '.buildkite/pipeline.schedule-daily.yml' + matchpattern: '(STACK_VERSION:) 9\.[^\s]*\.[^\s]*' + replacepattern: '$1 {{ source "latestSnapshot" }}' + + update-snapshot-label-daily: + name: '[updatecli] [daily] Update latest snapshot label step to {{ source "latestSnapshotMajorMinor" }}' + kind: file + sourceid: latestSnapshotMajorMinor + scmid: default + spec: + file: '.buildkite/pipeline.schedule-daily.yml' + matchpattern: '(Stack Version) v9\.\d+"' + replacepattern: 'Stack Version v{{ source "latestSnapshotMajorMinor" }}"' + + update-snapshot-weekly: + name: '[updatecli] [weekly] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: file + sourceid: latestSnapshot + scmid: default + spec: + file: '.buildkite/pipeline.schedule-weekly.yml' + matchpattern: '(STACK_VERSION:) 9\.[^\s]*\.[^\s]*' + replacepattern: '$1 {{ source "latestSnapshot" }}' + + update-snapshot-label-weekly: + name: '[updatecli] [weekly] Update latest snapshot label step to {{ source "latestSnapshotMajorMinor" }}' + kind: file + sourceid: latestSnapshotMajorMinor + scmid: default + spec: + file: '.buildkite/pipeline.schedule-weekly.yml' + matchpattern: '(Stack Version) v9\.\d+"' + replacepattern: 'Stack Version v{{ source "latestSnapshotMajorMinor" }}"' diff --git a/catalog-info.yaml b/catalog-info.yaml index b7d693f6a46..eaf9faed9e9 100644 --- a/catalog-info.yaml +++ b/catalog-info.yaml @@ -142,7 +142,7 @@ spec: schedules: main_weekly: branch: "main" - cronline: "30 3 * * 1" + cronline: "00 5 * * 1" message: "Run the weekly jobs" provider_settings: trigger_mode: none # don't trigger jobs from github activity diff --git a/docs/ci_pipelines.md b/docs/ci_pipelines.md index 2ab2f873d33..b7a450cbfb3 100644 --- a/docs/ci_pipelines.md +++ b/docs/ci_pipelines.md @@ -7,6 +7,7 @@ Currently, there are five different pipelines: - https://buildkite.com/elastic/integrations-serverless: pipeline in charge of testing all packages using a Elastic Serverless project. More info at [section](#serverless-pipeline). - https://buildkite.com/elastic/integrations-publish: pipeline to publish the new versions of packages. More info at [section](#publish-packages). - https://buildkite.com/elastic/integrations-schedule-daily/: pipeline running every night to test packages in different scenarios. More info at [section](#daily-job). +- https://buildkite.com/elastic/integrations-schedule-weekly/: pipeline running once per week to test packages in different scenarios. More info at [section](#weekly-job). - https://buildkite.com/elastic/integrations-backport/: pipeline to create backport branches (just from UI). More info at [section](#backport-branches-pipeline). ## Pull Requests and pushes to specific branches @@ -22,14 +23,15 @@ Special comments that can be added in the Pull Request (by Elastic employees): There are some environment variables that can be added into this pipeline: - **FORCE_CHECK_ALL**: If `true`, this forces the CI to check all packages even if those packages have no file updated/added/deleted. Default: `false`. - **STACK_VERSION**: Force the CI steps to spin up a specific Elastic stack version to run the tests. Default: unset. +- **STACK_LOGSDB_ENABLED**: Enable LogsDB setting in Elasticsearch service. Default: false. - **PUBLISH_COVERAGE_REPORTS**: If `true`, it enables reporting coverage reports. Currently, it is just set for the build triggered with the current major Elastic stack from the daily job. Default: `false`. These environment variables can be defined in different locations: - In the [global `env` section](https://github.com/elastic/integrations/blob/5276ef63712f8f2311818770881688870e8422fe/.buildkite/pipeline.yml#L2). -- In the case of the scheduled daily job here: - - [Running tests with previous major Elastic stack](https://github.com/elastic/integrations/blob/5276ef63712f8f2311818770881688870e8422fe/.buildkite/pipeline.schedule-daily.yml#L21). - - [Running tests with current major Elastic stack](https://github.com/elastic/integrations/blob/d6d99792b90838d18844f6df9343bc5f16130666/.buildkite/pipeline.schedule-daily.yml#L32). +- In the case of the scheduled daily job in each step. Some examples: + - [Running tests with 7.x major Elastic stack](https://github.com/elastic/integrations/blob/5276ef63712f8f2311818770881688870e8422fe/.buildkite/pipeline.schedule-daily.yml#L21). + - [Running tests with 8.x major Elastic stack](https://github.com/elastic/integrations/blob/d6d99792b90838d18844f6df9343bc5f16130666/.buildkite/pipeline.schedule-daily.yml#L32). More details about this CI pipeline: @@ -124,9 +126,13 @@ The schedule of this job can be checked [here](https://github.com/elastic/integr The scenarios that are tested in this daily job are: -- Test packages with a local Elastic stack running the previous major version of the stack (7.17.X SNAPSHOT). +- Test packages with a local Elastic stack running the latest 7.x version of the stack (7.17.X SNAPSHOT). - Triggered pipeline: https://buildkite.com/elastic/integrations -- Test packages with a local Elastic stack running the latest major version of the stack (currently 8.X.Y-SNAPSHOT). +- Test packages with a local Elastic stack running the latest 8.x version of the stack (8.X.Y-SNAPSHOT). + - Triggered pipeline: https://buildkite.com/elastic/integrations +- Test packages with a local Elastic stack running the latest 8.x version of the stack with LogsDB setting enabled (8.X.Y-SNAPSHOT). + - Triggered pipeline: https://buildkite.com/elastic/integrations +- Test packages with a local Elastic stack running the latest major version of the stack (currently 9.X.Y-SNAPSHOT). - Triggered pipeline: https://buildkite.com/elastic/integrations - Test packages with an Elastic Serverless Observability project. - Triggered pipeline: https://buildkite.com/elastic/integration-serverless @@ -141,6 +147,23 @@ have been published by triggering the pipeline https://buildkite.com/elastic/int Each step triggering a new pipeline can be customized through environment variables. Environment variables that can be used in each pipeline are detailed in the corresponding sections of each pipeline. +## Weekly job + +**Note**: Just available for Employees at Elastic. + +Every week it is configured to run a job that will be in charge of testing all packages with non-Wolfi Elastic Agent docker images: https://buildkite.com/elastic/integrations-schedule-weekly/ + +The schedule of this job can be checked [here](https://github.com/elastic/integrations/blob/2e72e8524728daca2d47c814d8042031b8f5804f/catalog-info.yaml#L145). + +The scenarios that are tested in this weekly job are: + +- Test packages with a local Elastic stack running the latest 8.x version of the stack with Elastic Agent images based on Ubuntu images (8.X.Y-SNAPSHOT). + - Triggered pipeline: https://buildkite.com/elastic/integrations +- Test packages with a local Elastic stack running the latest major version of the stack with Elastic Agent images based on non-Wolfi images (currently 9.X.Y-SNAPSHOT). + - Triggered pipeline: https://buildkite.com/elastic/integrations + +Each step triggering a new pipeline can be customized through environment variables. Environment variables that can +be used in each pipeline are detailed in the corresponding sections of each pipeline. ## Backport branches pipeline