From ceb65adbc4b212e2704fc0a3e7e1151689aeba6c Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Tue, 11 Nov 2025 14:44:40 +0000 Subject: [PATCH 01/10] backstage: delete the orb --- orb/.circleci/README.md | 33 ---- orb/.gitignore | 2 - orb/.yamllint | 7 - orb/CHANGELOG.md | 209 -------------------- orb/README.md | 56 ------ orb/src/@orb.yml | 18 -- orb/src/README.md | 26 --- orb/src/commands/README.md | 27 --- orb/src/commands/attach-workspace.yml | 7 - orb/src/commands/persist-workspace.yml | 15 -- orb/src/commands/serverless-assume-role.yml | 16 -- orb/src/executors/default.yml | 7 - orb/src/jobs/README.md | 29 --- orb/src/jobs/build.yml | 14 -- orb/src/jobs/deploy-production.yml | 52 ----- orb/src/jobs/deploy-review.yml | 47 ----- orb/src/jobs/deploy-staging.yml | 32 --- orb/src/jobs/e2e-test-review.yml | 33 ---- orb/src/jobs/e2e-test-staging.yml | 18 -- orb/src/jobs/heroku-promote.yml | 21 -- orb/src/jobs/heroku-provision.yml | 28 --- orb/src/jobs/heroku-staging.yml | 13 -- orb/src/jobs/publish-tag.yml | 12 -- orb/src/jobs/publish.yml | 12 -- orb/src/jobs/setup.yml | 20 -- orb/src/jobs/test.yml | 20 -- orb/src/tests/README.md | 92 --------- orb/version.txt | 1 - 28 files changed, 867 deletions(-) delete mode 100644 orb/.circleci/README.md delete mode 100644 orb/.gitignore delete mode 100644 orb/.yamllint delete mode 100644 orb/CHANGELOG.md delete mode 100644 orb/README.md delete mode 100644 orb/src/@orb.yml delete mode 100644 orb/src/README.md delete mode 100644 orb/src/commands/README.md delete mode 100644 orb/src/commands/attach-workspace.yml delete mode 100644 orb/src/commands/persist-workspace.yml delete mode 100644 orb/src/commands/serverless-assume-role.yml delete mode 100644 orb/src/executors/default.yml delete mode 100644 orb/src/jobs/README.md delete mode 100644 orb/src/jobs/build.yml delete mode 100644 orb/src/jobs/deploy-production.yml delete mode 100644 orb/src/jobs/deploy-review.yml delete mode 100644 orb/src/jobs/deploy-staging.yml delete mode 100644 orb/src/jobs/e2e-test-review.yml delete mode 100644 orb/src/jobs/e2e-test-staging.yml delete mode 100644 orb/src/jobs/heroku-promote.yml delete mode 100644 orb/src/jobs/heroku-provision.yml delete mode 100644 orb/src/jobs/heroku-staging.yml delete mode 100644 orb/src/jobs/publish-tag.yml delete mode 100644 orb/src/jobs/publish.yml delete mode 100644 orb/src/jobs/setup.yml delete mode 100644 orb/src/jobs/test.yml delete mode 100644 orb/src/tests/README.md delete mode 100644 orb/version.txt diff --git a/orb/.circleci/README.md b/orb/.circleci/README.md deleted file mode 100644 index 2662a0e8c..000000000 --- a/orb/.circleci/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# Orb Development Pipeline - -This configuration file uses [orb-tools orb]() version 10 to automatically _pack_, _test_, and _publish_ CircleCI orbs using this project structure. View the comments within the config file for a full break down - -## Overview: - -**Imported Orbs** - -Both orb-tools and a development version of your orb will be imported into the config. On the first run, a `dev:alpha` development tag _must_ exist on your orb, but will be handled automatically from there on. - -**Jobs** - -In the _jobs_ key, you will define _integration tests_. These jobs will utilize the functionality of your orb at run-time and attempt to validate their usage with live examples. Integration tests can be an excellent way of determining issues with parameters and run-time execution. - -### Workflows - -There are two workflows which automate the pack, test, and publishing process. - -**test-pack** - -This is the first of the two workflows run. This workflow is responsible for any testing or prepping prior to integration tests. This is where linting occurs, shellchecking, BATS tests, or anything else that can be be tested without the need for further credentials. - -This Workflow will be placed on _hold_ prior to publishing a new development version of the orb (based on this commit), as this step requires access to specific publishing credentials. - -This allows users to fork the orb repository and begin the pipeline, while the code-owners review that the code is safe to test in an environment where publishing keys will be present. - -Once approved, the development version of the orb will publish and the _trigger-integration-tests-workflow_ job will run, kicking off the next workflow - -**integration-test_deploy** - -The second and final workflow is manually triggered by the _trigger-integration-tests-workflow_ job. In this run, the development version of the orb that was just published will be imported, and the integration tests will run. - -When running on the `main` branch (after merging to `main`), the workflow will additionally publish your new production orb. diff --git a/orb/.gitignore b/orb/.gitignore deleted file mode 100644 index 19eafbb09..000000000 --- a/orb/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# orb.yml is "packed" from source, and not published directly from the repository. -orb.yml \ No newline at end of file diff --git a/orb/.yamllint b/orb/.yamllint deleted file mode 100644 index c9a8a2ef7..000000000 --- a/orb/.yamllint +++ /dev/null @@ -1,7 +0,0 @@ -extends: relaxed - -rules: - line-length: - max: 200 - allow-non-breakable-inline-mappings: true - diff --git a/orb/CHANGELOG.md b/orb/CHANGELOG.md deleted file mode 100644 index 3ff5a59c3..000000000 --- a/orb/CHANGELOG.md +++ /dev/null @@ -1,209 +0,0 @@ -# Changelog - -## [5.2.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v5.2.0...orb-v5.2.1) (2025-01-28) - - -### Bug Fixes - -* **orb:** automatically use latest patch version of cloudsmith-oidc orb ([2b4ed3c](https://github.com/Financial-Times/dotcom-tool-kit/commit/2b4ed3c6c05e7b4110bfd42964bb34101219ee7c)) - -## [5.2.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v5.1.0...orb-v5.2.0) (2025-01-02) - - -### Features - -* add Cloudsmith auth ([3abc644](https://github.com/Financial-Times/dotcom-tool-kit/commit/3abc644285cfb01190df4da982c75ffdde22c983)) - - -### Bug Fixes - -* **orb:** remove unused build-test job ([280a69e](https://github.com/Financial-Times/dotcom-tool-kit/commit/280a69e1c4b869d3eb4a15981a49aa2ae9d6bfb0)) - -## [5.1.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v5.0.2...orb-v5.1.0) (2024-10-31) - - -### Features - -* install docker on review and production ([4d10aae](https://github.com/Financial-Times/dotcom-tool-kit/commit/4d10aaec91b62cd4c1834a5b9797aa2cf77e0ae7)) -* install docker on staging deploy ([4f50b34](https://github.com/Financial-Times/dotcom-tool-kit/commit/4f50b34dd004f6cb19d1e6fbb7b5c56d9d8f6333)) - -## [5.0.2](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v5.0.1...orb-v5.0.2) (2024-05-22) - - -### Bug Fixes - -* upgrade serverless-framework orb ([bf66cf7](https://github.com/Financial-Times/dotcom-tool-kit/commit/bf66cf7c2cb808b4a2ce4c4e35e8a5350eb227bb)) - -## [5.0.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v5.0.0...orb-v5.0.1) (2024-02-01) - - -### Bug Fixes - -* add serverles-assume-role steps to e2e-test-review job ([d25947c](https://github.com/Financial-Times/dotcom-tool-kit/commit/d25947c55e201cebb359c4e1950edeca486c4604)) - -## [5.0.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.3.1...orb-v5.0.0) (2024-01-25) - - -### ⚠ BREAKING CHANGES - -* **orb:** add teardown:review step to e2e-test-review job - -### Bug Fixes - -* **orb:** add teardown:review step to e2e-test-review job ([e09d874](https://github.com/Financial-Times/dotcom-tool-kit/commit/e09d87476288f3bd5c83fd5fd141bf6a3c059e36)) - -## [4.3.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.3.0...orb-v4.3.1) (2024-01-24) - - -### Bug Fixes - -* temporarily remove teardown:review step from e2e-test-review job. This was a breaking change and it should have required a major release ([4202398](https://github.com/Financial-Times/dotcom-tool-kit/commit/4202398632f7b36832234a5a0305a1b6cbb4e322)) - -## [4.3.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.2.3...orb-v4.3.0) (2024-01-23) - - -### Features - -* add teardown:review hook ([e00fcb4](https://github.com/Financial-Times/dotcom-tool-kit/commit/e00fcb4739f684ab62329dfe246b4981a9fdebc9)) - -## [4.2.3](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.2.2...orb-v4.2.3) (2023-10-24) - - -### Bug Fixes - -* **orb:** install npm version if param set ([723043a](https://github.com/Financial-Times/dotcom-tool-kit/commit/723043aad3b2fc121e6f32d4580038a80bb597c0)) -* **orb:** revert deletion of npm-version parameter ([f6ec1cf](https://github.com/Financial-Times/dotcom-tool-kit/commit/f6ec1cf0dfc4b7fb15946e79511bc1975256f9c7)) -* **orb:** stop force using npm 8 on circleci ([5b8ad86](https://github.com/Financial-Times/dotcom-tool-kit/commit/5b8ad86720ee488d42290eb6e8e21388e7964f4e)) - -## [4.2.2](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.2.1...orb-v4.2.2) (2023-10-23) - - -### Bug Fixes - -* **orb:** install doppler CLI for jobs that call it ([d053e1d](https://github.com/Financial-Times/dotcom-tool-kit/commit/d053e1d1096a199147f3f8d51bbc2365f6e5b922)) - -## [4.2.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.2.0...orb-v4.2.1) (2023-09-19) - - -### Bug Fixes - -* bump the Change API orb version ([ac5c64c](https://github.com/Financial-Times/dotcom-tool-kit/commit/ac5c64ce6387269be5131af9c16d5b88af68fc5a)) - -## [4.2.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.1.1...orb-v4.2.0) (2023-09-04) - - -### Features - -* store e2e test results ([c22f83b](https://github.com/Financial-Times/dotcom-tool-kit/commit/c22f83b6e12ecb96e892bd2d77e1ac3031e8d0f4)) - -## [4.1.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.1.0...orb-v4.1.1) (2023-05-02) - - -### Bug Fixes - -* **orb:** revert default docker executor version back to Node 16 ([05d02ad](https://github.com/Financial-Times/dotcom-tool-kit/commit/05d02ad7097a087d0e2bf5d39b54c5637a653f07)) - -## [4.1.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v4.0.0...orb-v4.1.0) (2023-04-28) - - -### Features - -* **orb:** bump default docker executor version to Node 18 ([6dad141](https://github.com/Financial-Times/dotcom-tool-kit/commit/6dad141392cad7951a769ac3837831ceb4e514a3)) - - -### Bug Fixes - -* **orb:** use latest change-api-orb to fix change-api curl request ([ab21f48](https://github.com/Financial-Times/dotcom-tool-kit/commit/ab21f48ba4cfd4cce5a99831fe3eabc81939e26f)) - -## [4.0.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v3.3.1...orb-v4.0.0) (2023-04-18) - - -### ⚠ BREAKING CHANGES - -* drop support for Node 14 across all packages - -### Bug Fixes - -* **orb:** revert use env_var_name type for defining system-code for change-api orb ([269c06e](https://github.com/Financial-Times/dotcom-tool-kit/commit/269c06ef4a099f5f84a4c30bb41894443d0e5466)) -* **orb:** use latest change-api-orb to fix change-api curl request ([b003897](https://github.com/Financial-Times/dotcom-tool-kit/commit/b00389700da137b9331bcc48bf65735f1b2b554a)) - - -### Miscellaneous Chores - -* drop support for Node 14 across all packages ([aaee178](https://github.com/Financial-Times/dotcom-tool-kit/commit/aaee178b535a51f9c75a882d78ffd8e8aa3eac60)) - -## [3.3.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v3.3.0...orb-v3.3.1) (2023-04-17) - - -### Bug Fixes - -* **orb:** use env_var_name type for defining system-code ([39640f1](https://github.com/Financial-Times/dotcom-tool-kit/commit/39640f176954ebdbcb8386e71caa645c5c8fe535)) - -## [3.3.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v3.2.0...orb-v3.3.0) (2023-04-05) - - -### Features - -* allow OIDC authentication for deploy:production hook ([7afa8d3](https://github.com/Financial-Times/dotcom-tool-kit/commit/7afa8d37f8886dc6e7eccfc0e3e654789f5f4f85)) -* **orb:** clarify names of jobs in orb ([7ce7016](https://github.com/Financial-Times/dotcom-tool-kit/commit/7ce7016e975ee18b10786588c5d799667373b201)) - - -### Bug Fixes - -* **orb:** remove execute permissions from orb's YAML config files ([86938fa](https://github.com/Financial-Times/dotcom-tool-kit/commit/86938fa637d6690f490e0ae1aa70b278b1e4c5cb)) - -## [3.2.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v3.1.0...orb-v3.2.0) (2023-03-07) - - -### Features - -* **orb:** add support for assuming AWS role in provisioning job ([65dbabd](https://github.com/Financial-Times/dotcom-tool-kit/commit/65dbabd58adf55fa078482b79ea6fd98434238b0)) - -## [3.1.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v3.0.0...orb-v3.1.0) (2023-01-24) - - -### Features - -* **orb:** update to change-api orb 1.0 ([257b267](https://github.com/Financial-Times/dotcom-tool-kit/commit/257b26731ff7c1a987c1c9b27ee82470c30fdf93)) - -## [3.0.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v2.0.1...orb-v3.0.0) (2022-12-08) - - -### ⚠ BREAKING CHANGES - -* **orb:** allow the executor to be set for a job - -### Features - -* **orb:** allow the executor to be set for a job ([3176451](https://github.com/Financial-Times/dotcom-tool-kit/commit/3176451e5dfe93737ef21503d02a2da77d6d87a2)) - -### [2.0.1](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v2.0.0...orb-v2.0.1) (2022-08-15) - - -### Bug Fixes - -* pass environment to Change API ([d39292e](https://github.com/Financial-Times/dotcom-tool-kit/commit/d39292e4acd65c17fa476b465d6d770e0a156c39)) - -## [2.0.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/orb-v2.0.0...orb-v2.0.0) (2022-05-06) - - -### ⚠ BREAKING CHANGES - -* bump Node versions in orb - -### Miscellaneous Chores - -* bump Node versions in orb ([fde5c13](https://github.com/Financial-Times/dotcom-tool-kit/commit/fde5c132ed9a83c4b7d9a336018fd87fb88c1880)) -* release 2.0 version for all packages ([42dc5d3](https://github.com/Financial-Times/dotcom-tool-kit/commit/42dc5d39bf330b9bca4121d062470904f9c6918d)) - -## [2.0.0](https://github.com/Financial-Times/dotcom-tool-kit/compare/v1.9.0...v2.0.0) (2022-04-19) - - -### ⚠ BREAKING CHANGES - -* bump Node versions in orb - -### Miscellaneous Chores - -* bump Node versions in orb ([fde5c13](https://github.com/Financial-Times/dotcom-tool-kit/commit/fde5c132ed9a83c4b7d9a336018fd87fb88c1880)) -* release 2.0 version for all packages ([42dc5d3](https://github.com/Financial-Times/dotcom-tool-kit/commit/42dc5d39bf330b9bca4121d062470904f9c6918d)) diff --git a/orb/README.md b/orb/README.md deleted file mode 100644 index edb6b2b72..000000000 --- a/orb/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Dotcom Tool Kit Orb - -An orb exporting many standard hooks as jobs to add to your CircleCI config. - -## Job Structure - -Each job is a very simple wrapper that calls its respective hook, where most of the real logic is contained. For example, the `build` job is defined in its entirety as: - -```yaml -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Run the project build-production task - command: npx dotcom-tool-kit build:ci - - persist-workspace: - path: . -``` - -You can expect any other given job to look very similar. We first define a parameter that allows consumers to set the docker image and tag they want to use for the job. We then pass this parameter to the `executor` property to set the docker image that all the steps will use (based on the parameter passed). We run `attach-workspace`, which is the glue we use in many jobs to pick up the state from a previous job in the workflow, now rolled into a simple command (along with its counterpart `persist-workspace`.) Finally, we run the `build:ci` hook event, which will run any hooks for building the project in the CI, such as babel, webpack, etc. - -## Adding Jobs To Your CircleCI Config - -#### Automatically - -The easiest way to use the dotcom-tool-kit orb is to delete your old `.circleci/config.yml` file, then run `npx dotcom-tool-kit --install`. This will automatically generate a config file that will include all the hooks you have installed. If you add or remove plugins be sure to rerun `npx dotcom-tool-kit --install` to update the CircleCI jobs in lockstep. - -#### Manually - -Alternatively, you can manually add tool-kit jobs to your CircleCI just like you would any other job, but it will look a lot terser! Take using the `heroku-provision` job in `next-static`: - -```yaml -- tool-kit/heroku-provision: - requires: - - tool-kit/setup - filters: - branches: - ignore: /(^renovate-.*|^nori/.*|^main)/ -``` - -You can see that the job itself requires no additional parameters, and the only configuration required are the properties used to place the job into your own workflow, using the `requires` property to say that the job is run after `tool-kit/setup`, and the `filters` property to say the job should only be run in PR branches (excluding nori and Renovate branches.) Note that all the job names have been prefixed with `tool-kit/`. This is because we need to add one extra stanza at the top of your config file in order to pull in the dotcom tool kit orb: - - - -```yaml -orbs: - tool-kit: financial-times/dotcom-tool-kit@ -``` - -substituting in the latest orb version. diff --git a/orb/src/@orb.yml b/orb/src/@orb.yml deleted file mode 100644 index a664c20c2..000000000 --- a/orb/src/@orb.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: 2.1 - -description: > - Helper jobs for dotcom-tool-kit to add to your CircleCI config depending on - the hooks used - -# This information will be displayed in the orb registry and is not mandatory. -display: - home_url: 'https://www.ft.com' - source_url: 'https://www.github.com/financial-times/dotcom-tool-kit' - -# If your orb requires other orbs, you can import them like this. Otherwise remove the "orbs" stanza. -orbs: - node: circleci/node@5.0.2 - change-api: financial-times/change-api@1.0.9 - cloudsmith-oidc: ft-circleci-orbs/cloudsmith-oidc@1.0 - aws-cli: circleci/aws-cli@3.1.4 - serverless-framework: circleci/serverless-framework@2.0.2 diff --git a/orb/src/README.md b/orb/src/README.md deleted file mode 100644 index 5b96be42b..000000000 --- a/orb/src/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Orb Source - -Orbs are shipped as individual `orb.yml` files, however, to make development easier, it is possible to author an orb in _unpacked_ form, which can be _packed_ with the CircleCI CLI and published. - -The default `.circleci/config.yml` file contains the configuration code needed to automatically pack, test, and deploy and changes made to the contents of the orb source in this directory. - -## @orb.yml - -This is the entry point for our orb "tree", which becomes our `orb.yml` file later. - -Within the `@orb.yml` we generally specify 4 configuration keys - -**Keys** - -1. **version** - Specify version 2.1 for orb-compatible configuration `version: 2.1` -2. **description** - Give your orb a description. Shown within the CLI and orb registry -3. **display** - Specify the `home_url` referencing documentation or product URL, and `source_url` linking to the orb's source repository. -4. **orbs** - (optional) Some orbs may depend on other orbs. Import them here. - -## See: - - [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) - - [Reusable Configuration](https://circleci.com/docs/2.0/reusing-config) \ No newline at end of file diff --git a/orb/src/commands/README.md b/orb/src/commands/README.md deleted file mode 100644 index ff174baf7..000000000 --- a/orb/src/commands/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Commands - -Easily add and author [Reusable Commands](https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands) to the `src/commands` directory. - -Each _YAML_ file within this directory will be treated as an orb command, with a name which matches its filename. - -Here's an example of a command: - -```yaml -description: > - Replace this text with a description for this command. - # What will this command do? - # Descriptions should be short, simple, and clear. -parameters: - greeting: - type: string - default: "Hello" - description: "Select a proper greeting" -steps: - - run: - name: Hello World - command: echo << parameters.greeting >> world -``` - -## See: - - [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) - - [How to author commands](https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands) diff --git a/orb/src/commands/attach-workspace.yml b/orb/src/commands/attach-workspace.yml deleted file mode 100644 index 4c44889ed..000000000 --- a/orb/src/commands/attach-workspace.yml +++ /dev/null @@ -1,7 +0,0 @@ -description: > - Attaches workspace to the current working directory. Useful when you want to - reuse artifacts from a previous job. - -steps: - - attach_workspace: - at: . diff --git a/orb/src/commands/persist-workspace.yml b/orb/src/commands/persist-workspace.yml deleted file mode 100644 index 6653f067d..000000000 --- a/orb/src/commands/persist-workspace.yml +++ /dev/null @@ -1,15 +0,0 @@ -description: > - Stores current working directory as a workspace. Useful when you want to store - artifacts for subsequent jobs to use. - -parameters: - path: - type: string - default: .toolkitstate - description: Path to persist to workspace - -steps: - - persist_to_workspace: - root: . - paths: - - << parameters.path >> diff --git a/orb/src/commands/serverless-assume-role.yml b/orb/src/commands/serverless-assume-role.yml deleted file mode 100644 index b5af668f8..000000000 --- a/orb/src/commands/serverless-assume-role.yml +++ /dev/null @@ -1,16 +0,0 @@ -description: > - Assume AWS role configured to use a CircleCI OIDC token to allow you to - deploy the project via Serverless - -parameters: - aws-account-id: - type: string - system-code: - type: string - -steps: - - aws-cli/setup: - role-arn: arn:aws:iam::<< parameters.aws-account-id >>:role/CircleCI-role-<< parameters.system-code >> - role-session-name: CircleCI-role-<< parameters.system-code >> - profile-name: CircleCI-role-<< parameters.system-code >> - - serverless-framework/setup diff --git a/orb/src/executors/default.yml b/orb/src/executors/default.yml deleted file mode 100644 index 9c83940d3..000000000 --- a/orb/src/executors/default.yml +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - tag: - type: string - default: '16.18-browsers' - -docker: - - image: cimg/node:<< parameters.tag >> diff --git a/orb/src/jobs/README.md b/orb/src/jobs/README.md deleted file mode 100644 index 81aa5dadc..000000000 --- a/orb/src/jobs/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Jobs - -Easily author and add [Parameterized Jobs](https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs) to the `src/jobs` directory. - -Each _YAML_ file within this directory will be treated as an orb job, with a name which matches its filename. - -Jobs may invoke orb commands and other steps to fully automate tasks with minimal user configuration. - -Here's an example of a job: - -```yaml - # What will this job do? - # Descriptions should be short, simple, and clear. - Sample description -executor: default -parameters: - greeting: - type: string - default: "Hello" - description: "Select a proper greeting" -steps: - - greet: - greeting: << parameters.greeting >> -``` - -## See: - - [Orb Author Intro](https://circleci.com/docs/2.0/orb-author-intro/#section=configuration) - - [How To Author Commands](https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs) - - [Node Orb "test" Job](https://github.com/CircleCI-Public/node-orb/blob/master/src/jobs/test.yml) diff --git a/orb/src/jobs/build.yml b/orb/src/jobs/build.yml deleted file mode 100644 index 230f659f7..000000000 --- a/orb/src/jobs/build.yml +++ /dev/null @@ -1,14 +0,0 @@ -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Run the project build-production task - command: npx dotcom-tool-kit build:ci - - persist-workspace: - path: . diff --git a/orb/src/jobs/deploy-production.yml b/orb/src/jobs/deploy-production.yml deleted file mode 100644 index 6a83829cf..000000000 --- a/orb/src/jobs/deploy-production.yml +++ /dev/null @@ -1,52 +0,0 @@ -parameters: - executor: - default: default - type: executor - aws-account-id: - default: '' - type: string - system-code: - default: $CIRCLE_PROJECT_REPONAME - description: >- - The system-code of the system being changed. Defaults to the repository - name. - type: string - cloudsmith-org: - default: 'financial-times' - type: string - cloudsmith-service-account: - default: '' - type: string - -executor: << parameters.executor >> - -environment: - CLOUDSMITH_ORGANISATION: << parameters.cloudsmith-org >> - CLOUDSMITH_SERVICE_ACCOUNT: << parameters.cloudsmith-service-account >> - -steps: - - attach-workspace - - setup_remote_docker: - docker_layer_caching: true - - when: - condition: - and: - - << parameters.cloudsmith-org >> - - << parameters.cloudsmith-service-account >> - steps: - - cloudsmith-oidc/authenticate_with_oidc - - when: - condition: - and: - - << parameters.aws-account-id >> - - << parameters.system-code >> - steps: - - serverless-assume-role: - aws-account-id: << parameters.aws-account-id >> - system-code: << parameters.system-code >> - - run: - name: Deploy to production - command: npx dotcom-tool-kit deploy:production - - change-api/change-log: - environment: production - system-code: << parameters.system-code >> diff --git a/orb/src/jobs/deploy-review.yml b/orb/src/jobs/deploy-review.yml deleted file mode 100644 index 329260a04..000000000 --- a/orb/src/jobs/deploy-review.yml +++ /dev/null @@ -1,47 +0,0 @@ -parameters: - executor: - default: default - type: executor - aws-account-id: - default: '' - type: string - system-code: - default: '' - type: string - cloudsmith-org: - default: 'financial-times' - type: string - cloudsmith-service-account: - default: '' - type: string - -executor: << parameters.executor >> - -environment: - CLOUDSMITH_ORGANISATION: << parameters.cloudsmith-org >> - CLOUDSMITH_SERVICE_ACCOUNT: << parameters.cloudsmith-service-account >> - -steps: - - attach-workspace - - setup_remote_docker: - docker_layer_caching: true - - when: - condition: - and: - - << parameters.cloudsmith-org >> - - << parameters.cloudsmith-service-account >> - steps: - - cloudsmith-oidc/authenticate_with_oidc - - when: - condition: - and: - - << parameters.aws-account-id >> - - << parameters.system-code >> - steps: - - serverless-assume-role: - aws-account-id: << parameters.aws-account-id >> - system-code: << parameters.system-code >> - - run: - name: Create and test review app - command: npx dotcom-tool-kit deploy:review - - persist-workspace diff --git a/orb/src/jobs/deploy-staging.yml b/orb/src/jobs/deploy-staging.yml deleted file mode 100644 index 5084dc3f3..000000000 --- a/orb/src/jobs/deploy-staging.yml +++ /dev/null @@ -1,32 +0,0 @@ -parameters: - executor: - default: default - type: executor - cloudsmith-org: - default: 'financial-times' - type: string - cloudsmith-service-account: - default: '' - type: string - -executor: << parameters.executor >> - -environment: - CLOUDSMITH_ORGANISATION: << parameters.cloudsmith-org >> - CLOUDSMITH_SERVICE_ACCOUNT: << parameters.cloudsmith-service-account >> - -steps: - - attach-workspace - - setup_remote_docker: - docker_layer_caching: true - - when: - condition: - and: - - << parameters.cloudsmith-org >> - - << parameters.cloudsmith-service-account >> - steps: - - cloudsmith-oidc/authenticate_with_oidc - - run: - name: Deploy to staging - command: npx dotcom-tool-kit deploy:staging - - persist-workspace diff --git a/orb/src/jobs/e2e-test-review.yml b/orb/src/jobs/e2e-test-review.yml deleted file mode 100644 index 65781c895..000000000 --- a/orb/src/jobs/e2e-test-review.yml +++ /dev/null @@ -1,33 +0,0 @@ -parameters: - executor: - default: default - type: executor - aws-account-id: - default: '' - type: string - system-code: - default: '' - type: string - -executor: << parameters.executor >> - -steps: - - attach-workspace - - when: - condition: - and: - - << parameters.aws-account-id >> - - << parameters.system-code >> - steps: - - serverless-assume-role: - aws-account-id: << parameters.aws-account-id >> - system-code: << parameters.system-code >> - - run: - name: Smoke tests - command: npx dotcom-tool-kit test:review - - run: - when: always - name: Teardown review app - command: npx dotcom-tool-kit teardown:review - - store_artifacts: - path: /root/project/e2e-test-results diff --git a/orb/src/jobs/e2e-test-staging.yml b/orb/src/jobs/e2e-test-staging.yml deleted file mode 100644 index 3a42a414b..000000000 --- a/orb/src/jobs/e2e-test-staging.yml +++ /dev/null @@ -1,18 +0,0 @@ -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Run smoke tests on staging - command: npx dotcom-tool-kit test:staging - - run: - when: always - name: Scale down staging - command: npx dotcom-tool-kit teardown:staging - - store_artifacts: - path: /root/project/e2e-test-results diff --git a/orb/src/jobs/heroku-promote.yml b/orb/src/jobs/heroku-promote.yml deleted file mode 100644 index 0cc486e8b..000000000 --- a/orb/src/jobs/heroku-promote.yml +++ /dev/null @@ -1,21 +0,0 @@ -parameters: - executor: - default: default - type: executor - system-code: - default: $CIRCLE_PROJECT_REPONAME - description: >- - The system-code of the system being changed. Defaults to the repository - name. - type: string - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Deploy to production - command: npx dotcom-tool-kit deploy:production - - change-api/change-log: - environment: production - system-code: << parameters.system-code >> diff --git a/orb/src/jobs/heroku-provision.yml b/orb/src/jobs/heroku-provision.yml deleted file mode 100644 index 4cc4e626d..000000000 --- a/orb/src/jobs/heroku-provision.yml +++ /dev/null @@ -1,28 +0,0 @@ -parameters: - executor: - default: default - type: executor - aws-account-id: - default: '' - type: string - system-code: - default: '' - type: string - -executor: << parameters.executor >> - -steps: - - attach-workspace - - when: - condition: - and: - - << parameters.aws-account-id >> - - << parameters.system-code >> - steps: - - serverless-assume-role: - aws-account-id: << parameters.aws-account-id >> - system-code: << parameters.system-code >> - - run: - name: Create and test Heroku review app - command: npx dotcom-tool-kit deploy:review - - persist-workspace diff --git a/orb/src/jobs/heroku-staging.yml b/orb/src/jobs/heroku-staging.yml deleted file mode 100644 index f2105b12c..000000000 --- a/orb/src/jobs/heroku-staging.yml +++ /dev/null @@ -1,13 +0,0 @@ -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Deploy to staging - command: npx dotcom-tool-kit deploy:staging - - persist-workspace diff --git a/orb/src/jobs/publish-tag.yml b/orb/src/jobs/publish-tag.yml deleted file mode 100644 index 53346646f..000000000 --- a/orb/src/jobs/publish-tag.yml +++ /dev/null @@ -1,12 +0,0 @@ -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Publish to npm - command: npx dotcom-tool-kit publish:tag diff --git a/orb/src/jobs/publish.yml b/orb/src/jobs/publish.yml deleted file mode 100644 index 53346646f..000000000 --- a/orb/src/jobs/publish.yml +++ /dev/null @@ -1,12 +0,0 @@ -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Publish to npm - command: npx dotcom-tool-kit publish:tag diff --git a/orb/src/jobs/setup.yml b/orb/src/jobs/setup.yml deleted file mode 100644 index b7c618126..000000000 --- a/orb/src/jobs/setup.yml +++ /dev/null @@ -1,20 +0,0 @@ -parameters: - executor: - default: default - type: executor - npm-version: - description: This value is deprecated and no longer used. We now use Node's bundled version of npm. - default: "" - type: string - -executor: << parameters.executor >> - -steps: - - attach-workspace - - when: - condition: << parameters.npm-version >> - steps: - - run: sudo npm install -g npm@$PARAM_NPM_VERSION - - node/install-packages - - persist-workspace: - path: . diff --git a/orb/src/jobs/test.yml b/orb/src/jobs/test.yml deleted file mode 100644 index 72c226eb3..000000000 --- a/orb/src/jobs/test.yml +++ /dev/null @@ -1,20 +0,0 @@ -parameters: - executor: - default: default - type: executor - -executor: << parameters.executor >> - -steps: - - attach-workspace - - run: - name: Run tests - command: "npx dotcom-tool-kit test:ci" - environment: - JEST_JUNIT_OUTPUT: test-results/jest/results.xml # TODO change depending on which test plugin is running? or actually, move this into the plugin? or do it as tool kit config. hmm - MOCHA_FILE: test-results/mocha/results.xml - - store_test_results: - path: test-results - - store_artifacts: - path: test-results - destination: test-results diff --git a/orb/src/tests/README.md b/orb/src/tests/README.md deleted file mode 100644 index ccd0b078d..000000000 --- a/orb/src/tests/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# tests/ - -This is where your testing scripts for whichever language is embeded in your orb live, which can be executed locally and within a CircleCI pipeline prior to publishing. - -# Testing Orbs - -This orb is built using the `circleci orb pack` command, which allows the _command_ logic to be separated out into separate _shell script_ `.sh` files. Because the logic now sits in a known and executable language, it is possible to perform true unit testing using existing frameworks such a [BATS-Core](https://github.com/bats-core/bats-core#installing-bats-from-source). - -## **Example _command.yml_** - -```yaml - -description: A sample command - -parameters: - source: - description: "source path parameter example" - type: string - default: src - -steps: - - run: - name: "Ensure destination path" - environment: - ORB_SOURCE_PATH: <> - command: <> -``` - -## **Example _command.sh_** - -```bash - -CreatePackage() { - cd "$ORB_SOURCE_PATH" && make - # Build some application at the source location - # In this example, let's assume given some - # sample application and known inputs, - # we expect a certain logfile would be generated. -} - -# Will not run if sourced from another script. -# This is done so this script may be tested. -if [[ "$_" == "$0" ]]; then - CreatePackage -fi - -``` - -We want our script to execute when running in our CI environment or locally, but we don't want to execute our script if we are testing it. In the case of testing, we only want to source the functions within our script,t his allows us to mock inputs and test individual functions. - -**A POSIX Compliant Source Checking Method:** - -```shell -# Will not run if sourced for bats. -# View src/tests for more information. -TEST_ENV="bats-core" -if [ "${0#*$TEST_ENV}" == "$0" ]; then - RUN CODE -fi -``` - -**Example _command_tests.bats_** - -BATS-Core is a useful testing framework for shell scripts. Using the "source checking" methods above, we can source our shell scripts from within our BATS tests without executing any code. This allows us to call specific functions and test their output. - -```bash -# Runs prior to every test. -setup() { - # Load functions from our script file. - # Ensure the script will not execute as - # shown in the above script example. - source ./src/scripts/command.sh -} - -@test '1: Test Build Results' { - # Mock environment variables or functions by exporting them (after the script has been sourced) - export ORB_SOURCE_PATH="src/my-sample-app" - CreatePackage - # test the results - grep -e 'RESULT="success"' log.txt -} - -``` - -Tests can contain any valid shell code. Any error codes returned during a test will result in a test failure. - -In this example, we grep the contents of `log.txt.` which should contain a `success` result if the `CreatePackage` function we had loaded executed successfully. - -## See: - - [BATS Orb](https://circleci.com/orbs/registry/orb/circleci/bats) - - [Orb Testing CircleCI Docs](https://circleci.com/docs/2.0/testing-orbs) - - [BATS-Core GitHub](https://github.com/bats-core/bats-core) diff --git a/orb/version.txt b/orb/version.txt deleted file mode 100644 index 26d99a283..000000000 --- a/orb/version.txt +++ /dev/null @@ -1 +0,0 @@ -5.2.1 From a9107f489a4a639f1d16e55105159f28677db595 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Tue, 11 Nov 2025 15:38:25 +0000 Subject: [PATCH 02/10] feat(circleci)!: don't output orb-related config --- .../circleci-deploy.test.ts.snap | 156 +++++++++++++----- plugins/circleci-npm/readme.md | 10 +- .../__snapshots__/circleci-npm.test.ts.snap | 76 ++++++--- plugins/circleci/src/circleci-config.ts | 106 +++--------- .../circleci-config.test.ts.snap | 59 ++++--- plugins/circleci/test/circleci-config.test.ts | 78 ++------- .../with-workflow-job/.circleci/config.yml | 6 +- 7 files changed, 253 insertions(+), 238 deletions(-) diff --git a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap index 17e82fc9b..cc7e11fb1 100644 --- a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap +++ b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap @@ -2,8 +2,6 @@ exports[`circleci-deploy config integration test should generate a .circleci/config.yml with the base config from circleci-deploy/.toolkitrc.yml 1`] = ` "version: 2.1 -orbs: - tool-kit: financial-times/dotcom-tool-kit@5 executors: node: docker: @@ -14,12 +12,99 @@ jobs: - image: cimg/base:stable steps: - checkout - - tool-kit/persist-workspace: - path: . + - persist_to_workspace: + root: . + paths: + - . + build: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: build + command: npx dotcom-tool-kit build:ci + - persist_to_workspace: + root: . + paths: + - . + test: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: test + command: npx dotcom-tool-kit test:ci + - persist_to_workspace: + root: . + paths: + - . + deploy-review: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: deploy-review + command: npx dotcom-tool-kit deploy:review + - persist_to_workspace: + root: . + paths: + - . + deploy-staging: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: deploy-staging + command: npx dotcom-tool-kit deploy:staging + - persist_to_workspace: + root: . + paths: + - . + e2e-test-review: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: e2e-test-review + command: npx dotcom-tool-kit test:review + - persist_to_workspace: + root: . + paths: + - . + e2e-test-staging: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: e2e-test-staging + command: npx dotcom-tool-kit test:staging + - persist_to_workspace: + root: . + paths: + - . + deploy-production: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: deploy-production + command: npx dotcom-tool-kit deploy:production + - persist_to_workspace: + root: . + paths: + - . teardown-review: executor: node steps: - - tool-kit/attach-workspace + - attach_workspace: + at: . - run: name: teardown-review command: npx dotcom-tool-kit teardown:review @@ -37,59 +122,52 @@ workflows: filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/setup: + - setup: executor: node requires: - checkout filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/build: - executor: node + - build: requires: - - tool-kit/setup + - setup filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/test: - executor: node + - test: requires: - - tool-kit/build + - build filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/deploy-review: - executor: node + - deploy-review: requires: - - tool-kit/build + - build filters: branches: ignore: main - - tool-kit/deploy-staging: - executor: node + - deploy-staging: requires: - - tool-kit/build + - build filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ branches: only: main - - tool-kit/e2e-test-review: - executor: node + - e2e-test-review: requires: - - tool-kit/deploy-review - - tool-kit/e2e-test-staging: - executor: node + - deploy-review + - e2e-test-staging: requires: - - tool-kit/deploy-staging + - deploy-staging filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/deploy-production: - executor: node + - deploy-production: requires: - - tool-kit/test - - tool-kit/e2e-test-staging + - test + - e2e-test-staging filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ @@ -106,22 +184,19 @@ workflows: - << pipeline.schedule.name >> jobs: - checkout - - tool-kit/setup: + - setup: executor: node requires: - checkout - - tool-kit/build: - executor: node + - build: requires: - - tool-kit/setup - - tool-kit/test: - executor: node + - setup + - test: requires: - - tool-kit/build - - tool-kit/deploy-review: - executor: node + - build + - deploy-review: requires: - - tool-kit/build + - build filters: branches: ignore: main @@ -129,13 +204,12 @@ workflows: jobs: - checkout: requires: [] - - tool-kit/setup: - executor: node + - setup: requires: - checkout - teardown-review: requires: - - tool-kit/setup + - setup when: > pipeline.trigger_source != "scheduled_pipeline" and diff --git a/plugins/circleci-npm/readme.md b/plugins/circleci-npm/readme.md index e7b81b68b..f6f9df1fb 100644 --- a/plugins/circleci-npm/readme.md +++ b/plugins/circleci-npm/readme.md @@ -2,7 +2,7 @@ This plugin is for managing the `publish:tag` hook that is run from circleci to publish the built package to the npm registry. -The tool-kit/publish job is triggered in your circleci pipeline once you do a release with a tag matching the semver format. If your tag is a beta version, i.e. `v1.6.0-beta.1`, then the publish job will tag your build as a prerelease version. If your tag is a release version, i.e. `v1.6.0`, then the publish job will tag your build as the latest version. +The `publish` job is triggered in your circleci pipeline once you do a release with a tag matching the semver format. If your tag is a beta version, i.e. `v1.6.0-beta.1`, then the publish job will tag your build as a prerelease version. If your tag is a release version, i.e. `v1.6.0`, then the publish job will tag your build as the latest version. This plugin will be installed as a dependency of the [component](https://github.com/Financial-Times/dotcom-tool-kit/tree/main/plugins/component) plugin so you do not need to install it separately if you are using either of those plugins. @@ -34,17 +34,17 @@ If you are migrating your project to Tool Kit for the first time then this plugi ### Adding to an existing Tool Kit generated CircleCI `config.yml` -If you have the automated comment `# CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND\n` in your `config.yml`, running the install command will add the tool-kit/publish job to your `config.yml`. Furthermore, this will add the tags filter to the rest of the tool-kit jobs in your workflow in `config.yml`, as CircleCI will only run the jobs if the rest of the jobs have the tags filter. +If you have the automated comment `# CONFIG GENERATED BY DOTCOM-TOOL-KIT, DO NOT EDIT BY HAND\n` in your `config.yml`, running the install command will add the `publish` job to your `config.yml`. Furthermore, this will add the tags filter to the rest of the tool-kit jobs in your workflow in `config.yml`, as CircleCI will only run the jobs if the rest of the jobs have the tags filter. ### Adding to a custom CircleCI `config.yml` -If you don't have the automated comment in your `config.yml` and therefore choose to add the tool-kit/publish job manually, (1) copy and paste the below code snippet and (2) add the tags filter to the rest of the tool-kit jobs: +If you don't have the automated comment in your `config.yml` and therefore choose to add the `publish` job manually, (1) copy and paste the below code snippet and (2) add the tags filter to the rest of the tool-kit jobs: ```yaml - - tool-kit/publish: + - publish: context: npm-publish-token requires: - - tool-kit/test + - test filters: branches: ignore: /.*/ diff --git a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap index 5c67f475e..4d1267435 100644 --- a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap +++ b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap @@ -2,8 +2,6 @@ exports[`circleci-npm config integration test should generate a .circleci/config.yml with the base config from circleci-npm/.toolkitrc.yml 1`] = ` "version: 2.1 -orbs: - tool-kit: financial-times/dotcom-tool-kit@5 executors: node: docker: @@ -14,8 +12,46 @@ jobs: - image: cimg/base:stable steps: - checkout - - tool-kit/persist-workspace: - path: . + - persist_to_workspace: + root: . + paths: + - . + build: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: build + command: npx dotcom-tool-kit build:ci + - persist_to_workspace: + root: . + paths: + - . + test: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: test + command: npx dotcom-tool-kit test:ci + - persist_to_workspace: + root: . + paths: + - . + publish-tag: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: publish-tag + command: npx dotcom-tool-kit publish:tag + - persist_to_workspace: + root: . + paths: + - . workflows: tool-kit: when: @@ -28,31 +64,28 @@ workflows: filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/setup: + - setup: executor: node requires: - checkout filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/build: - executor: node + - build: requires: - - tool-kit/setup + - setup filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/test: - executor: node + - test: requires: - - tool-kit/build + - build filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/publish-tag: - executor: node + - publish-tag: requires: - - tool-kit/test + - test filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ @@ -70,24 +103,21 @@ workflows: - << pipeline.schedule.name >> jobs: - checkout - - tool-kit/setup: + - setup: executor: node requires: - checkout - - tool-kit/build: - executor: node + - build: requires: - - tool-kit/setup - - tool-kit/test: - executor: node + - setup + - test: requires: - - tool-kit/build + - build pr-close: jobs: - checkout: requires: [] - - tool-kit/setup: - executor: node + - setup: requires: - checkout when: > diff --git a/plugins/circleci/src/circleci-config.ts b/plugins/circleci/src/circleci-config.ts index 88c48f16f..0b9d14e3a 100644 --- a/plugins/circleci/src/circleci-config.ts +++ b/plugins/circleci/src/circleci-config.ts @@ -50,9 +50,6 @@ type WorkflowJob = string | { [job: string]: WorkflowJobConfig } // moment and constantly requires updates whenever we change the code interface CircleConfig { version: 2.1 - orbs: { - [orb: string]: string - } executors: { [executor: string]: { docker: { image: string }[] @@ -69,26 +66,6 @@ interface CircleConfig { } } -// HACK:KB:20241210 we don't output jobs that are currently in the orb. remove this when we delete the orb -const orbJobs = [ - 'build-test', - 'build', - 'deploy-production', - 'deploy-review', - 'deploy-staging', - 'e2e-test-review', - 'e2e-test-staging', - 'heroku-promote', - 'heroku-provision', - 'heroku-staging', - 'publish-tag', - 'publish', - 'setup', - 'test' -] - -const MAJOR_ORB_VERSION = '5' - export type CircleCIState = CircleConfig /** * CircleCIStatePartial makes every property in the config object optional, @@ -131,15 +108,10 @@ const mergeWithConcatenatedArrays = (arg0: unknown, ...args: unknown[]) => const getBaseConfig = (nodeVersions: string[], tagFilterRegex?: string): CircleCIState => { const runsOnMultipleNodeVersions = nodeVersions.length > 1 const setupMatrix = runsOnMultipleNodeVersions - ? matrixBoilerplate('tool-kit/setup', nodeVersions) + ? matrixBoilerplate('setup', nodeVersions) : { executor: 'node' } return { version: 2.1, - orbs: { - 'tool-kit': process.env.TOOL_KIT_FORCE_DEV_ORB - ? 'financial-times/dotcom-tool-kit@dev:alpha' - : `financial-times/dotcom-tool-kit@${MAJOR_ORB_VERSION}` - }, executors: Object.fromEntries( nodeVersions.map((version, i) => [ nodeVersionToExecutor(version, i), @@ -164,7 +136,7 @@ const getBaseConfig = (nodeVersions: string[], tagFilterRegex?: string): CircleC jobs: [ tagFilterRegex ? { checkout: tagFilter(tagFilterRegex) } : 'checkout', { - 'tool-kit/setup': { + setup: { ...setupMatrix, requires: ['checkout'], ...(tagFilterRegex ? tagFilter(tagFilterRegex) : {}) @@ -183,7 +155,7 @@ const getBaseConfig = (nodeVersions: string[], tagFilterRegex?: string): CircleC } ] }, - jobs: ['checkout', { 'tool-kit/setup': { ...setupMatrix, requires: ['checkout'] } }] + jobs: ['checkout', { setup: { ...setupMatrix, requires: ['checkout'] } }] } } } @@ -361,39 +333,17 @@ const generateWorkflowJobs = ( workflow: CircleCiWorkflow, nodeVersions: string[], tagFilterRegex?: string, - customJobs?: CircleCiJob[] + jobDefinitions?: CircleCiJob[] ): WorkflowJob[] | undefined => { - // HACK:20250106:IM We were previously implicitly prepending a tool-kit/ - // prefix to workflow job names, as it was assumed that they all were - // referencing jobs from the Tool Kit orb. However, many custom plugins - // define custom jobs which need to be referenced too. To avoid a breaking - // change where we require the tool-kit/ prefix to be explicit, let's try an - // infer whether to prepend the prefix or not. - const jobsShouldBeBare = (workflow.jobs ?? []).reduce((acc, job) => { - const shouldBeBare = - // custom jobs won't want the tool-kit/ prefix - (!orbJobs.includes(job.name) && customJobs?.some(({ name }) => job.name === name)) || - // approval jobs don't need to be declared as a custom job before using - job.custom?.type === 'approval' || - // a slash implies an orb job so we don't want to add another prefix - job.name.includes('/') || - // the checkout job is a special case defined by the base config in this hook - job.name === 'checkout' - acc.set(job.name, shouldBeBare) - return acc - }, new Map()) - const toolKitOrbPrefix = (job: string) => (jobsShouldBeBare.get(job) ? job : `tool-kit/${job}`) - const runsOnMultipleNodeVersions = nodeVersions.length > 1 const getExecutorCount = (workflowJob: CircleCiWorkflowJob): ExecutorCount => { - const prefixedName = toolKitOrbPrefix(workflowJob.name) - const customJob = customJobs?.find(({ name }) => workflowJob.name === name) + const jobDefinition = jobDefinitions?.find(({ name }) => workflowJob.name === name) if ( // The job will have an executor parameter that we'll have to pass a - // value to if it's from the orb or if it's a custom job that needs to be - // run for multiple Node versions - prefixedName.startsWith('tool-kit/') || - (runsOnMultipleNodeVersions && customJob && (customJob.splitIntoMatrix ?? true)) + // value to if it's a job that wants to be run for multiple Node versions + runsOnMultipleNodeVersions && + jobDefinition && + (jobDefinition.splitIntoMatrix ?? true) ) { // If the job does require an executor parameter, either return a matrix // of all the Node versions or just the latest Node version, depending on @@ -412,8 +362,6 @@ const generateWorkflowJobs = ( } return workflow.jobs?.map((job) => { - const prefixedName = toolKitOrbPrefix(job.name) - const executorCount = getExecutorCount(job) let executorParameter switch (executorCount) { @@ -424,12 +372,12 @@ const generateWorkflowJobs = ( executorParameter = { executor: 'node' } break case 'matrix': - executorParameter = matrixBoilerplate(prefixedName, nodeVersions) + executorParameter = matrixBoilerplate(job.name, nodeVersions) break } return { - [prefixedName]: merge( + [job.name]: merge( executorParameter, { requires: @@ -439,20 +387,15 @@ const generateWorkflowJobs = ( return [required, 'none'] } - // HACK:20250106:IM allow plugins to require orb jobs using the - // tool-kit/ prefix as that's what we want to move towards anyway - const normalisedRequired = required.replace(/^tool-kit\//, '') - const requiredOrb = toolKitOrbPrefix(normalisedRequired) - - if (requiredOrb === 'tool-kit/setup') { - return [requiredOrb, runsOnMultipleNodeVersions ? 'matrix' : 'none'] + if (required === 'setup') { + return [required, runsOnMultipleNodeVersions ? 'matrix' : 'none'] } /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- * if this arrow function is running then the array is defined */ const workflowJobs = workflow.jobs! - const requiredJob = workflowJobs.find(({ name: jobName }) => normalisedRequired === jobName) + const requiredJob = workflowJobs.find(({ name: jobName }) => required === jobName) if (!requiredJob) { const error = new ToolKitError( `CircleCI job ${styles.code(job.name)} in workflow ${styles.code( @@ -464,7 +407,7 @@ const generateWorkflowJobs = ( .join('\n')}` throw error } - return [requiredOrb, getExecutorCount(requiredJob)] + return [required, getExecutorCount(requiredJob)] } const [requiredName, requiredExecutorCount] = getRequiredData() @@ -485,12 +428,17 @@ const generateWorkflowJobs = ( } const persistWorkspaceStep = { - 'tool-kit/persist-workspace': { - path: '.' + persist_to_workspace: { + root: '.', + paths: ['.'] } } -const attachWorkspaceStep = 'tool-kit/attach-workspace' +const attachWorkspaceStep = { + attach_workspace: { + at: '.' + } +} const generateJob = (job: CircleCiJob, nodeVersions: string[]): JobConfig => ({ ...((job.splitIntoMatrix ?? true) && nodeVersions.length > 1 @@ -603,11 +551,9 @@ export default class CircleCi extends Hook< } if (this.options.jobs) { generated.jobs = Object.fromEntries( - this.options.jobs - .filter((job) => !orbJobs.includes(job.name)) - .map((job) => { - return [job.name, generateJob(job, nodeVersions)] - }) + this.options.jobs.map((job) => { + return [job.name, generateJob(job, nodeVersions)] + }) ) } if (this.options.workflows) { diff --git a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap index fbc39d3c0..4a9247779 100644 --- a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap +++ b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap @@ -2,8 +2,6 @@ exports[`CircleCI config hook config integration test should generate a .circleci/config.yml with the base config from circleci/.toolkitrc.yml 1`] = ` "version: 2.1 -orbs: - tool-kit: financial-times/dotcom-tool-kit@5 executors: node: docker: @@ -14,8 +12,34 @@ jobs: - image: cimg/base:stable steps: - checkout - - tool-kit/persist-workspace: - path: . + - persist_to_workspace: + root: . + paths: + - . + build: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: build + command: npx dotcom-tool-kit build:ci + - persist_to_workspace: + root: . + paths: + - . + test: + executor: node + steps: + - attach_workspace: + at: . + - run: + name: test + command: npx dotcom-tool-kit test:ci + - persist_to_workspace: + root: . + paths: + - . workflows: tool-kit: when: @@ -28,24 +52,22 @@ workflows: filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/setup: + - setup: executor: node requires: - checkout filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/build: - executor: node + - build: requires: - - tool-kit/setup + - setup filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - - tool-kit/test: - executor: node + - test: requires: - - tool-kit/build + - build filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ @@ -60,24 +82,21 @@ workflows: - << pipeline.schedule.name >> jobs: - checkout - - tool-kit/setup: + - setup: executor: node requires: - checkout - - tool-kit/build: - executor: node + - build: requires: - - tool-kit/setup - - tool-kit/test: - executor: node + - setup + - test: requires: - - tool-kit/build + - build pr-close: jobs: - checkout: requires: [] - - tool-kit/setup: - executor: node + - setup: requires: - checkout when: > diff --git a/plugins/circleci/test/circleci-config.test.ts b/plugins/circleci/test/circleci-config.test.ts index 8aeba2e5e..bf48fd488 100644 --- a/plugins/circleci/test/circleci-config.test.ts +++ b/plugins/circleci/test/circleci-config.test.ts @@ -133,16 +133,16 @@ describe('CircleCI config hook', () => { "tool-kit": { "jobs": [ { - "tool-kit/that-job": { + "that-job": { "executor": "node", "requires": [], }, }, { - "tool-kit/test-job": { + "test-job": { "executor": "node", "requires": [ - "tool-kit/that-job", + "that-job", ], }, }, @@ -166,7 +166,11 @@ describe('CircleCI config hook', () => { "test-job": { "executor": "node", "steps": [ - "tool-kit/attach-workspace", + { + 'attach_workspace': { + at: '.' + } + }, { "run": { "command": "npx dotcom-tool-kit test:local", @@ -174,9 +178,10 @@ describe('CircleCI config hook', () => { }, }, { - "tool-kit/persist-workspace": { - "path": ".", - }, + 'persist_to_workspace': { + root: '.', + paths: ['.'] + } }, ], }, @@ -215,65 +220,6 @@ describe('CircleCI config hook', () => { } `) }) - - it("shouldn't prefix a workflow job generated by this hook", async () => { - process.chdir(path.join(__dirname, 'files', 'managed', 'without-workflow-job')) - - const hook = new CircleCi( - logger, - 'CircleCi', - { - ...configWithJob, - ...configWithWorkflowJob - }, - { - cimgNodeVersions: ['16.14-browsers'] - } - ) - - expect(await hook.install()).toMatchInlineSnapshot(` - { - "jobs": { - "test-job": { - "executor": "node", - "steps": [ - "tool-kit/attach-workspace", - { - "run": { - "command": "npx dotcom-tool-kit test:local", - "name": "test-job", - }, - }, - { - "tool-kit/persist-workspace": { - "path": ".", - }, - }, - ], - }, - }, - "workflows": { - "tool-kit": { - "jobs": [ - { - "tool-kit/that-job": { - "executor": "node", - "requires": [], - }, - }, - { - "test-job": { - "requires": [ - "tool-kit/that-job", - ], - }, - }, - ], - }, - }, - } - `) - }) }) describe('conflict resolution', () => { diff --git a/plugins/circleci/test/files/unmanaged/with-workflow-job/.circleci/config.yml b/plugins/circleci/test/files/unmanaged/with-workflow-job/.circleci/config.yml index f1486f787..a3abb5db6 100644 --- a/plugins/circleci/test/files/unmanaged/with-workflow-job/.circleci/config.yml +++ b/plugins/circleci/test/files/unmanaged/with-workflow-job/.circleci/config.yml @@ -1,10 +1,10 @@ workflows: tool-kit: jobs: - - tool-kit/that-job: + - that-job: requires: [] executor: node - - tool-kit/test-job: + - test-job: requires: - - tool-kit/that-job + - that-job executor: node From 8f118b668c9837046189f9ef7c048e0efced5471 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Tue, 11 Nov 2025 15:41:12 +0000 Subject: [PATCH 03/10] backstage: clean up references to orb --- .release-please-manifest.json | 1 - plugins/circleci-deploy/readme.md | 2 +- plugins/circleci/test/circleci-config.test.ts | 42 ------------------- release-please-config.json | 4 -- scripts/circleci-publish.sh | 5 +-- 5 files changed, 2 insertions(+), 52 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b3ebd958a..7f65e214e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -8,7 +8,6 @@ "lib/types": "3.6.1", "lib/vault": "3.2.1", "lib/wait-for-ok": "5.0.0", - "orb": "5.2.1", "plugins/babel": "5.0.0", "plugins/backend-app": "3.2.6", "plugins/circleci": "8.0.0", diff --git a/plugins/circleci-deploy/readme.md b/plugins/circleci-deploy/readme.md index d6a19afec..38537bb10 100644 --- a/plugins/circleci-deploy/readme.md +++ b/plugins/circleci-deploy/readme.md @@ -31,7 +31,7 @@ If you are migrating your project to Tool Kit for the first time then this plugi ### Adding to a custom CircleCI `config.yml` -See [manually adding jobs to your CircleCI config](https://github.com/Financial-Times/dotcom-tool-kit/tree/main/orb#manually) +See [extending Tool Kit](https://github.com/Financial-Times/dotcom-tool-kit/tree/main/docs/extending-tool-kit.md#running-existing-tool-kit-tasks-in-new-scenarios) ## Hooks diff --git a/plugins/circleci/test/circleci-config.test.ts b/plugins/circleci/test/circleci-config.test.ts index bf48fd488..5858a99ff 100644 --- a/plugins/circleci/test/circleci-config.test.ts +++ b/plugins/circleci/test/circleci-config.test.ts @@ -28,12 +28,6 @@ const dependedWorkflowJob: CircleCiWorkflowJob = { splitIntoMatrix: false } -const testPrefixedWorkflowJob: CircleCiWorkflowJob = { - name: 'slack/approval-notification', - requires: ['another/orb'], - splitIntoMatrix: false -} - const overriddenTestJob: CircleCiJob = { ...testJob, command: 'test:override' } const anotherTestJob: CircleCiJob = { name: 'another-test-job', @@ -51,11 +45,6 @@ const configWithWorkflowJob: CircleCiOptions = { disableBaseConfig: true } -const configWithPrefixedWorkflowJob: CircleCiOptions = { - workflows: [{ name: 'tool-kit', jobs: [{ name: 'another/orb', requires: [] }, testPrefixedWorkflowJob] }], - disableBaseConfig: true -} - const configWithJob: CircleCiOptions = { jobs: [testJob], disableBaseConfig: true @@ -189,37 +178,6 @@ describe('CircleCI config hook', () => { } `) }) - - it("shouldn't prefix a workflow job or requires with the tool kit orb if it references another orb", async () => { - process.chdir(path.join(__dirname, 'files', 'managed', 'without-workflow-job')) - - const hook = new CircleCi(logger, 'CircleCi', configWithPrefixedWorkflowJob, { - cimgNodeVersions: ['16.14-browsers'] - }) - - expect(await hook.install()).toMatchInlineSnapshot(` - { - "workflows": { - "tool-kit": { - "jobs": [ - { - "another/orb": { - "requires": [], - }, - }, - { - "slack/approval-notification": { - "requires": [ - "another/orb", - ], - }, - }, - ], - }, - }, - } - `) - }) }) describe('conflict resolution', () => { diff --git a/release-please-config.json b/release-please-config.json index 184878723..e78db3182 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -17,10 +17,6 @@ "lib/state": {}, "lib/validated": {}, "lib/wait-for-ok": {}, - "orb": { - "package-name": "orb", - "release-type": "simple" - }, "plugins/aws": {}, "plugins/babel": {}, "plugins/backend-heroku-app": {}, diff --git a/scripts/circleci-publish.sh b/scripts/circleci-publish.sh index e3e6ebdbe..d6159cde3 100755 --- a/scripts/circleci-publish.sh +++ b/scripts/circleci-publish.sh @@ -9,10 +9,7 @@ if [[ ! $CIRCLE_TAG =~ $pattern ]]; then fi workspace=${BASH_REMATCH[1]} -if [[ $workspace = "orb" ]]; then - echo "skipping orb package" - exit 0 -elif [[ $workspace != 'dotcom-tool-kit' ]]; then +if [[ $workspace != 'dotcom-tool-kit' ]]; then workspace="@dotcom-tool-kit/$workspace" fi From d5a2588c86d20d5f5e9681c1b594b0ce359dc2ed Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Tue, 11 Nov 2025 15:42:42 +0000 Subject: [PATCH 04/10] ci: remove orb publish workflow --- .circleci/config.yml | 64 -------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6bcbcef45..3530654b9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,8 +1,5 @@ version: 2.1 -orbs: - orb-tools: circleci/orb-tools@10.0.5 - references: # # Workspace @@ -81,15 +78,6 @@ references: branches: ignore: /.*/ - filters_orbs_release_build: - &filters_orbs_release_build - tags: - only: - # CircleCI doesn't allow prerelease versions to be published - - /^orb-v\d+\.\d+\.\d+$/ - branches: - ignore: /.*/ - jobs: build: <<: *container_config_node @@ -310,55 +298,3 @@ workflows: matrix: parameters: node-version: [ '20.18', '22.12' ] - - # Prior to producing a development orb (which requires credentials) basic validation, linting, and even unit testing can be performed. - # This workflow will run on every commit - orb-test-pack: - when: - not: - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> - jobs: - # Lint Yaml files - - orb-tools/lint: - lint-dir: orb - # Pack orb source - - orb-tools/pack: - source-dir: orb/src - # Publish development version(s) of the orb. - - orb-tools/publish-dev: - context: circleci-orb-publishing - orb-name: financial-times/dotcom-tool-kit - requires: - - orb-tools/lint - - orb-tools/pack - - orb-integration-test_deploy: - when: - not: - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> - jobs: - # Lint Yaml files - - orb-tools/lint: - lint-dir: orb - filters: - <<: *filters_orbs_release_build - # Pack orb source - - orb-tools/pack: - source-dir: orb/src - filters: - <<: *filters_orbs_release_build - - orb-tools/publish: - context: circleci-orb-publishing - attach-workspace: true - # Strip leading 'orb-v' from git tag - orb-ref: financial-times/dotcom-tool-kit@${CIRCLE_TAG:5} - filters: - <<: *filters_orbs_release_build - requires: - # - integration-test-1 - - orb-tools/lint - - orb-tools/pack From 016437574dea0ed9952eeeab2b04cdd80dd1836b Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 12 Nov 2025 13:53:18 +0000 Subject: [PATCH 05/10] feat(circleci): allow specifying paths to persist in workspace, default to .toolkitstate --- .../__snapshots__/circleci-deploy.test.ts.snap | 14 +++++++------- .../__snapshots__/circleci-npm.test.ts.snap | 6 +++--- plugins/circleci/src/circleci-config.ts | 10 +++++----- plugins/circleci/src/schemas/hook.ts | 2 +- .../__snapshots__/circleci-config.test.ts.snap | 4 ++-- plugins/circleci/test/circleci-config.test.ts | 18 +++++++++--------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap index cc7e11fb1..2ae17cfff 100644 --- a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap +++ b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap @@ -27,7 +27,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate test: executor: node steps: @@ -39,7 +39,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate deploy-review: executor: node steps: @@ -51,7 +51,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate deploy-staging: executor: node steps: @@ -63,7 +63,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate e2e-test-review: executor: node steps: @@ -75,7 +75,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate e2e-test-staging: executor: node steps: @@ -87,7 +87,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate deploy-production: executor: node steps: @@ -99,7 +99,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate teardown-review: executor: node steps: diff --git a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap index 4d1267435..e7b9cba65 100644 --- a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap +++ b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap @@ -27,7 +27,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate test: executor: node steps: @@ -39,7 +39,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate publish-tag: executor: node steps: @@ -51,7 +51,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate workflows: tool-kit: when: diff --git a/plugins/circleci/src/circleci-config.ts b/plugins/circleci/src/circleci-config.ts index 0b9d14e3a..1e4c3972e 100644 --- a/plugins/circleci/src/circleci-config.ts +++ b/plugins/circleci/src/circleci-config.ts @@ -123,7 +123,7 @@ const getBaseConfig = (nodeVersions: string[], tagFilterRegex?: string): CircleC jobs: { checkout: { docker: [{ image: 'cimg/base:stable' }], - steps: ['checkout', persistWorkspaceStep] + steps: ['checkout', persistWorkspaceStep(['.'])] } }, workflows: { @@ -427,12 +427,12 @@ const generateWorkflowJobs = ( }) } -const persistWorkspaceStep = { +const persistWorkspaceStep = (paths: boolean | string[]) => ({ persist_to_workspace: { root: '.', - paths: ['.'] + paths: Array.isArray(paths) ? paths : ['.toolkitstate'] } -} +}) const attachWorkspaceStep = { attach_workspace: { @@ -457,7 +457,7 @@ const generateJob = (job: CircleCiJob, nodeVersions: string[]): JobConfig => ({ } }, ...(job.steps?.post ?? []), - ...(job.workspace?.persist ?? true ? [persistWorkspaceStep] : []) + ...(job.workspace?.persist ?? true ? [persistWorkspaceStep(job.workspace?.persist ?? true)] : []) ], ...job.custom }) diff --git a/plugins/circleci/src/schemas/hook.ts b/plugins/circleci/src/schemas/hook.ts index 4baaeca1c..9eddffd8b 100644 --- a/plugins/circleci/src/schemas/hook.ts +++ b/plugins/circleci/src/schemas/hook.ts @@ -20,7 +20,7 @@ export const CircleCiJob = z command: z.string(), workspace: z .object({ - persist: z.boolean().optional(), + persist: z.boolean().or(z.array(z.string())).optional(), attach: z.boolean().optional() }) .optional(), diff --git a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap index 4a9247779..d02e2c0da 100644 --- a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap +++ b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap @@ -27,7 +27,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate test: executor: node steps: @@ -39,7 +39,7 @@ jobs: - persist_to_workspace: root: . paths: - - . + - .toolkitstate workflows: tool-kit: when: diff --git a/plugins/circleci/test/circleci-config.test.ts b/plugins/circleci/test/circleci-config.test.ts index 5858a99ff..b972bc160 100644 --- a/plugins/circleci/test/circleci-config.test.ts +++ b/plugins/circleci/test/circleci-config.test.ts @@ -123,13 +123,11 @@ describe('CircleCI config hook', () => { "jobs": [ { "that-job": { - "executor": "node", "requires": [], }, }, { "test-job": { - "executor": "node", "requires": [ "that-job", ], @@ -156,9 +154,9 @@ describe('CircleCI config hook', () => { "executor": "node", "steps": [ { - 'attach_workspace': { - at: '.' - } + "attach_workspace": { + "at": ".", + }, }, { "run": { @@ -167,10 +165,12 @@ describe('CircleCI config hook', () => { }, }, { - 'persist_to_workspace': { - root: '.', - paths: ['.'] - } + "persist_to_workspace": { + "paths": [ + ".toolkitstate", + ], + "root": ".", + }, }, ], }, From 05d18cfbffe2c20c7b02a07a11f76fe143ed0afb Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 12 Nov 2025 13:57:06 +0000 Subject: [PATCH 06/10] feat(circleci): persist entire workspace in build job --- .../test/__snapshots__/circleci-deploy.test.ts.snap | 2 +- .../circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap | 2 +- plugins/circleci/.toolkitrc.yml | 2 ++ .../circleci/test/__snapshots__/circleci-config.test.ts.snap | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap index 2ae17cfff..787da995e 100644 --- a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap +++ b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap @@ -27,7 +27,7 @@ jobs: - persist_to_workspace: root: . paths: - - .toolkitstate + - . test: executor: node steps: diff --git a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap index e7b9cba65..6ae3af11d 100644 --- a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap +++ b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap @@ -27,7 +27,7 @@ jobs: - persist_to_workspace: root: . paths: - - .toolkitstate + - . test: executor: node steps: diff --git a/plugins/circleci/.toolkitrc.yml b/plugins/circleci/.toolkitrc.yml index 84a5e2117..a3d35fee9 100644 --- a/plugins/circleci/.toolkitrc.yml +++ b/plugins/circleci/.toolkitrc.yml @@ -12,6 +12,8 @@ options: jobs: - name: build command: 'build:ci' + workspace: + persist: ['.'] - name: test command: 'test:ci' workflows: diff --git a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap index d02e2c0da..1a742f390 100644 --- a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap +++ b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap @@ -27,7 +27,7 @@ jobs: - persist_to_workspace: root: . paths: - - .toolkitstate + - . test: executor: node steps: From 65e84d8d08b99eca2f88e3d751e89dcb0c82c954 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Wed, 12 Nov 2025 15:42:34 +0000 Subject: [PATCH 07/10] feat(circleci): support completely custom job steps --- plugins/circleci/src/circleci-config.ts | 12 +++++++----- plugins/circleci/src/schemas/hook.ts | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plugins/circleci/src/circleci-config.ts b/plugins/circleci/src/circleci-config.ts index 1e4c3972e..6a683f7b6 100644 --- a/plugins/circleci/src/circleci-config.ts +++ b/plugins/circleci/src/circleci-config.ts @@ -450,12 +450,14 @@ const generateJob = (job: CircleCiJob, nodeVersions: string[]): JobConfig => ({ steps: [ ...(job.workspace?.attach ?? true ? [attachWorkspaceStep] : []), ...(job.steps?.pre ?? []), - { - run: { - name: job.name, - command: `npx dotcom-tool-kit ${job.command}` + ...(job.steps?.custom ?? [ + { + run: { + name: job.name, + command: `npx dotcom-tool-kit ${job.command}` + } } - }, + ]), ...(job.steps?.post ?? []), ...(job.workspace?.persist ?? true ? [persistWorkspaceStep(job.workspace?.persist ?? true)] : []) ], diff --git a/plugins/circleci/src/schemas/hook.ts b/plugins/circleci/src/schemas/hook.ts index 9eddffd8b..312f60c2a 100644 --- a/plugins/circleci/src/schemas/hook.ts +++ b/plugins/circleci/src/schemas/hook.ts @@ -17,7 +17,7 @@ const CircleCiStep = z.union([z.string(), z.record(z.record(z.unknown()))]) export const CircleCiJob = z .object({ name: z.string(), - command: z.string(), + command: z.string().optional(), workspace: z .object({ persist: z.boolean().or(z.array(z.string())).optional(), @@ -27,7 +27,8 @@ export const CircleCiJob = z steps: z .object({ pre: z.array(CircleCiStep).optional(), - post: z.array(CircleCiStep).optional() + post: z.array(CircleCiStep).optional(), + custom: z.array(CircleCiStep).optional() }) .optional(), splitIntoMatrix: z.boolean().optional(), From e4e25fc9ee03c5a13bed8b6d5e898701c1dd747e Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 24 Nov 2025 11:05:47 +0000 Subject: [PATCH 08/10] feat(circleci): move base config and checkout/setup jobs to toolkitrc --- .../test/__snapshots__/config.test.ts.snap | 2324 ++++++++++++++++- .../circleci-deploy.test.ts.snap | 40 +- .../__snapshots__/circleci-npm.test.ts.snap | 40 +- plugins/circleci/.toolkitrc.yml | 32 + plugins/circleci/readme.md | 14 +- plugins/circleci/src/circleci-config.ts | 63 +- .../circleci-config.test.ts.snap | 43 +- 7 files changed, 2438 insertions(+), 118 deletions(-) diff --git a/core/cli/test/__snapshots__/config.test.ts.snap b/core/cli/test/__snapshots__/config.test.ts.snap index a4a7ee790..65b7b3e98 100644 --- a/core/cli/test/__snapshots__/config.test.ts.snap +++ b/core/cli/test/__snapshots__/config.test.ts.snap @@ -6463,10 +6463,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -6475,7 +6515,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -6493,7 +6545,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -6900,10 +6966,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -6912,7 +7018,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -6930,7 +7048,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -7356,10 +7488,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -7368,7 +7540,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -7386,7 +7570,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -7791,10 +7989,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -7803,7 +8041,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -7821,7 +8071,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -8228,10 +8492,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -8240,7 +8544,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -8258,7 +8574,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -8647,10 +8977,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -8659,11 +9029,23 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ { - "name": "build", - "requires": [ - "setup", + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, + { + "name": "build", + "requires": [ + "setup", ], }, { @@ -8677,7 +9059,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -9084,10 +9480,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -9096,7 +9532,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -9114,7 +9562,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -9540,10 +10002,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -9552,7 +10054,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -9570,7 +10084,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -9975,10 +10503,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -9987,7 +10555,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -10005,7 +10585,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -10412,10 +11006,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -10424,7 +11058,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -10442,7 +11088,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -10831,10 +11491,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -10843,7 +11543,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -10861,7 +11573,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -11268,10 +11994,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { - "jobs": [ - { - "command": "build:ci", - "name": "build", + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, + "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "command": "build:ci", + "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -11280,7 +12046,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -11298,7 +12076,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -11724,10 +12516,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -11736,7 +12568,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -11754,7 +12598,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -12159,10 +13017,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -12171,7 +13069,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -12189,7 +13099,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -12596,10 +13520,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -12608,7 +13572,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -12626,7 +13602,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -13013,10 +14003,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -13025,7 +14055,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -13043,7 +14085,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -13451,10 +14507,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -13463,7 +14559,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -13481,7 +14589,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -14126,10 +15248,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -14138,7 +15300,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -14156,7 +15330,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -14315,10 +15503,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -14327,7 +15555,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -14345,7 +15585,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -14998,10 +16252,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -15010,7 +16304,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -15028,7 +16334,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -15434,10 +16754,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -15446,7 +16806,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -15464,7 +16836,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -15682,10 +17068,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -15694,7 +17120,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -15712,7 +17150,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -16116,10 +17568,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -16128,7 +17620,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -16146,7 +17650,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -16551,10 +18069,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -16563,7 +18121,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -16581,7 +18151,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -16970,10 +18554,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -16982,7 +18606,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -17000,7 +18636,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -17623,10 +19273,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -17635,7 +19325,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -17653,7 +19355,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -17734,10 +19450,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -17746,7 +19502,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -17764,7 +19532,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -18281,10 +20063,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -18293,7 +20115,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -18311,7 +20145,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -18697,10 +20545,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -18709,7 +20597,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -18727,7 +20627,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -19152,10 +21066,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -19164,7 +21118,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -19182,7 +21148,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -19633,10 +21613,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -19645,7 +21665,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -19663,7 +21695,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -20079,10 +22125,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -20091,7 +22177,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -20109,7 +22207,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -20505,10 +22617,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -20517,7 +22669,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -20535,7 +22699,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -20940,10 +23118,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -20952,7 +23170,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -20970,7 +23200,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -21366,10 +23610,50 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "hooks": [ { "CircleCi": { + "custom": { + "orbs": { + "node": "circleci/node@5.0.2", + }, + }, "jobs": [ + { + "custom": { + "executor": "base", + }, + "name": "checkout", + "splitIntoMatrix": false, + "steps": { + "custom": [ + "checkout", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, + { + "name": "setup", + "steps": { + "custom": [ + "node/install-packages", + ], + }, + "workspace": { + "persist": [ + ".", + ], + }, + }, { "command": "build:ci", "name": "build", + "workspace": { + "persist": [ + ".", + ], + }, }, { "command": "test:ci", @@ -21378,7 +23662,19 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` ], "workflows": [ { + "custom": { + "when": "pipeline.trigger_source != "scheduled_pipeline"", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ @@ -21396,7 +23692,21 @@ exports[`loadConfig should load an invalid config when not validating 1`] = ` "runOnRelease": true, }, { + "custom": { + "when": "pipeline.trigger_source == "scheduled_pipeline" and +pipeline.schedule.name == "nightly" +", + }, "jobs": [ + { + "name": "checkout", + }, + { + "name": "setup", + "requires": [ + "checkout", + ], + }, { "name": "build", "requires": [ diff --git a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap index 787da995e..43120899e 100644 --- a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap +++ b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap @@ -8,14 +8,25 @@ executors: - image: cimg/node:20.19-browsers jobs: checkout: - docker: - - image: cimg/base:stable + executor: base steps: + - attach_workspace: + at: . - checkout - persist_to_workspace: root: . paths: - . + setup: + executor: node + steps: + - attach_workspace: + at: . + - node/install-packages + - persist_to_workspace: + root: . + paths: + - . build: executor: node steps: @@ -112,18 +123,13 @@ jobs: CIRCLE_BRANCH: << pipeline.event.github.pull_request.head.ref >> workflows: tool-kit: - when: - not: - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> jobs: - checkout: + requires: [] filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - setup: - executor: node requires: - checkout filters: @@ -173,19 +179,12 @@ workflows: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ branches: only: main + when: pipeline.trigger_source != "scheduled_pipeline" nightly: - when: - and: - - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> - - equal: - - nightly - - << pipeline.schedule.name >> jobs: - - checkout + - checkout: + requires: [] - setup: - executor: node requires: - checkout - build: @@ -200,6 +199,9 @@ workflows: filters: branches: ignore: main + when: | + pipeline.trigger_source == "scheduled_pipeline" and + pipeline.schedule.name == "nightly" pr-close: jobs: - checkout: @@ -215,5 +217,7 @@ workflows: (pipeline.event.name == "pull_request" and pipeline.event.action == "closed") +orbs: + node: circleci/node@5.0.2 " `; diff --git a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap index 6ae3af11d..fb2dd1b64 100644 --- a/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap +++ b/plugins/circleci-npm/test/__snapshots__/circleci-npm.test.ts.snap @@ -8,14 +8,25 @@ executors: - image: cimg/node:20.19-browsers jobs: checkout: - docker: - - image: cimg/base:stable + executor: base steps: + - attach_workspace: + at: . - checkout - persist_to_workspace: root: . paths: - . + setup: + executor: node + steps: + - attach_workspace: + at: . + - node/install-packages + - persist_to_workspace: + root: . + paths: + - . build: executor: node steps: @@ -54,18 +65,13 @@ jobs: - .toolkitstate workflows: tool-kit: - when: - not: - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> jobs: - checkout: + requires: [] filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - setup: - executor: node requires: - checkout filters: @@ -92,19 +98,12 @@ workflows: branches: ignore: /.*/ context: npm-publish-token + when: pipeline.trigger_source != "scheduled_pipeline" nightly: - when: - and: - - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> - - equal: - - nightly - - << pipeline.schedule.name >> jobs: - - checkout + - checkout: + requires: [] - setup: - executor: node requires: - checkout - build: @@ -113,6 +112,9 @@ workflows: - test: requires: - build + when: | + pipeline.trigger_source == "scheduled_pipeline" and + pipeline.schedule.name == "nightly" pr-close: jobs: - checkout: @@ -125,5 +127,7 @@ workflows: (pipeline.event.name == "pull_request" and pipeline.event.action == "closed") +orbs: + node: circleci/node@5.0.2 " `; diff --git a/plugins/circleci/.toolkitrc.yml b/plugins/circleci/.toolkitrc.yml index a3d35fee9..88fb24856 100644 --- a/plugins/circleci/.toolkitrc.yml +++ b/plugins/circleci/.toolkitrc.yml @@ -9,7 +9,25 @@ optionsSchema: './lib/schemas/plugin' options: hooks: - CircleCi: + custom: + orbs: + node: circleci/node@5.0.2 jobs: + - name: checkout + steps: + custom: + - checkout + custom: + executor: base + workspace: + persist: ['.'] + splitIntoMatrix: false + - name: setup + steps: + custom: + - node/install-packages + workspace: + persist: ['.'] - name: build command: 'build:ci' workspace: @@ -18,7 +36,13 @@ options: command: 'test:ci' workflows: - name: 'tool-kit' + custom: + when: pipeline.trigger_source != "scheduled_pipeline" jobs: + - name: checkout + - name: setup + requires: + - 'checkout' - name: build requires: - 'setup' @@ -27,7 +51,15 @@ options: - 'build' runOnRelease: true - name: 'nightly' + custom: + when: | + pipeline.trigger_source == "scheduled_pipeline" and + pipeline.schedule.name == "nightly" jobs: + - name: checkout + - name: setup + requires: + - 'checkout' - name: build requires: - 'setup' diff --git a/plugins/circleci/readme.md b/plugins/circleci/readme.md index 31c4994dc..03387eeee 100644 --- a/plugins/circleci/readme.md +++ b/plugins/circleci/readme.md @@ -37,13 +37,13 @@ Options provided in your repository's `.toolkitrc.yml` for this hook are merged Unless they conflict, your options are appended to options from plugins, allowing you to define custom CircleCI jobs and workflows in your repository that work alongside those from plugins. #### Hook options -| Property | Description | Type | -| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `executors` | an array of additional CircleCI executors to output in the generated config. | _Array of objects:_
  • `name`: `string`
  • `image`: `string`
| -| `jobs` | an array of additional CircleCI jobs to output in the generated config. these are used for running Tool Kit commands. for running arbitrary shell commands, use `custom`. | _Array of objects:_
  • `name`: `string`
  • `command`: `string`
  • `workspace`: _Object with properties:_
    • `persist`: `boolean`
    • `attach`: `boolean`
  • `steps`: _Object with properties:_
    • `pre`: `Array`
    • `post`: `Array`
  • `splitIntoMatrix`: `boolean`
  • `custom`: _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_)
| -| `workflows` | an array of additional CircleCI workflows to output in the generated config. these reference jobs defined in the `jobs` option. | _Array of objects:_
  • `name`: `string`
  • `jobs`: _Array of objects:_
    • `name`: `string`
    • `requires`: `Array`
    • `splitIntoMatrix`: `boolean`
    • `runOnRelease`: `boolean`
    • `custom`: _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_)
  • `runOnRelease`: `boolean`
  • `custom`: _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_)
| -| `custom` | arbitrary additional CircleCI configuration that will be merged into the Tool Kit-generated config. | _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_) | -| `disableBaseConfig` | set to `true` to omit the Tool Kit CircleCI boilerplate. should be used along with `custom` to provide your own boilerplate. | `boolean` | +| Property | Description | Type | +| :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `executors` | an array of additional CircleCI executors to output in the generated config. | _Array of objects:_
  • `name`: `string`
  • `image`: `string`
| +| `jobs` | an array of additional CircleCI jobs to output in the generated config. these are used for running Tool Kit commands. for running arbitrary shell commands, use `custom`. | _Array of objects:_
  • `name`: `string`
  • `command`: `string`
  • `workspace`: _Object with properties:_
    • `persist`: `boolean \| Array`
    • `attach`: `boolean`
  • `steps`: _Object with properties:_
    • `pre`: `Array`
    • `post`: `Array`
    • `custom`: `Array`
  • `splitIntoMatrix`: `boolean`
  • `custom`: _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_)
| +| `workflows` | an array of additional CircleCI workflows to output in the generated config. these reference jobs defined in the `jobs` option. | _Array of objects:_
  • `name`: `string`
  • `jobs`: _Array of objects:_
    • `name`: `string`
    • `requires`: `Array`
    • `splitIntoMatrix`: `boolean`
    • `runOnRelease`: `boolean`
    • `custom`: _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_)
  • `runOnRelease`: `boolean`
  • `custom`: _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_)
| +| `custom` | arbitrary additional CircleCI configuration that will be merged into the Tool Kit-generated config. | _Object with dynamic keys of type_ `string` _and values of type_ `unknown` (_optional & nullable_) | +| `disableBaseConfig` | set to `true` to omit the Tool Kit CircleCI boilerplate. should be used along with `custom` to provide your own boilerplate. | `boolean` | _All properties are optional._ diff --git a/plugins/circleci/src/circleci-config.ts b/plugins/circleci/src/circleci-config.ts index 6a683f7b6..1454332b9 100644 --- a/plugins/circleci/src/circleci-config.ts +++ b/plugins/circleci/src/circleci-config.ts @@ -105,61 +105,24 @@ const mergeWithConcatenatedArrays = (arg0: unknown, ...args: unknown[]) => } }) -const getBaseConfig = (nodeVersions: string[], tagFilterRegex?: string): CircleCIState => { - const runsOnMultipleNodeVersions = nodeVersions.length > 1 - const setupMatrix = runsOnMultipleNodeVersions - ? matrixBoilerplate('setup', nodeVersions) - : { executor: 'node' } - return { - version: 2.1, - executors: Object.fromEntries( +const getBaseConfig = (nodeVersions: string[]): CircleCIState => ({ + version: 2.1, + executors: { + base: { + docker: [{ image: 'cimg/base:stable' }] + }, + ...Object.fromEntries( nodeVersions.map((version, i) => [ nodeVersionToExecutor(version, i), { docker: [{ image: `cimg/node:${version}` }] } ]) - ), - jobs: { - checkout: { - docker: [{ image: 'cimg/base:stable' }], - steps: ['checkout', persistWorkspaceStep(['.'])] - } - }, - workflows: { - 'tool-kit': { - when: { - not: { - equal: ['scheduled_pipeline', '<< pipeline.trigger_source >>'] - } - }, - jobs: [ - tagFilterRegex ? { checkout: tagFilter(tagFilterRegex) } : 'checkout', - { - setup: { - ...setupMatrix, - requires: ['checkout'], - ...(tagFilterRegex ? tagFilter(tagFilterRegex) : {}) - } - } - ] - }, - nightly: { - when: { - and: [ - { - equal: ['scheduled_pipeline', '<< pipeline.trigger_source >>'] - }, - { - equal: ['nightly', '<< pipeline.schedule.name >>'] - } - ] - }, - jobs: ['checkout', { setup: { ...setupMatrix, requires: ['checkout'] } }] - } - } - } -} + ) + }, + jobs: {}, + workflows: {} +}) const rootOptionKeys = ['executors', 'jobs', 'workflows'] as const satisfies readonly (keyof Omit< CircleCiOptions, @@ -570,7 +533,7 @@ export default class CircleCi extends Hook< } const generatedConfig = mergeWithConcatenatedArrays( {}, - this.options.disableBaseConfig ? {} : getBaseConfig(nodeVersions, configuredTagFilterRegex), + this.options.disableBaseConfig ? {} : getBaseConfig(nodeVersions), generated, this.options.custom ?? {} ) diff --git a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap index 1a742f390..7879ac293 100644 --- a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap +++ b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap @@ -3,19 +3,33 @@ exports[`CircleCI config hook config integration test should generate a .circleci/config.yml with the base config from circleci/.toolkitrc.yml 1`] = ` "version: 2.1 executors: + base: + docker: + - image: cimg/base:stable node: docker: - image: cimg/node:20.19-browsers jobs: checkout: - docker: - - image: cimg/base:stable + executor: base steps: + - attach_workspace: + at: . - checkout - persist_to_workspace: root: . paths: - . + setup: + executor: node + steps: + - attach_workspace: + at: . + - node/install-packages + - persist_to_workspace: + root: . + paths: + - . build: executor: node steps: @@ -42,18 +56,13 @@ jobs: - .toolkitstate workflows: tool-kit: - when: - not: - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> jobs: - checkout: + requires: [] filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ - setup: - executor: node requires: - checkout filters: @@ -71,19 +80,12 @@ workflows: filters: tags: only: /^v\\d+\\.\\d+\\.\\d+(-.+)?/ + when: pipeline.trigger_source != "scheduled_pipeline" nightly: - when: - and: - - equal: - - scheduled_pipeline - - << pipeline.trigger_source >> - - equal: - - nightly - - << pipeline.schedule.name >> jobs: - - checkout + - checkout: + requires: [] - setup: - executor: node requires: - checkout - build: @@ -92,6 +94,9 @@ workflows: - test: requires: - build + when: | + pipeline.trigger_source == "scheduled_pipeline" and + pipeline.schedule.name == "nightly" pr-close: jobs: - checkout: @@ -104,5 +109,7 @@ workflows: (pipeline.event.name == "pull_request" and pipeline.event.action == "closed") +orbs: + node: circleci/node@5.0.2 " `; From aa0da68c7613de9fce34636cc5a31548ede85487 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 24 Nov 2025 11:14:38 +0000 Subject: [PATCH 09/10] feat(circleci): store test results in test job --- plugins/circleci/.toolkitrc.yml | 7 +++++++ .../test/__snapshots__/circleci-config.test.ts.snap | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/plugins/circleci/.toolkitrc.yml b/plugins/circleci/.toolkitrc.yml index 88fb24856..c563012bb 100644 --- a/plugins/circleci/.toolkitrc.yml +++ b/plugins/circleci/.toolkitrc.yml @@ -34,6 +34,13 @@ options: persist: ['.'] - name: test command: 'test:ci' + steps: + post: + - store_test_results: + path: test-results + - store_artifacts: + path: test-results + destination: test-results workflows: - name: 'tool-kit' custom: diff --git a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap index 7879ac293..fa26ef33d 100644 --- a/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap +++ b/plugins/circleci/test/__snapshots__/circleci-config.test.ts.snap @@ -50,6 +50,11 @@ jobs: - run: name: test command: npx dotcom-tool-kit test:ci + - store_test_results: + path: test-results + - store_artifacts: + path: test-results + destination: test-results - persist_to_workspace: root: . paths: From 46c3f57dfcfd0635cbb3d9a01a4f2cb2a458a206 Mon Sep 17 00:00:00 2001 From: Kara Brightwell Date: Mon, 24 Nov 2025 15:42:25 +0000 Subject: [PATCH 10/10] WIP deploy production config --- plugins/circleci-deploy/.toolkitrc.yml | 17 +++++++++++++++ .../circleci-deploy.test.ts.snap | 21 +++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/plugins/circleci-deploy/.toolkitrc.yml b/plugins/circleci-deploy/.toolkitrc.yml index 111b64bb6..f12c812d2 100644 --- a/plugins/circleci-deploy/.toolkitrc.yml +++ b/plugins/circleci-deploy/.toolkitrc.yml @@ -4,6 +4,12 @@ plugins: options: hooks: - CircleCi: + custom: + orbs: + change-api: financial-times/change-api@1.0.9 + cloudsmith-oidc: ft-circleci-orbs/cloudsmith-oidc@1.0 + aws-cli: circleci/aws-cli@3.1.4 + serverless-framework: circleci/serverless-framework@2.0.2 jobs: - name: deploy-review command: 'deploy:review' @@ -15,6 +21,17 @@ options: command: 'test:staging' - name: deploy-production command: 'deploy:production' + workspace: + persist: false + steps: + pre: + - setup_remote_docker: + docker_layer_caching: true + post: + - change-api/change-log: + environment: production + system-code: << parameters.system-code >> + - name: teardown-review command: 'teardown:review' workspace: diff --git a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap index 43120899e..94b7979ce 100644 --- a/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap +++ b/plugins/circleci-deploy/test/__snapshots__/circleci-deploy.test.ts.snap @@ -3,6 +3,9 @@ exports[`circleci-deploy config integration test should generate a .circleci/config.yml with the base config from circleci-deploy/.toolkitrc.yml 1`] = ` "version: 2.1 executors: + base: + docker: + - image: cimg/base:stable node: docker: - image: cimg/node:20.19-browsers @@ -47,6 +50,11 @@ jobs: - run: name: test command: npx dotcom-tool-kit test:ci + - store_test_results: + path: test-results + - store_artifacts: + path: test-results + destination: test-results - persist_to_workspace: root: . paths: @@ -104,13 +112,14 @@ jobs: steps: - attach_workspace: at: . + - setup_remote_docker: + docker_layer_caching: true - run: name: deploy-production command: npx dotcom-tool-kit deploy:production - - persist_to_workspace: - root: . - paths: - - .toolkitstate + - change-api/change-log: + environment: production + system-code: << parameters.system-code >> teardown-review: executor: node steps: @@ -219,5 +228,9 @@ workflows: "closed") orbs: node: circleci/node@5.0.2 + change-api: financial-times/change-api@1.0.9 + cloudsmith-oidc: ft-circleci-orbs/cloudsmith-oidc@1.0 + aws-cli: circleci/aws-cli@3.1.4 + serverless-framework: circleci/serverless-framework@2.0.2 " `;