Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(2092): [2] Dropdown build parameters #398

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user-guide/assets/parameters1-event-start.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user-guide/assets/parameters2-sd-init-step.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/user-guide/assets/parameters3-event-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion docs/user-guide/configuration/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ toc:
active: true
---
## Defining Parameters
There are 2 ways to define parameters, you can see them both in the example below.
There are 3 ways to define parameters, you can see them in the example below:

```yaml
parameters:
nameA: "value1"
nameB:
value: "value2"
description: "description of nameB"
nameC: ["value1", "value2"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add that the default will be the first value in the array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and It is important thing. I add about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @tkyi. Is it OK?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comment!

```

**Parameters** is a dictionary which expects `key:value` pairs.
Expand All @@ -37,6 +38,13 @@ parameters:

These two examples above are equivalent.

You can also define parameters in an array for drop down options. The first value in the array is picked up as default, e.g `value1` is selected as default in the example below:

```yaml
parameters:
nameA: ["value1", "value2"]
```

## Example
You can see a full screwdriver.yaml example below:
```yaml
Expand All @@ -48,13 +56,15 @@ parameters:
az:
value: "1"
description: "default availability zone"
cluster: ["cluster1", "cluster2"]

jobs:
main:
requires: [~pr, ~commit]
steps:
- step1: 'echo "Region: $(meta get parameters.region.value)"'
- step2: 'echo "AZ: $(meta get parameters.az.value)"'
- step3: 'echo "Cluster: $(meta get parameters.cluster.value)"'
```

You can also preview the parameters that are used during a build in the `Setup` -> `sd-setup-init` step.
Expand All @@ -63,6 +73,8 @@ Pipeline Preview Screenshot:

![image](../assets/parameters1-event-start.png)

![image](../assets/parameters1-event-start-dropdown.png)

![image](../assets/parameters2-sd-init-step.png)

![image](../assets/parameters3-event-view.png)
Expand Down