Q1
I would like declare variable with default values and use it in the concourse resources
e.g. in the start of the pipeline.yml, the below variable is declared.
PROJECT: hello-world
and then use it in resources/resource_types like
groups:
- name: ((PROJECT))
jobs:
- pull-request
- create-artifacts
Now getting error like
- groups.((PROJECT)): '((PROJECT))' is not a valid identifier: must start with a lowercase letter
Actually the variable is only resolved when --var PROJECT=hello-world is passed when setting the pipeline.
Curious; why it is not referring the variable declared inside the pipeline.yml
I do not want to pass any additional argument when setting the pipeline, would like to declare it in the yml itself.
Q2:
The above question Q1 was resolved with anchors and aliases. Please refer my answer.
But the same is not working with resources
REPOSITORY_NAME: &REPOSITORY_NAME hello-world-repo
resources:
- name: pull-request-branch
check_every: 1m
type: pull-request
icon: source-pull
source:
repo: cahcommercial/*REPOSITORY_NAME
Any help please.
Q1:
Q2
Finally I am feeling that passing the variables from command line is the best option. It allows me to reuse the pipeline.yml
https://concourse-ci.org/vars.html#static-vars
and then use the variable syntax in the pipeline.yml