Skip to content

Commit a8b7461

Browse files
feat: add when parameter to all commands (#56)
* feat: add 'when' parameter to all commands In order to use the common `when` command parameter in an orb command, the orb command needs to have its own `when` parameter. Here I'm adding `when` to each command so that `on_success`, `on_fail` or `always` can be plumbed through. This is useful in circumstances where you may need to, say, install the Github CLI as part of the steps taken after a CI failure. Example circleci.yml: ```yaml commands: build-failure-pr-comment: steps: - gh/setup: when: on_fail - run: gh pr comment ... when: on_fail ``` * fix: update deployment test by fixing macos tests and adding more recent uubuntu images --------- Co-authored-by: Jason Young <[email protected]>
1 parent e89b4c5 commit a8b7461

File tree

4 files changed

+40
-10
lines changed

4 files changed

+40
-10
lines changed

.circleci/test-deploy.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ workflows:
5454
filters: *filters
5555
matrix:
5656
parameters:
57-
executor: ["docker-x86-debian", "linuxvm-x86-debian", "macos-x86", "apple-silicon", "arm"]
57+
executor: ["docker-x86-debian", "apple-silicon-14", "apple-silicon-15", "linuxvm-arm-ubuntu-2004", "linuxvm-x86-ubuntu-2004", "linuxvm-arm-ubuntu-2204", "linuxvm-x86-ubuntu-2204", "linuxvm-arm-ubuntu-2404", "linuxvm-x86-ubuntu-2404"]
5858
version: [2.27.0, 2.40.0] # 2.27.0 is the last version that uses ".tar.gz" instead of ".zip" for macOS
5959
- orb-tools/pack:
6060
filters: *release-filters
@@ -72,18 +72,32 @@ executors:
7272
docker-x86-debian:
7373
docker:
7474
- image: cimg/base:current
75-
macos-x86:
75+
apple-silicon-14:
7676
macos:
77-
xcode: 14.0.0
78-
resource_class: macos.x86.medium.gen2
79-
apple-silicon:
77+
xcode: 14.3.1
78+
resource_class: macos.m1.medium.gen1
79+
apple-silicon-15:
8080
macos:
81-
xcode: 15.0.0
81+
xcode: 15.4.0
8282
resource_class: macos.m1.medium.gen1
83-
arm:
83+
linuxvm-arm-ubuntu-2004:
84+
machine:
85+
image: ubuntu-2004:2024.05.1
86+
resource_class: arm.medium
87+
linuxvm-x86-ubuntu-2004:
88+
machine:
89+
image: ubuntu-2004:2024.05.1
90+
linuxvm-arm-ubuntu-2204:
91+
machine:
92+
image: ubuntu-2204:2024.05.1
93+
resource_class: arm.medium
94+
linuxvm-x86-ubuntu-2204:
95+
machine:
96+
image: ubuntu-2204:2024.05.1
97+
linuxvm-arm-ubuntu-2404:
8498
machine:
85-
image: ubuntu-2004:202101-01
99+
image: ubuntu-2404:2024.05.1
86100
resource_class: arm.medium
87-
linuxvm-x86-debian:
101+
linuxvm-x86-ubuntu-2404:
88102
machine:
89-
image: ubuntu-2004:202101-01
103+
image: ubuntu-2404:2024.05.1

src/commands/clone.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ parameters:
1515
type: string
1616
default: "."
1717
description: Select the path to clone into. By default the current path will be selected, which is dictated by the job's "working_directory".
18+
when:
19+
type: string
20+
default: "on_success"
21+
description: Specify when to run this command. Options are "on_success", "always" or "on_fail".
1822
steps:
1923
- run:
2024
name: Cloning repository
@@ -23,3 +27,4 @@ steps:
2327
PARAM_GH_DIR: <<parameters.dir>>
2428
PARAM_GH_HOSTNAME: <<parameters.hostname>>
2529
command: <<include(scripts/clone.sh)>>
30+
when: <<parameters.when>>

src/commands/install.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,14 @@ parameters:
44
type: string
55
default: "2.40.1"
66
description: Specify the full semver versioned tag to use.
7+
when:
8+
type: string
9+
default: "on_success"
10+
description: Specify when to run this command. Options are "on_success", "always" or "on_fail".
711
steps:
812
- run:
913
environment:
1014
PARAM_GH_CLI_VERSION: <<parameters.version>>
1115
name: Install GH CLI v<<parameters.version>>
1216
command: <<include(scripts/install.sh)>>
17+
when: <<parameters.when>>

src/commands/setup.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@ parameters:
1414
description: |
1515
Enter the name of the environment variable containing the GitHub Personal Access token to be used for authentication.
1616
It is recommended for CI processes that you create a "machine" user on GitHub.com with the needed permissions, rather than using your own.
17+
when:
18+
type: string
19+
default: "on_success"
20+
description: Specify when to run this command. Options are "on_success", "always" or "on_fail".
1721
steps:
1822
- install:
1923
version: <<parameters.version>>
24+
when: <<parameters.when>>
2025
- run:
2126
environment:
2227
PARAM_GH_TOKEN: <<parameters.token>>
2328
PARAM_GH_HOSTNAME: <<parameters.hostname>>
2429
name: Configure GH CLI v<<parameters.version>>
2530
command: <<include(scripts/configure.sh)>>
31+
when: <<parameters.when>>

0 commit comments

Comments
 (0)