-
Notifications
You must be signed in to change notification settings - Fork 93
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
Use GoCD environment variables in task config #52
Comments
Also, documentation contains info on how to set parameters, but there is no info on how to reference a previously specified parameter. If you can provide an example, I can try it and I'm happy to create a PR with the doc update. |
Hi,
Any kind of reference to environment variables similar to what you showed, will not work in yaml. GoCD never supported this in xml, therefore it will not work here. When you use
The templates and parameters support is very limited because template must be in XML. So you cannot use anything like In XML you need a template, e.g. <templates>
<pipeline name="example">
<stage name="defaultStage">
<jobs>
<job name="defaultJob">
<tasks>
<exec command="#{ARG}">
<runif status="passed" />
</exec>
</tasks>
</job>
</jobs>
</stage>
</pipeline>
</templates> Then instead of referencing it from XML: <pipeline name="pipeline1" template="example">
<params>
<param name="ARG">value</param>
</params>
<materials>
<git url="[email protected]:tomzo/gocd-yaml-config-plugin.git" />
</materials>
</pipeline> You can use YAML: pipe2:
group: group1
label_template: "foo-1.0-${COUNT}"
template: example
parameters:
arg: value
# no stages: If you are only trying to avoid copy pasting blocks of yaml, you should see yaml aliases section. I know there is a need for better templating, issue for this is #2 |
So you can set environment vars and params, but not use ones that would be there at runtime, like this:
Ah well. |
thanks for the feedback, understand the usage and limitations better |
Just to update - this actually works now
|
Is it possible to use a environment variable such as GO_PIPELINE_NAME in the task configuration?
I tried snippet below and that fails to resolve the name.
Basically, I'd like to not hard code the name of the pipeline (self) when fetching the build artifact so that I can alias the whole block and re-use it in other pipelines.
The text was updated successfully, but these errors were encountered: