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

[DOC-2733] Additional matrix examples #1023

Merged
merged 6 commits into from
Mar 21, 2023
Merged

Conversation

rashminandasahoo
Copy link
Contributor

Harness Developer Pull Request

Thanks for helping us make the Developer Hub better. The PR will be looked at
by the maintainers.

What Type of PR is This?

  • Issue
  • Feature
  • Maintenance/Chore

If tied to an Issue, list the Issue(s) here:

  • Issue(s)

House Keeping

Some items to keep track of. Screen shots of changes are optional but would help the maintainers review quicker.

  • Tested Locally
  • Optional Screen Shoot.

@bot-gitexp-user
Copy link

Preview environment: https://hdh.pr.harness.io/pr-1023

naidu-harness
naidu-harness previously approved these changes Mar 17, 2023
Copy link
Contributor

@SudheendraKatte SudheendraKatte left a comment

Choose a reason for hiding this comment

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

Approved with suggestions


To define an axis as runtime input, mark it as `<+input>`.

When you execute the pipeline, you are prompted to enter its value, which you can add as an array.
Copy link
Contributor

Choose a reason for hiding this comment

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

When you run the pipeline, you will be prompted to provide the matrix value. You can add it as an array.


Let us look at an example.

If you wish to run your test on different versions of Go, the list of different versions will be available at runtime. You can set the axis of the matrix as an input at runtime in this case as :
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want to run your test on different versions of Go, a list of available versions will be available at runtime. Following is an example of setting the axis of a matrix as a runtime input:

Copy link
Contributor Author

@rashminandasahoo rashminandasahoo Mar 21, 2023

Choose a reason for hiding this comment

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

The above comment has the word "available" twice in a single sentence. I will retain the initial statement since it is an example that is being explained here.

GoVersion: <+input>
```

Here is the YAML of a sample pipeline where the versions of Go are defined as runtime input:
Copy link
Contributor

Choose a reason for hiding this comment

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

The following YAML file shows a sample pipeline in which different versions of Go are defined as runtime inputs:


#### Support a few axes of matrix as runtime inputs

When you have a matrix with more than one axis, you can set a few of the axes as runtime inputs.
Copy link
Contributor

Choose a reason for hiding this comment

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

If your matrix has more than one axis, you can set some of them as runtime input.

```
## Provide the axis value of matrix from triggers

To provide the axis value from a trigger, define the axis values which has a comma separated list of string.
Copy link
Contributor

Choose a reason for hiding this comment

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

To provide the axis value from a trigger, define the axis values, which have a comma separated list of strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a single list, so this should be "has a comma-separated list of strings."


To mark the full matrix as a runtime input, mark the matrix field as `<+input>`. You can then provide the axis and its values at runtime.

For example, when you need to provide the combinations during runtime, mark the matrix as `<+input>` and then during execution, provide the corresponding values. This way, the executor can provide the values as needed.
Copy link
Contributor

Choose a reason for hiding this comment

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

For example, if you need to input the combinations during runtime, mark the matrix as '+input>' and then provide the corresponding values during execution. The executor can then deliver the values as needed.


## Support complex JSON as an axis in matrix

If you're not sure what value an object should have in a pipeline, you can store it as a JSON string instead. This way, you can use the JSON functor to get a list from the object, in case it is the output from a previous step.
Copy link
Contributor

Choose a reason for hiding this comment

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

If you are unsure about the value of an item in a pipeline, you can store it as a JSON string instead. This way, if an object is an output of the previous step, you can use the JSON functor to get a list from that object.

rashminandasahoo and others added 5 commits March 21, 2023 16:05
…l-matrix-examples.md

Co-authored-by: Sudheendra Katte <114551660+SudheendraKatte@users.noreply.github.com>
…l-matrix-examples.md

Co-authored-by: Sudheendra Katte <114551660+SudheendraKatte@users.noreply.github.com>
…l-matrix-examples.md

Co-authored-by: Sudheendra Katte <114551660+SudheendraKatte@users.noreply.github.com>
@bot-gitexp-user
Copy link

Preview environment: https://hdh.pr.harness.io/pr-1023

@rashminandasahoo rashminandasahoo merged commit 123df04 into main Mar 21, 2023
@rashminandasahoo rashminandasahoo deleted the DOC-2733-MatrixExamples branch March 21, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Draft Draft/work-in-progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants