From c734c1de5d7649dd71c757d9e410201126125a72 Mon Sep 17 00:00:00 2001 From: "Fredrik A. Madsen-Malmo" Date: Wed, 6 Mar 2024 20:38:57 +0100 Subject: [PATCH] [com.circleci.v2] Add support for top-level executors (#35) This adds support for CircleCI's top-level executors. --- packages/com.circleci.v2/Config.pkl | 42 ++++++++++++++++++++++++++++- packages/com.circleci.v2/PklProject | 2 +- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/packages/com.circleci.v2/Config.pkl b/packages/com.circleci.v2/Config.pkl index ff50b54..d4260b5 100644 --- a/packages/com.circleci.v2/Config.pkl +++ b/packages/com.circleci.v2/Config.pkl @@ -34,6 +34,14 @@ setup: Boolean? /// See the [Creating Orbs](https://circleci.com/docs/creating-orbs/) documentation for details. orbs: Mapping? +/// Executors define the execution environment in which the steps of a job will be run, +/// allowing you to reuse a single executor definition across multiple jobs. +/// +/// See [executors in the CircleCI documentation](https://circleci.com/docs/configuration-reference/#executors). +/// Also see [Using Workspaces to Share Data between Jobs](https://circleci.com/docs/workspaces/) for information on +/// how to use executors to share state between jobs. +executors: Mapping? + /// A command defines a sequence of steps as a map to be executed in a job, enabling you to reuse /// a single command definition across multiple jobs. /// @@ -46,7 +54,7 @@ commands: Mapping? /// Jobs are specified in the jobs map, see /// [Sample config.yml](https://circleci.com/docs/sample-config/) for two examples of a job map. /// The name of the job is the key in the map, and the value is a map describing the job. -jobs: Mapping? +jobs: Mapping? /// Used for orchestrating all jobs. /// @@ -85,6 +93,31 @@ class Orb { jobs: Mapping? } +class Executor { + /// Which resource class to use which further determines the amount of CPU and RAM allocated to each container in a + /// job. + resource_class: ResourceClass? + + /// Shell to use for execution command in all steps. + /// Can be overridden by shell in each step (default: See [Default Shell Options](https://circleci.com/docs/configuration-reference/#default-shell-options)) + shell: String? + + /// In which directory to run the steps. Will be interpreted as an absolute path. + working_directory: String? + + /// A map of environment variable names and values. + environment: Mapping? + + /// Options for [docker executor](https://circleci.com/docs/configuration-reference/#docker) + docker: Listing(!isEmpty)?(onlyOneSet(List(this, macos, machine))) + + /// Options for [macOS executor](https://circleci.com/docs/configuration-reference/#macos) + macos: MacOSExecutor? + + /// Options for [machine executor](https://circleci.com/docs/configuration-reference/#machine) + machine: Machine? +} + class Job { /// Shell to use for execution command in all steps. /// @@ -94,6 +127,13 @@ class Job { /// A list of [steps](https://circleci.com/docs/configuration-reference/#steps) to be performed steps: Listing(!isEmpty) + /// A pre-defined executor from the defined executors or orbs in which to execute this job. + /// + /// Can be used to share data between jobs. + /// See [Using Workspaces to Share Data between Jobs](https://circleci.com/docs/workspaces/) for information on how to + /// use executors to share state between jobs. + executor: String? + /// In which directory to run the steps. /// /// Will be interpreted as an absolute path. diff --git a/packages/com.circleci.v2/PklProject b/packages/com.circleci.v2/PklProject index 1d91977..3965bc2 100644 --- a/packages/com.circleci.v2/PklProject +++ b/packages/com.circleci.v2/PklProject @@ -17,5 +17,5 @@ amends "../basePklProject.pkl" package { - version = "1.0.0" + version = "1.1.0" }