Skip to content

Commit 0df38d1

Browse files
Various Upgrades / Updates 4.x (#26)
* feat: walk back, and use executor instead * feat: update tools * feat: upgrade
1 parent 32565a8 commit 0df38d1

File tree

14 files changed

+145
-80
lines changed

14 files changed

+145
-80
lines changed

.circleci/config.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
version: 2.1
22
setup: true
33
orbs:
4-
orb-tools: circleci/orb-tools@11.6
5-
shellcheck: circleci/shellcheck@3.1
4+
orb-tools: circleci/orb-tools@12.3
5+
shellcheck: circleci/shellcheck@3.4
66

77
filters: &filters
88
tags:
@@ -21,14 +21,15 @@ workflows:
2121
- shellcheck/check:
2222
filters: *filters
2323
- orb-tools/publish:
24-
orb-name: promiseofcake/workflow-queue
25-
vcs-type: << pipeline.project.type >>
24+
orb_name: promiseofcake/workflow-queue
25+
vcs_type: << pipeline.project.type >>
2626
requires:
2727
[orb-tools/lint, orb-tools/review, orb-tools/pack, shellcheck/check]
2828
context: orb-publishing
2929
filters: *filters
3030
- orb-tools/continue:
31-
pipeline-number: << pipeline.number >>
32-
vcs-type: << pipeline.project.type >>
31+
orb_name: promiseofcake/workflow-queue
32+
pipeline_number: << pipeline.number >>
33+
vcs_type: << pipeline.project.type >>
3334
requires: [orb-tools/publish]
3435
filters: *filters

.circleci/test-deploy.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
version: 2.1
22
orbs:
3+
orb-tools: circleci/[email protected]
34
workflow-queue: promiseofcake/workflow-queue@dev:<<pipeline.git.revision>>
4-
orb-tools: circleci/[email protected]
5-
65
filters: &filters
76
tags:
87
only: /.*/
9-
108
jobs:
119
sleep:
1210
docker:
@@ -16,11 +14,10 @@ jobs:
1614
type: integer
1715
steps:
1816
- run: echo "sleeping << parameters.time >>s" && sleep << parameters.time >>
19-
2017
workflows:
2118
test-pipeline-a:
2219
jobs:
23-
- workflow-queue/pipeline-queue:
20+
- workflow-queue/pipeline_queue:
2421
context: orb-publishing
2522
debug: true
2623
test-pipeline-b:
@@ -31,13 +28,12 @@ workflows:
3128
jobs:
3229
- sleep:
3330
time: 20
34-
35-
test-global-queue:
31+
test-global_queue:
3632
jobs:
37-
- workflow-queue/global-queue:
33+
- workflow-queue/global_queue:
3834
context: orb-publishing
3935
debug: true
40-
ignored-workflows: "test-pipeline-a" # given we are in one pipeline, don't block on ourselves
36+
ignored_workflows: "test-pipeline-a" # given we are in one pipeline, don't block on ourselves
4137
filters:
4238
tags:
4339
ignore: /.*/
@@ -47,9 +43,9 @@ workflows:
4743
filters: *filters
4844
- orb-tools/publish:
4945
context: orb-publishing
50-
orb-name: promiseofcake/workflow-queue
51-
vcs-type: << pipeline.project.type >>
52-
pub-type: production
46+
orb_name: promiseofcake/workflow-queue
47+
vcs_type: << pipeline.project.type >>
48+
pub_type: production
5349
requires:
5450
- orb-tools/pack
5551
filters:

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,31 @@ Additional use-cases are for queueing workflows within a given pipeline (a featu
1414

1515
In order to use this orb you will need to export a `CIRCLECI_API_TOKEN` secret added to a context of your choosing. It will authentcation against the CircleCI API to check on workflow status. (see: <https://circleci.com/docs/api/v2/index.html#section/Authentication>)
1616

17+
## Custom Executors
18+
19+
Both `global-queue` and `pipeline-queue` jobs now support custom executors. By default, they use a small Docker executor with `cimg/base:stable`, but you can provide your own executor for more control over the execution environment.
20+
21+
### Example: Using a Custom Docker Executor
22+
23+
```yaml
24+
version: 2.1
25+
orbs:
26+
workflow-queue: promiseofcake/workflow-queue@3
27+
28+
executors:
29+
nodejs-executor:
30+
docker:
31+
- image: cimg/node:18.0
32+
resource_class: medium
33+
34+
workflows:
35+
deploy:
36+
jobs:
37+
- workflow-queue/global-queue:
38+
context: deployment-context
39+
executor: nodejs-executor
40+
```
41+
1742
---
1843
1944
## Resources

src/commands/global_block.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ parameters:
1010
type: string
1111
default: "10"
1212
description: "Number of minutes to wait for a lock before giving up."
13-
dont-quit:
13+
dont_quit:
1414
type: boolean
1515
default: false
1616
description: "If true, forces the job through once time expires instead of failing."
17-
only-on-branch:
17+
only_on_branch:
1818
type: string
1919
default: "*"
2020
description: "Only queue on specified branch"
@@ -25,11 +25,11 @@ parameters:
2525
Due to concurrency issues, the number of times should we requery the pipeline list to ensure previous jobs are "pending",
2626
but not yet active. This number indicates the threshold for API returning no previous pending pipelines.
2727
Default is `1` confirmation, increase if you see issues.
28-
ignored-workflows:
28+
ignored_workflows:
2929
type: string
3030
default: ""
3131
description: Comma separated list of workflow names to ignore as blocking workflows for the global queue.
32-
include-on-hold:
32+
include_on_hold:
3333
type: boolean
3434
default: false
3535
description: Consider `on-hold` workflows waiting for approval as running and include them in the queue.
@@ -40,9 +40,9 @@ steps:
4040
environment:
4141
CONFIG_DEBUG_ENABLED: "<< parameters.debug >>"
4242
CONFIG_TIME: "<< parameters.time >>"
43-
CONFIG_DONT_QUIT: "<< parameters.dont-quit >>"
44-
CONFIG_ONLY_ON_BRANCH: "<< parameters.only-on-branch >>"
43+
CONFIG_DONT_QUIT: "<< parameters.dont_quit >>"
44+
CONFIG_ONLY_ON_BRANCH: "<< parameters.only_on_branch >>"
4545
CONFIG_CONFIDENCE: "<< parameters.confidence >>"
46-
CONFIG_IGNORED_WORKFLOWS: "<< parameters.ignored-workflows >>"
47-
CONFIG_INCLUDE_ON_HOLD: "<< parameters.include-on-hold >>"
48-
command: <<include(scripts/global-queue.sh)>>
46+
CONFIG_IGNORED_WORKFLOWS: "<< parameters.ignored_workflows >>"
47+
CONFIG_INCLUDE_ON_HOLD: "<< parameters.include_on_hold >>"
48+
command: <<include(scripts/global_queue.sh)>>

src/commands/pipeline_block.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ steps:
2020
environment:
2121
CONFIG_DEBUG_ENABLED: "<< parameters.debug >>"
2222
CONFIG_CONFIDENCE: "<< parameters.confidence >>"
23-
command: <<include(scripts/pipeline-queue.sh)>>
23+
command: <<include(scripts/pipeline_queue.sh)>>

src/examples/global-queue.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/examples/global_queue.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
description: >
2+
Use when you want to block a workflow progression until there is only one running.
3+
usage:
4+
# Simple example - uses default cimg/base:stable executor automatically
5+
version: 2.1
6+
orbs:
7+
workflow-queue: promiseofcake/workflow-queue@3
8+
9+
workflows:
10+
example:
11+
jobs:
12+
- workflow-queue/global_queue:
13+
name: workflow-queue
14+
context: <context-key>
15+
only_on_branch: main
16+
# No executor specified - automatically uses cimg/base:stable
17+
18+
# Advanced example - custom executors
19+
# version: 2.1
20+
# orbs:
21+
# workflow-queue: promiseofcake/workflow-queue@3
22+
23+
# executors:
24+
# my-custom-executor:
25+
# docker:
26+
# - image: cimg/node:18.0
27+
# resource_class: medium
28+
29+
# workflows:
30+
# example:
31+
# jobs:
32+
# - workflow-queue/global_queue:
33+
# name: workflow-queue
34+
# context: <context-key>
35+
# only_on_branch: main
36+
# executor: my-custom-executor # Override default with custom executor

src/examples/pipeline-queue.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/examples/pipeline_queue.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
description: >
2+
Use when you want a single workflow to be run at the end of a given pipeline (internal queueing).
3+
usage:
4+
# Simple example - uses default cimg/base:stable executor automatically
5+
version: 2.1
6+
orbs:
7+
workflow-queue: promiseofcake/workflow-queue@3
8+
9+
workflows:
10+
example:
11+
jobs:
12+
- workflow-queue/pipeline_queue:
13+
name: pipeline_queue
14+
context: <context-key>
15+
only_on_branch: main
16+
# No executor specified - automatically uses cimg/base:stable
17+
18+
# # Advanced example - custom executor
19+
# version: 2.1
20+
# orbs:
21+
# workflow-queue: promiseofcake/workflow-queue@3
22+
23+
# executors:
24+
# my-custom-executor:
25+
# docker:
26+
# - image: cimg/python:3.11
27+
# resource_class: small
28+
29+
# workflows:
30+
# example:
31+
# jobs:
32+
# - workflow-queue/pipeline_queue:
33+
# name: pipeline_queue
34+
# context: <context-key>
35+
# only_on_branch: main
36+
# executor: my-custom-executor # Override default with custom executor

src/executors/default.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
description: >
2+
Default executor for workflow-queue jobs. Uses a small resource class with the CircleCI base image.
3+
docker:
4+
- image: cimg/base:stable
5+
resource_class: small

0 commit comments

Comments
 (0)