Skip to content

Add guide for templating with ytt - #442

Closed
taylorsilva wants to merge 1 commit into
masterfrom
pipeline-templating
Closed

taylorsilva wants to merge 1 commit into
masterfrom
pipeline-templating

Conversation

@taylorsilva

@taylorsilva taylorsilva commented Jul 5, 2021 •

Copy link
Copy Markdown
Member

Rendered
image

@taylorsilva

Copy link
Copy Markdown
Member Author

@aoldershaw

@taylorsilva taylorsilva self-assigned this Jul 6, 2021
Comment on lines +736 to +748
#@ load("@ytt:data", "data")
jobs:
- name: #@ data.values.job_name + "-job"
plan:
- task: #@ data.values.task_name
config:
platform: linux
image_resource:
type: mock
source: {mirror_self: true}
run:
path: echo
args: #@ data.values.args

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I get we're trying to introduce some of the ytt concepts here, but this particular example is something that fly can already do directly (and more simply):

jobs:
- name: ((job_name))-job
  plan:
  - task: ((task_name))
    config:
      platform: linux
      image_resource:
        type: mock
        source: {mirror_self: true}
      run:
        path: echo
        args: ((args))

...with the same vars.yml file, minus the #@data/values directive, and then fly sp --load-vars-from vars.yml.

Maybe we could add something that fly can't help us with, like an if statement that depends on the vars?

We have all the pieces of a templated pipeline. Lets put it all together
and render the final pipeline.

Populate the \code{vas.yml} file with the value you want.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Populate the \code{vas.yml} file with the value you want.
Populate the \code{vars.yml} file with the value you want.

@taylorsilva

Copy link
Copy Markdown
Member Author

Had the idea of spinning this into something more general but I don't have the motivation for doing this right now so I'm closing this. Thanks for the feedback though Aidan!

@taylorsilva
taylorsilva deleted the pipeline-templating branch July 13, 2021 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants