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

[FIXED JENKINS-35410] Improve User Experience #3

Merged
merged 1 commit into from Jun 7, 2016

Conversation

fbelzunc
Copy link
Contributor

@fbelzunc fbelzunc commented Jun 2, 2016

For the moment I prefer not fully support the / because it will be a hack on the plugin, this should be addressed on jenkins-core or in a separate plugin.

https://issues.jenkins-ci.org/browse/JENKINS-35188

@reviewbybees

@oleg-nenashev
Copy link
Member

I agree with a separate plugin. Actually, the path handling logic has been already implemented in jenkinsci/promoted-builds-plugin#62 , to it just needs some decoupling and documentation.


public FormValidation doCheckProject(@QueryParameter String project) {
if (project.startsWith("/")) {
return FormValidation.warning(Messages.BatchTaskInvoker_ForwardSlash());
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it should be an error

@@ -139,6 +141,27 @@ public ListBoxModel doFillTaskItems(@QueryParameter String project, @AncestorInP
}
return r;
}

public FormValidation doCheckProject(@QueryParameter String project) {
Copy link
Member

Choose a reason for hiding this comment

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

Please add Restricted(NoExternalUse) to such new validation hooks.
It prevents compatibility issues when you upgrade the stuff

@fbelzunc
Copy link
Contributor Author

fbelzunc commented Jun 2, 2016

Now, I need to delete .idea/libraries/Maven__xpp3_xpp3_min_1_1_4c.xml

@fbelzunc
Copy link
Contributor Author

fbelzunc commented Jun 2, 2016

Done it! I think this should be ready to go!

The <strong>Full project name</strong>

<p>
For jobs inside a folder it is always a path like <strong>foo/bar</strong>
Copy link
Member

Choose a reason for hiding this comment

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

NIT: maybe makes sense to reference other use-cases: E.g. multibranch projects, etc.

@oleg-nenashev
Copy link
Member

🐝 with minor comments

@jcarsique
Copy link

jcarsique commented Jun 3, 2016

That would at least make the configuration screen consistent (and documented) with the expected values in the implementation.

But are you sure it's so much hard to fix the real issue rather than enforcing that wrong behavior which prohibits the use of relative paths (thus the folder copy) and makes it mandatory to use an absolute path written like a relative path (missing leading slash)?!

As far as I can see, the issue comes from https://github.com/jenkinsci/batch-task-plugin/blob/master/src/main/java/hudson/plugins/batch_task/BatchTaskInvoker.java#L78 which uses a wrong context (root instead of the current folder).
While the following use the current context:
https://github.com/jenkinsci/batch-task-plugin/blob/master/src/main/java/hudson/plugins/batch_task/BatchTaskInvoker.java#L91
https://github.com/jenkinsci/batch-task-plugin/blob/master/src/main/java/hudson/plugins/batch_task/BatchTaskInvoker.java#L132

In contrary, your addition is aligned on the wrong call line 78 using Jenkins.getInstance().getItemByFullName(project)

Could you please give a try at fixing the line 78, providing it the current context? I'm not very familiar with the plugin structure and what variable is available where :/

Finally, note that even the API of jenkins.model.Jenkins.getItem(String, Item, Class<AbstractProject>) calls the first argument the "relativeName". I can't see a reason for it being inevitably relative to root when used in a batch task.

@fbelzunc fbelzunc changed the title [JENKINS-35188] Add warning when Project start by / [PARTIAL FIXED JENKINS-35188] Add warning when Project start by / Jun 6, 2016
@fbelzunc
Copy link
Contributor Author

fbelzunc commented Jun 6, 2016

IIRC currently, it is getting the Item using:

Job<?,?> job = (Job<?,?>) Jenkins.getInstance().getItemByFullName(projectName);

Job<?,?> job = (Job<?,?>) Jenkins.getInstance().getItemByFullName(projectName);

  • For that reason I am doing the same on the checks

I don't think to change this is just a line of code. Right now it is asking for Project Full Name, to support absolute and relative paths is a different story and will need test to check that works as expected and don't break current set-up for people already using this plugin.

Feel free to submit a PR adding the relative/absolute paths. It will be very welcome.

@fbelzunc fbelzunc changed the title [PARTIAL FIXED JENKINS-35188] Add warning when Project start by / [FIXED JENKINS-35410] Improve User Experience Jun 7, 2016
@fbelzunc fbelzunc merged commit 25303f8 into jenkinsci:master Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants