DO-2027: Rewrite node-pr.yml to remove implicit skips#169
DO-2027: Rewrite node-pr.yml to remove implicit skips#169tmthrgd-aligent wants to merge 1 commit into
Conversation
b342811 to
3a259b4
Compare
|
I think this is ready for review now, unfortunately there are a few simplifications that couldn't be made for one reason or another (corepack and the double setup-node for example). It's been tested against four repos: https://github.com/aligent/remote-cmd-bastion-hosting/pull/9, https://github.com/aligent/otr-int/pull/18, https://github.com/PolyaireDev/polyaire-frontend/pull/26 and https://github.com/aligent/aligent-applications-hosting/pull/14. All seem to be running the workflow correctly, but eyes across those would be good. If anyone has any other repos they'd like it tested against, let me know. I don't think we'll have too many repos break from missing targets and the fix to them (adding the |
3a259b4 to
ec13bfb
Compare
This rewrites the node-pr.yml workflow primarily to remove the implicit skips that can leave checks overlooked and not actually running. It also simplifies several parts of the workflows and removes two additional actions that were only used for this one workflow. This may cause workflow breakage in projects. If failures are observed, they were likely being masked by the now removed implicit skips. To fix these failures, callers of the workflow should either add the necessary explicit skips (i.e. add a 'skip-X: true' input) to the workflow or correct the command being called by adding an 'X-command: command-name' input to the workflow. We now ignore two previously valid inputs, has-env-vars and fetch-depth. Both inputs remain but are ignored. To remove them would require updating all callers in lockstep. has-env-vars will now be inferred from the presence of the ENV_VARS secret and no longer needs to be set explicitly. This is consistent with other inputs like pre-install-commands. fetch-depth is removed as it never had an actual use-case and simply duplicated the nx.json check the workflow already contained. It is used by three callers, all of whom set it to 0 and all of which have an nx.json file and will have a 'fetch-depth: 0' checkout anyway. We could have instead kept the input and removed the implicit nx.json check, but given it has been inconsistently used, this would also require a lot of workflow updates. This can be re-added in the future if there was a compelling need. Ideally the two actions/setup-node steps would have been merged together, but unfortunately actions/setup-node has no support for running corepack enable which causes the cache setup step to error out. Ideally we'd also merge the two actions/checkout steps into one, but again, unfortunately we can't check for the presence of the nx.json file until after we've performed an initial checkout. We could checkout just the nx.json file and then perform the real checkout, but this would likely take just as much work. We are slightly more aggressive at performing a full checkout for Nx projects than before. We now gate on simply the presence of an nx.json file rather than checking whether a command we're going to run is present in the nx.json file. This was the cause of frustration in certain projects, is more straightforward and should not cause much overhead. It should make our pipelines more robust for use in Nx-based projects.
ec13bfb to
9323d13
Compare
This rewrites the node-pr.yml workflow primarily to remove the implicit
skips that can leave checks overlooked and not actually running. It also
simplifies several parts of the workflows and removes two additional
actions that were only used for this one workflow.
This may cause workflow breakage in projects. If failures are observed,
they were likely being masked by the now removed implicit skips. To fix
these failures, callers of the workflow should either add the necessary
explicit skips (i.e. add a 'skip-X: true' input) to the workflow or
correct the command being called by adding an 'X-command: command-name'
input to the workflow.
We now ignore two previously valid inputs, has-env-vars and fetch-depth.
Both inputs remain but are ignored. To remove them would require
updating all callers in lockstep.
has-env-vars will now be inferred from the presence of the ENV_VARS
secret and no longer needs to be set explicitly. This is consistent with
other inputs like pre-install-commands.
fetch-depth is removed as it never had an actual use-case and simply
duplicated the nx.json check the workflow already contained. It is used
by three callers, all of whom set it to 0 and all of which have an
nx.json file and will have a 'fetch-depth: 0' checkout anyway. We could
have instead kept the input and removed the implicit nx.json check, but
given it has been inconsistently used, this would also require a lot of
workflow updates. This can be re-added in the future if there was a
compelling need.
Ideally the two actions/setup-node steps would have been merged
together, but unfortunately actions/setup-node has no support for
running corepack enable which causes the cache setup step to error out.
Ideally we'd also merge the two actions/checkout steps into one, but
again, unfortunately we can't check for the presence of the nx.json file
until after we've performed an initial checkout. We could checkout just
the nx.json file and then perform the real checkout, but this would
likely take just as much work.
We are slightly more aggressive at performing a full checkout for Nx
projects than before. We now gate on simply the presence of an nx.json
file rather than checking whether a command we're going to run is
present in the nx.json file. This was the cause of frustration in
certain projects, is more straightforward and should not cause much
overhead. It should make our pipelines more robust for use in Nx-based
projects.