Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add run flag for skipping argument validation #54

Merged
merged 1 commit into from
Sep 30, 2020

Conversation

Crevil
Copy link
Member

@Crevil Crevil commented Sep 30, 2020

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.

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.

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.
Copy link
Member

@kaspernissen kaspernissen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@Crevil Crevil merged commit 2fcab27 into master Sep 30, 2020
@Crevil Crevil deleted the feature/argument-validation-skipping branch September 30, 2020 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants