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

Switch job configuration section to use a checkbox #88

Merged
merged 1 commit into from Nov 23, 2014
Merged

Switch job configuration section to use a checkbox #88

merged 1 commit into from Nov 23, 2014

Conversation

fluffy88
Copy link
Contributor

This pull request changes the plugins job configuration from using a section to an optionalBlock. In effect, it makes the plugins configuration fall inline with the convention used by most other plugins.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 3c1accd on fluffy88:patch-1 into 211df06 on Diabol:master.

@buildhive
Copy link

Diabol » delivery-pipeline-plugin #398 SUCCESS
This pull request looks good
(what's this?)

@tommysdk
Copy link
Contributor

Thanks for the contribution! Is there a JIRA ticket for this issue? Otherwise please file a JIRA at https://issues.jenkins-ci.org/ and mark it as component "delivery-pipeline" so we can keep track of all the changes going in to the plugin. I would also suggest squashing the commits and amend the commit message with the associated ticket id.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 5cf6bd6 on fluffy88:patch-1 into 211df06 on Diabol:master.

@fluffy88
Copy link
Contributor Author

Thanks for the comments Tommy!
I've created a new Jira ticket JENKINS-25744 and squashed the commits as you asked.


@Exported
public boolean getConfigEnabled() {
return configEnabled;
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the PR!
I think it is possible to remove the need for adding a new member for this class than also needs to be serialized to the configuration file of the project. It could break the Jenkins Job builder and Job DSL plugin project generation.
Is it possible to remove the configEnabled member instead have this in the method?

        return taskName != null && !taskName.equals("") || stageName != null && !stageName.equals("");

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with Patrik in principle, but please don't put four boolean expressions in a row like that ;)
Don't we have any string util class on the classpath?

And don't forget the tests.

Marcus Philip
+46 70 767 46 77
Twitter: @marcus_phi

22 nov 2014 kl. 13:05 skrev Patrik Boström notifications@github.com:

In src/main/java/se/diabol/jenkins/pipeline/PipelineProperty.java:

@@ -52,6 +58,11 @@ public String getTaskName() {
public String getStageName() {
return stageName;
}

  • @exported
  • public boolean getConfigEnabled() {
  •   return configEnabled;
    
    Thanks for the PR!
    I think it is possible to remove the need for adding a new member for this class than also needs to be serialized to the configuration file of the project. It could break the Jenkins Job builder and Job DSL plugin project generation.
    Is it possible to remove the configEnabled member instead have this in the method?
    return taskName != null && !taskName.equals("") || stageName != null && !stageName.equals("");


Reply to this email directly or view it on GitHub.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I could probably get rid of the need for configEnabled altogether.
Which means I should be able to remove the method, the new field and the new constructor argument.

But it's still possible it will break the plugins you mentioned as it would still require configEnabled to be included in the StaplerRequest object being passed into the newInstance method. This is because when the job config is saved, we need to have at least one parameter to know if the checkbox is ticked or not.
I have almost no knowledge of how these plugins work though, so I could be very wrong here.

Regarding the tests, I have updated the existing ones and added a new one to test the new constructor parameter.

@buildhive
Copy link

Diabol » delivery-pipeline-plugin #399 SUCCESS
This pull request looks good
(what's this?)

Normal convention for Jenkins plugins which contribute a JobProperty to a jobs
configuration page is to use an optionalBlock as the top level jelly tag.

In a jobs properties section of the configuration page, plugins 'hide' their
configuration entries by using the optionalBlock, this is presented to the user
as a checkbox. This keeps the jobs configuration page quite clean while allowing
the user full control over the properties they use.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 548e6e9 on fluffy88:patch-1 into 211df06 on Diabol:master.

@buildhive
Copy link

Diabol » delivery-pipeline-plugin #400 SUCCESS
This pull request looks good
(what's this?)

patbos added a commit that referenced this pull request Nov 23, 2014
Switch job configuration section to use a checkbox
@patbos patbos merged commit 109e8bd into Diabol:master Nov 23, 2014
@patbos
Copy link
Contributor

patbos commented Nov 23, 2014

Thanks for the PR!

@fluffy88
Copy link
Contributor Author

It's a great plugin and I'm only happy to be able to help :)
Keep up the good work!

@fluffy88 fluffy88 deleted the patch-1 branch November 23, 2014 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants