From 0e24931a992e840a337be068c3a4f9db889f84ae Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 1 Jul 2024 19:50:29 +0200 Subject: [PATCH 1/2] Use shared buildkite pipeline vars file --- .buildkite/code-freeze.yml | 8 +---- .buildkite/complete-code-freeze.yml | 8 +---- .buildkite/finalize-release.yml | 8 +---- .buildkite/new-beta-release.yml | 8 +---- .buildkite/pipeline.yml | 37 +++++++++----------- .buildkite/schedules/dependency-analysis.yml | 8 +---- .buildkite/shared-pipeline-vars | 7 ++++ .buildkite/update-release-notes.yml | 8 +---- 8 files changed, 29 insertions(+), 63 deletions(-) create mode 100644 .buildkite/shared-pipeline-vars diff --git a/.buildkite/code-freeze.yml b/.buildkite/code-freeze.yml index ab1e90253793..09095a497234 100644 --- a/.buildkite/code-freeze.yml +++ b/.buildkite/code-freeze.yml @@ -1,18 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &common_plugins - - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" steps: - label: "Code Freeze" - plugins: *common_plugins + plugins: [$CI_TOOLKIT] command: | .buildkite/commands/configure-git-for-release-management.sh diff --git a/.buildkite/complete-code-freeze.yml b/.buildkite/complete-code-freeze.yml index 8e27d9888b7a..2b378accabdf 100644 --- a/.buildkite/complete-code-freeze.yml +++ b/.buildkite/complete-code-freeze.yml @@ -1,18 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &common_plugins - - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" steps: - label: "Complete Code Freeze" - plugins: *common_plugins + plugins: [$CI_TOOLKIT] command: | .buildkite/commands/configure-git-for-release-management.sh .buildkite/commands/checkout-release-branch.sh diff --git a/.buildkite/finalize-release.yml b/.buildkite/finalize-release.yml index 1900c4ad6b3f..015ba7cd5d78 100644 --- a/.buildkite/finalize-release.yml +++ b/.buildkite/finalize-release.yml @@ -1,18 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &common_plugins - - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" steps: - label: "Finalize release" - plugins: *common_plugins + plugins: [$CI_TOOLKIT] command: | .buildkite/commands/configure-git-for-release-management.sh .buildkite/commands/checkout-release-branch.sh diff --git a/.buildkite/new-beta-release.yml b/.buildkite/new-beta-release.yml index 1b72021511c1..3c2a9248fc18 100644 --- a/.buildkite/new-beta-release.yml +++ b/.buildkite/new-beta-release.yml @@ -1,18 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &common_plugins - - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" steps: - label: "New Beta Release" - plugins: *common_plugins + plugins: [$CI_TOOLKIT] command: | .buildkite/commands/configure-git-for-release-management.sh diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 227a0a21dcf2..8dd0c3b34ed1 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -3,11 +3,6 @@ # Nodes with values to reuse in the pipeline. common_params: - # Common plugin settings to use with the `plugins` key. - - &ci_toolkit - automattic/a8c-ci-toolkit#3.4.2 - - &test_collector - test-collector#v1.8.0 - &test_collector_common_params files: "buildkite-test-analytics/*.xml" format: "junit" @@ -22,7 +17,7 @@ steps: - label: "Gradle Wrapper Validation" command: | validate_gradle_wrapper - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] # Wait for Gradle Wrapper to be validated before running any other jobs - wait @@ -46,7 +41,7 @@ steps: command: | cp gradle.properties-example gradle.properties ./gradlew checkstyle - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] artifact_paths: - "**/build/reports/checkstyle/checkstyle.*" @@ -54,7 +49,7 @@ steps: command: | cp gradle.properties-example gradle.properties ./gradlew detekt - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] artifact_paths: - "**/build/reports/detekt/detekt.html" @@ -73,7 +68,7 @@ steps: cp gradle.properties-example gradle.properties .buildkite/commands/dependency-tree-diff.sh if: build.pull_request.id != null - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] ################# # Unit Tests @@ -83,8 +78,8 @@ steps: - label: "🔬 Unit Test WordPress" command: ".buildkite/commands/run-unit-tests.sh wordpress" plugins: - - *ci_toolkit - - *test_collector : + - $CI_TOOLKIT + - $TEST_COLLECTOR : <<: *test_collector_common_params api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_UNIT_TESTS_WORDPRESS" artifact_paths: @@ -93,8 +88,8 @@ steps: - label: "🔬 Unit Test Processors" command: ".buildkite/commands/run-unit-tests.sh processors" plugins: - - *ci_toolkit - - *test_collector : + - $CI_TOOLKIT + - $TEST_COLLECTOR : <<: *test_collector_common_params api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_UNIT_TESTS_PROCESSORS" artifact_paths: @@ -103,8 +98,8 @@ steps: - label: "🔬 Unit Test Image Editor" command: ".buildkite/commands/run-unit-tests.sh image-editor" plugins: - - *ci_toolkit - - *test_collector : + - $CI_TOOLKIT + - $TEST_COLLECTOR : <<: *test_collector_common_params api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_UNIT_TESTS_IMAGE_EDITOR" artifact_paths: @@ -118,8 +113,8 @@ steps: - label: ":wordpress: 🔬 Instrumented tests" command: ".buildkite/commands/run-instrumented-tests.sh wordpress" plugins: - - *ci_toolkit - - *test_collector : + - $CI_TOOLKIT + - $TEST_COLLECTOR : <<: *test_collector_common_params api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_INSTRUMENTED_TESTS_WORDPRESS" artifact_paths: @@ -128,8 +123,8 @@ steps: - label: ":jetpack: 🔬 Instrumented tests" command: ".buildkite/commands/run-instrumented-tests.sh jetpack" plugins: - - *ci_toolkit - - *test_collector : + - $CI_TOOLKIT + - $TEST_COLLECTOR : <<: *test_collector_common_params api-token-env-name: "BUILDKITE_ANALYTICS_TOKEN_INSTRUMENTED_TESTS_JETPACK" artifact_paths: @@ -143,9 +138,9 @@ steps: - label: ":wordpress: :android: Prototype Build" command: ".buildkite/commands/prototype-build.sh wordpress" if: build.pull_request.id != null - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] - label: ":jetpack: :android: Prototype Build" command: ".buildkite/commands/prototype-build.sh jetpack" if: build.pull_request.id != null - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] diff --git a/.buildkite/schedules/dependency-analysis.yml b/.buildkite/schedules/dependency-analysis.yml index 5787bb5c2d5e..6ecad5fb00ea 100644 --- a/.buildkite/schedules/dependency-analysis.yml +++ b/.buildkite/schedules/dependency-analysis.yml @@ -1,12 +1,6 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &ci_toolkit - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" @@ -16,7 +10,7 @@ steps: echo "--- 📊 Analyzing" cp gradle.properties-example gradle.properties ./gradlew buildHealth - plugins: [*ci_toolkit] + plugins: [$CI_TOOLKIT] artifact_paths: - "build/reports/dependency-analysis/build-health-report.*" notify: diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars new file mode 100644 index 000000000000..2dbbc02e7912 --- /dev/null +++ b/.buildkite/shared-pipeline-vars @@ -0,0 +1,7 @@ +#!/bin/sh + + # This file is `source`'d before calling `buildkite-agent pipeline upload`, and can be used + # to set up some variables that will be interpolated in the `.yml` pipeline before uploading it. + + export CI_TOOLKIT="automattic/a8c-ci-toolkit#3.4.2" + export TEST_COLLECTOR="test-collector#v1.10.1" diff --git a/.buildkite/update-release-notes.yml b/.buildkite/update-release-notes.yml index 4d1aab1ef66b..e484a67471ab 100644 --- a/.buildkite/update-release-notes.yml +++ b/.buildkite/update-release-notes.yml @@ -1,18 +1,12 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &common_plugins - - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" steps: - label: "Update release notes" - plugins: *common_plugins + plugins: [$CI_TOOLKIT] command: | .buildkite/commands/configure-git-for-release-management.sh .buildkite/commands/checkout-editorial-branch.sh From 47ebbae9c0bc6b77a46465a2af054febfcc7fb27 Mon Sep 17 00:00:00 2001 From: Ian Maia Date: Mon, 1 Jul 2024 20:58:21 +0200 Subject: [PATCH 2/2] Use shared var also on release builds pipeline --- .buildkite/release-builds.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.buildkite/release-builds.yml b/.buildkite/release-builds.yml index eb4df6618207..77b20b4647ac 100644 --- a/.buildkite/release-builds.yml +++ b/.buildkite/release-builds.yml @@ -4,12 +4,6 @@ # This pipeline is meant to be run via the Buildkite API, and is # only used for release builds -# Nodes with values to reuse in the pipeline. -common_params: - # Common plugin settings to use with the `plugins` key. - - &common_plugins - - automattic/a8c-ci-toolkit#3.4.2 - agents: queue: "android" @@ -21,7 +15,7 @@ steps: command: | validate_gradle_wrapper priority: 1 - plugins: *common_plugins + plugins: [$CI_TOOLKIT] # Wait for Gradle Wrapper to be validated before running any other jobs - wait @@ -57,7 +51,7 @@ steps: command: ".buildkite/commands/release-build.sh wordpress" priority: 1 depends_on: wplint - plugins: *common_plugins + plugins: [$CI_TOOLKIT] notify: - slack: "#build-and-ship" @@ -66,7 +60,7 @@ steps: command: ".buildkite/commands/release-build.sh jetpack" priority: 1 depends_on: jplint - plugins: *common_plugins + plugins: [$CI_TOOLKIT] notify: - slack: "#build-and-ship" @@ -79,4 +73,4 @@ steps: - jpbuild command: ".buildkite/commands/create-github-release.sh" priority: 1 - plugins: *common_plugins + plugins: [$CI_TOOLKIT]