Add run flag for skipping argument validation #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently it is not possible to skip argument validation introduced in
c68e9b7. This imposes an inconvinience when
using script overwrites to disable shared functionality.
Example
A project uses plan 'foo' with a script 'bar' that requires argument 'baz' and
it is used in a shared pipeline, eg. Jenkinsfile, with the argument set
correctly.
If the project for some reason wants to opt-out of the script behaviour it can
add a local script of the same name 'bar' and define it as 'echo skipping...'.
With argument validation enabled in the pipeline, the project is no longer able
to build and maintainers of the plan can no longer add new required arguments to
the shared script as that would break any one opting out.
Solution
As a solution to this, the 'validate' flag is added to the 'run' command. It is
intended to be used in shared invocations of scripts, eg. pipelines, and thus
gives the usual flexibility while still giving local development validation by
default.
The reasoning for this compromise is the validation has the most effect on local
development where developers might not know what arguments should be supplied or
or maybe they mistype their names. Developers working on pipelines take the hit,
but as that is a more slow moving target we accept that.