From ac826971d157392e381adc1fe23a4041867464a9 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Mon, 30 Sep 2024 15:10:01 +1000 Subject: [PATCH 1/4] Adopt shared pipeline vars for CI --- .buildkite/pipeline.yml | 28 +++++++++++----------------- .buildkite/shared-pipeline-vars | 12 ++++++++++++ .xcode-version | 1 + 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100755 .buildkite/shared-pipeline-vars create mode 100644 .xcode-version diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index f7d9d6642..0b1f8707d 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,18 +1,5 @@ # yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json --- -# Nodes with values to reuse in the pipeline. -common_params: - env: &xcode_image - IMAGE_ID: xcode-15.2 - plugins: - - &ci_toolkit - automattic/a8c-ci-toolkit#2.18.2: ~ - - &docker_plugin - docker#v5.8.0: - image: &ruby_version "public.ecr.aws/docker/library/ruby:3.2.2" - propagate-environment: true - environment: - - "RUBYGEMS_API_KEY" steps: ################# @@ -39,14 +26,16 @@ steps: echo "--- :rspec: Run Rspec" bundle exec rspec --profile 10 --format progress - env: *xcode_image - plugins: [*ci_toolkit] + env: + IMAGE_ID: $IMAGE_ID + plugins: + - $CI_TOOLKIT_PLUGIN agents: queue: "mac" matrix: setup: ruby: - - 3.2.2 + - $RUBY_VERSION ################# # Push to RubyGems @@ -60,6 +49,11 @@ steps: # commands written inline) to avoid leaking a key used in the process in clear in the # BUILDKITE_COMMAND environment variable. command: .buildkite/commands/gem-push.sh - plugins: [*docker_plugin] + plugins: + - docker#v5.8.0: + image: "public.ecr.aws/docker/library/ruby:$RUBY_VERSION" + propagate-environment: true + environment: + - "RUBYGEMS_API_KEY" agents: queue: "default" diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars new file mode 100755 index 000000000..addc730b6 --- /dev/null +++ b/.buildkite/shared-pipeline-vars @@ -0,0 +1,12 @@ +#!/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. + +CI_TOOLKIT_PLUGIN_VERSION="2.18.2" +RUBY_VERSION=$(cat .ruby-version) +XCODE_VERSION=$(sed 's/^~> *//' .xcode-version) + +export CI_TOOLKIT_PLUGIN="automattic/a8c-ci-toolkit#$CI_TOOLKIT_PLUGIN_VERSION" +export IMAGE_ID="xcode-$XCODE_VERSION" +export RUBY_VERSION diff --git a/.xcode-version b/.xcode-version new file mode 100644 index 000000000..dafb659a6 --- /dev/null +++ b/.xcode-version @@ -0,0 +1 @@ +15.2 From d51ba84a9a78687f726aa0230694419c220e2f06 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Mon, 30 Sep 2024 15:18:56 +1000 Subject: [PATCH 2/4] Remove comments that said the same as labels and unnecessary quotations --- .buildkite/pipeline.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 0b1f8707d..c8a879acc 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -2,13 +2,10 @@ --- steps: - ################# - # Build and Test - ################# - - group: 🧪 Build and Test" + - group: ":test_tube: Build and Test" key: test steps: - - label: "🧪 Build and Test using Ruby {{ matrix.ruby }}" + - label: ":test_tube: Build and Test using Ruby {{ matrix.ruby }}" command: | echo "--- :ruby: Using ruby {{ matrix.ruby }}" export RBENV_VERSION={{ matrix.ruby }} @@ -31,17 +28,14 @@ steps: plugins: - $CI_TOOLKIT_PLUGIN agents: - queue: "mac" + queue: mac matrix: setup: ruby: - $RUBY_VERSION - ################# - # Push to RubyGems - ################# - label: ":rubygems: Publish to RubyGems" - key: "gem-push" + key: gem-push if: build.tag != null depends_on: - test @@ -54,6 +48,6 @@ steps: image: "public.ecr.aws/docker/library/ruby:$RUBY_VERSION" propagate-environment: true environment: - - "RUBYGEMS_API_KEY" + - RUBYGEMS_API_KEY agents: - queue: "default" + queue: default From 314fbef8f20bc956104cc5823f3afc241281e344 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Mon, 30 Sep 2024 15:39:56 +1000 Subject: [PATCH 3/4] Add test for pipeline upload action --- .buildkite/pipeline.yml | 3 +++ .buildkite/pipeline_for_upload_action_test.yml | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 .buildkite/pipeline_for_upload_action_test.yml diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index c8a879acc..b15f6f20b 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -23,6 +23,9 @@ steps: echo "--- :rspec: Run Rspec" bundle exec rspec --profile 10 --format progress + + echo "--- :fastlane: :buildkite: Test pipeline upload action" + bundle exec fastlane run buildkite_pipeline_upload pipeline_file:.buildkite/pipeline_for_upload_action_test.yml env: IMAGE_ID: $IMAGE_ID plugins: diff --git a/.buildkite/pipeline_for_upload_action_test.yml b/.buildkite/pipeline_for_upload_action_test.yml new file mode 100644 index 000000000..239c2fb25 --- /dev/null +++ b/.buildkite/pipeline_for_upload_action_test.yml @@ -0,0 +1,6 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json +--- + +steps: + - label: ":ok_hand: If this message is shown, the pipeline upload succeeded" + command: echo "Acknowledged." From 3e74526c01216a5baa8918fa0ebdc8dfc15f6f71 Mon Sep 17 00:00:00 2001 From: Gio Lodi Date: Mon, 30 Sep 2024 15:53:08 +1000 Subject: [PATCH 4/4] Update CI toolkit from 2.x to 3.7.1 --- .buildkite/shared-pipeline-vars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.buildkite/shared-pipeline-vars b/.buildkite/shared-pipeline-vars index addc730b6..652b82bc5 100755 --- a/.buildkite/shared-pipeline-vars +++ b/.buildkite/shared-pipeline-vars @@ -3,7 +3,7 @@ # 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. -CI_TOOLKIT_PLUGIN_VERSION="2.18.2" +CI_TOOLKIT_PLUGIN_VERSION="3.7.1" RUBY_VERSION=$(cat .ruby-version) XCODE_VERSION=$(sed 's/^~> *//' .xcode-version)