jbrunton / gflows

A CLI tool that makes templating GitHub Workflows easy
MIT License
30 stars 3 forks source link

Consider providing an easier way to load remote files with Jsonnet #115

Closed jbrunton closed 3 years ago

jbrunton commented 4 years ago

jsonnet-bundler may be heavyweight for a lot of cases. perhaps allow remote urls in libs lists, and download automatically.

jbrunton commented 4 years ago

Perhaps introduce a .gflowslib extension. Example:

# https://example.com/my-lib.gflowslib
{
  "files": [
    "foo.yml",
    "bar/baz.yml"
  ]
} 

This would add the files listed to the build library. If remote, it would download local versions.

Would be useful for ytt too.

jbrunton commented 4 years ago

Possible semantics:

  1. During execution, files are downloaded locally to a temp directory, maintaining same directory structure.
  2. File paths must be relative to parent gflowslib file and contained within the same directory.
  3. The temp directory is added to config.libs.
jbrunton commented 3 years ago

It would be helpful to support both library files and workflows. Something like this:

# https://example.com/my-lib.gflowslib
{
  "libs": [
    "my-lib.yml",
    "other/lib.yml"
  ],
  "workflows": [
    "my-workflow.yml"
  ]
} 

..altho this will need to consider the differences between how workflows are identified by ytt and jsonnet engines.

ytt example:

  "libs": [
    "my-lib.yml"
  ],
  "workflows": [
    "my-workflow/config.yml",
    "my-workflow/foo.yml",
    "bar.yml"
  ]

Above example would generate a workflow called "my-workflow", and would ignore "bar.yml" (perhaps offering a warning).

jsonnet example:

  "libs": [
    "my-lib.libsonnet"
  ],
  "workflows": [
    "my-workflow.jsonnet"
  ]