Monorepo for Tangled tangled.org

proposal : spindle : conditional step execution #445

closed opened by jobala.tngl.sh

Overview#

This issue proposes adding an if condition to a step such that the step only runs when the condition is true.

Why#

Consider the scenario where I want to publish a blog to some hosting provider like Netlify or Vercel using a Git based workflow. When I add a new post through a PR, I would like to have the article published to a preview url for me to get a sense of its look and feel and then only publish the article to my main site on merging to main. At the moment, this is possible on spindle by having two workflows one for publishing the preview and another for publishing to the main site.

This scenario can be simplified by introducing conditional step execution; such that the publishing to main site step only runs when the PR is merged to main. For other similar scenarios having conditional step execution can reduce pressure on compute infrastructure since a single workflow will be sufficient instead of having multiple workflows run in parallel.

Implementation Plan#

  1. Add support for if in the step schema
  2. Check if the specified condition is true during step execution
  3. Add support for a skipped status kind

one of the things i want to avoid (in comparison to github actions, other CIs), is to introduce a programming mechanism in yaml. i would much prefer to redirect logic like this to shell scripts or buildsystems. that being said, there may be a subset of actions that genuinely need pipeline level logic. in the presented scenario, would this not be achievable using a shell script that switches the mode of deployment based on the presence of TANGLED_REF_TYPE or similar?

the full list of env vars set in CI is documented here: https://docs.tangled.org/spindles.html#environment

That makes sense, the scenario is covered with shell scripts + env vars. Closing the issue.

sign up or login to add to the discussion
Labels

None yet.

area
spindle
assignee

None yet.

Participants 2
AT URI
at://did:plc:qcqdzn5ohjxyp2ilrunon6kn/sh.tangled.repo.issue/3mh3mb7uk3m22