List available pipelines #258
-
I'm looking at pypyr as a substitute for some makefile / justfile usage, and one flow I'm trying to sort out is writing pipelines and exposing them to folks in a demo/education context. Given a set of YAML files that define some number of pipelines, is there a way to list available pipelines from the CLI without having to dig into the YAML? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
hi @ajkerrigan, great seeing you here! The short answer is, not really. The longer answer is, it depends. Without being too much of a comedian, but The longer reason is:
So the pypyr runtime doesn't actually have any way of knowing where on your system you might have saved your pipelines, unless you tell it somehow. And the way you tell it is by providing the input. Now, that said, I normally establish a convention whereby I order my repos and their pipelines in such a way that they are reliably in one place. This is a matter of discipline - pypyr could still of course execute a pipeline anywhere you point it at... When pypyr is doing makefile style build/package functions. . .I tend to put everything pipeline in This lead to relatively "natural language" when running your pipelines/cmds, like so:
So in this case, the way you answer "which pipelines are available", is pretty much Here is an (inadequately documented) example of how I generally go about building a python project following this pattern: https://github.com/pypyr/python-ci-cd-example If part of your educational content is to provide a pipeline to show which pipelines you have, then you could do something like this: # ./pipes-list.yaml
steps:
- name: pypyr.steps.py
in:
py: |
from pathlib import Path
print(*[f.stem for f in Path.cwd().glob('*.yaml') if f.is_file()], sep='\n') Which runs like Speaking more to your underlying objective (using pypyr in makefile-ish sort of ways): or another more flexible way (pick and choose grouped steps/functionality to run based on dynamic input args): Hope this helps! |
Beta Was this translation helpful? Give feedback.
-
oh, I should probably add there is also the So depending on what make sense for your repo/content taxonomy, you could collect your pipelines under a directory called
Which can run like:
In this case the answer to "what pipelines are there" is |
Beta Was this translation helpful? Give feedback.
-
Hey thanks @yaythomas ! That's exactly the sort of info I was looking for :). I didn't want to go writing custom scripts or pipelines to do this if there was a native "right way" I hadn't found yet. Your explanations make sense, cheers! 🙇 |
Beta Was this translation helpful? Give feedback.
hi @ajkerrigan, great seeing you here!
The short answer is, not really. The longer answer is, it depends.
Without being too much of a comedian, but
$ ls mypipelib/*.yaml
or$ find ./pipelines/*.yaml -printf "%f\n"
is the way I personally do it, but I'm sure you got there yourself already!The longer reason is:
some-input-config-data.yaml
frompipeline-that-works-with-input-config-data.yaml
.$ pypyr mydir/mypipe
(relative to current dir)$ pypyr anotherdir/anotherpipe
(another dir relative t…