You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jekyll/_cci2/reusing-config.md
+97-49Lines changed: 97 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -380,6 +380,7 @@ This section describes the types of parameters and their usage. The parameter ty
380
380
* enum
381
381
* executor
382
382
* steps
383
+
* environment variable name
383
384
384
385
#### String
385
386
{:.no_toc}
@@ -424,49 +425,33 @@ Boolean parameter evaluation is based on the [values specified in YAML 1.1](http
424
425
425
426
Capitalized and uppercase versions of the above values are also valid.
426
427
427
-
#### Steps
428
+
#### Integer
428
429
{:.no_toc}
429
430
430
-
Steps are used when you have a job or command that needs to mix predefined and user-defined steps. When passed in to a command or job invocation, the steps passed as parameters are always defined as a sequence, even if only one step is provided.
431
+
The parameter type `integer` is use to pass a numeric integer value. The following example using the `integer` type to populate the value of `parallelism` in a job.
431
432
432
433
```yaml
433
-
commands:
434
-
run-tests:
435
-
parameters:
436
-
after-deps:
437
-
description: "Steps that will be executed after dependencies are installed, but before tests are run"
438
-
type: steps
439
-
default: []
440
-
steps:
441
-
- run: make deps
442
-
- steps: << parameters.after-deps >>
443
-
- run: make test
444
-
```
445
-
446
-
The following example demonstrates that steps passed as parameters are given as the value of a `steps` declaration under the job's `steps`.
434
+
version: "2.1"
447
435
448
-
```yaml
449
436
jobs:
450
437
build:
438
+
parameters:
439
+
p:
440
+
type: integer
441
+
default: 1
442
+
parallelism: << parameters.p >>
451
443
machine: true
452
444
steps:
453
-
- run-tests:
454
-
after-deps:
455
-
- run: echo "The dependencies are installed"
456
-
- run: echo "And now I'm going to run the tests"
457
-
```
458
-
459
-
The above will resolve to the following:
445
+
- checkout
460
446
461
-
```yaml
462
-
steps:
463
-
- run: make deps
464
-
- run: echo "The dependencies are installed"
465
-
- run: echo "And now I'm going to run the tests"
466
-
- run: make test
447
+
workflows:
448
+
workflow:
449
+
jobs:
450
+
- build:
451
+
p: 2
467
452
```
468
453
469
-
#### Enum Parameter
454
+
#### Enum
470
455
{:.no_toc}
471
456
472
457
The `enum` parameter may be a list of any values. Use the `enum` parameter type when you want to enforce that the value must be one from a specific set of string values. The following example uses the `enum` parameter to declare the target operating system for a binary.
@@ -492,8 +477,9 @@ commands:
492
477
type: enum
493
478
default: "windows" #invalid declaration of default that does not appear in the comma-separated enum list
494
479
enum: ["darwin", "linux"]
495
-
```
496
-
#### Executor parameter
480
+
```
481
+
482
+
#### Executor
497
483
{:.no_toc}
498
484
499
485
Use an `executor` parameter type to allow the invoker of a job to decide what
@@ -534,30 +520,97 @@ workflows:
534
520
name: xenial
535
521
some-value: foobar
536
522
```
537
-
#### Integer Parameter
523
+
524
+
#### Steps
538
525
{:.no_toc}
539
526
540
-
The parameter type `integer` is use to pass a numeric integer value. The following example using the `integer` type to populate the value of `parallelism` in a job.
527
+
Steps are used when you have a job or command that needs to mix predefined and user-defined steps. When passed in to a command or job invocation, the steps passed as parameters are always defined as a sequence, even if only one step is provided.
541
528
542
529
```yaml
543
-
version: "2.1"
530
+
commands:
531
+
run-tests:
532
+
parameters:
533
+
after-deps:
534
+
description: "Steps that will be executed after dependencies are installed, but before tests are run"
535
+
type: steps
536
+
default: []
537
+
steps:
538
+
- run: make deps
539
+
- steps: << parameters.after-deps >>
540
+
- run: make test
541
+
```
544
542
543
+
The following example demonstrates that steps passed as parameters are given as the value of a `steps` declaration under the job's `steps`.
544
+
545
+
```yaml
545
546
jobs:
546
547
build:
547
-
parameters:
548
-
p:
549
-
type: integer
550
-
default: 1
551
-
parallelism: << parameters.p >>
552
548
machine: true
553
549
steps:
554
-
- checkout
550
+
- run-tests:
551
+
after-deps:
552
+
- run: echo "The dependencies are installed"
553
+
- run: echo "And now I'm going to run the tests"
554
+
```
555
+
556
+
The above will resolve to the following:
557
+
558
+
```yaml
559
+
steps:
560
+
- run: make deps
561
+
- run: echo "The dependencies are installed"
562
+
- run: echo "And now I'm going to run the tests"
563
+
- run: make test
564
+
```
565
+
#### Environment Variable Name
566
+
567
+
The environment variable name (``env_var_name``) parameter is a string that must match a POSIX_NAME regexp (e.g. no spaces or special characters) and is a more meaningful parameter type that enables additional checks to be performed. An example of this parameter is shown below.
**Note:** Invoking jobs multiple times in a single workflow and parameters in jobs are available in configuration version 2.1 and later.
592
645
593
-
594
646
### Jobs Defined in an Orb
595
647
596
648
If a job is declared inside an orb it can use commands in that orb or the global commands. It is not possible to call commands outside the scope of declaration of the job.
@@ -631,7 +683,6 @@ workflows:
631
683
saywhat: Everyone
632
684
```
633
685
634
-
635
686
### Using Parameters in Executors
636
687
{:.no_toc}
637
688
@@ -848,6 +899,3 @@ workflows:
848
899
```
849
900
850
901
**Note:** Conditional steps are available in configuration version 2.1 and later.
0 commit comments