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

Pipeline parameters from template are not rendered in Run pipeline UI #570

Open
jvmlet opened this issue Jun 30, 2022 · 6 comments
Open
Labels
Area: Yaml question Further information is requested

Comments

@jvmlet
Copy link

jvmlet commented Jun 30, 2022

.azure-pipelines.yml
extends: 
   template: template.yml
   parameters:
     test: ${{ parameters.test }}
.template.yml
parameters:
  - name: test
    default: "false"
    type: boolean

image

@matteotumiati
Copy link

This is expected, you have to define runtime parameters in the main pipeline '.azure-pipelines.yml'. I would say it's an architectural design choice, not a bug.

@jvmlet
Copy link
Author

jvmlet commented Jul 1, 2022

Thanks @matteotumiati. Any chance to get what I'm after? Like template for variables?

@matteotumiati
Copy link

Depends a little bit on what you are after 😄

Let's assume you have a template repository, where you store all the templates and the project repository, where you have the "real" pipeline.

template repo
  ├── template-1.yml
  ├── template-2.yml
  └── variables.yml

project repo
  ├── ...
  └── azure-pipelines.yml

You could have one or more templates into the template repository, including a variables.yml file, structured in this way:

variables:
- name: variablename
  value: variableValue

In any of the templates you can refer to the variables using:

# template-1.yml
variables:
- template: variables.yml
....
steps:
...

Or you can reference the same file in the project repository:

# azure-pipelines.yml
resources:
  repositories:
    - repository: my-template-repository
      type: git
      name: project-name/my-template-repository

variables:
  - template: template-1.yml@my-template-repository

steps:
  ...

@jvmlet
Copy link
Author

jvmlet commented Jul 1, 2022

We have X repositories that use template to define the pipeline. When running manually, set of parameters should be presented and passed to templates jobs

@matteotumiati
Copy link

As far as I know there's no possibility to have either variables or runtime parameters to be "available" only when running manually.
I would say you always need to provide a default value that a user can change when running the pipeline manually.

My recommendation is to go with variables.. slightly less user friendly compared to runtime parameters (but not more complicated to set when opening the build dialog), but you can override the values from REST APIs, if needed, or create templates as shown above.

With runtime parameters you cannot have templates and these must be defined on top of each pipeline, which means you will have to duplicate them X times, depending on how many repos will be using the same parameters.

@jvmlet
Copy link
Author

jvmlet commented Jul 1, 2022

Thanks @matteotumiati, I will leave the issue open, may be MS team will find this feature useful to implement

@KonstantinTyukalov KonstantinTyukalov added question Further information is requested and removed triage labels Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Yaml question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants