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

update workspace url to allow full job names #109

Merged
merged 3 commits into from
Dec 18, 2013

Conversation

sheehan
Copy link
Contributor

@sheehan sheehan commented Nov 13, 2013

Switched to use project.getFullName for URL so seed jobs can reside in folders, but also needed to encode the full name since it may contain slashes. Did some refactoring so the encode/decode logic would be in the same place.

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@@ -44,6 +44,7 @@ jenkinsPlugin {

dependencies {
compile project(':job-dsl-core')
optionalJenkinsPlugins([group: 'org.jenkins-ci.plugins', name: 'ant', version: '1.2', ext: 'jar'])
Copy link
Member

Choose a reason for hiding this comment

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

why did you add an optional dependency to the ant plugin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without that, specs using JenkinsRule fail with java.lang.NoClassDefFoundError: hudson/tasks/Ant$AntInstallation

Copy link
Member

Choose a reason for hiding this comment

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

Would it help if we update to the latest long-term support core? If not, can you create an issue in the Jenkins bug tracker for this and add a link to the issue in the source?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. I tried to update the core but couldn't get it to work (see https://groups.google.com/forum/#!topic/job-dsl-plugin/9li8Cqd7ENc)

I can add a ticket for this. Would it go towards the job-dsl plugin or the gradle-jpi plugin?

BTW I noticed a reference to the same issue here: https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/SeedJobTest.groovy#L13

Copy link
Member

Choose a reason for hiding this comment

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

There is already a ticket for this: https://issues.jenkins-ci.org/browse/JENKINS-17129. Please add a reference so that we can remove the workaround after it got fixed.

@daspilker
Copy link
Member

I tried to build your branch, but I got test failures:

:job-dsl-plugin:test

javaposse.jobdsl.plugin.WorkspaceProtocolSpec > url for project with file FAILED
    org.spockframework.runtime.SpockComparisonFailure at WorkspaceProtocolSpec.groovy:67

javaposse.jobdsl.plugin.WorkspaceProtocolSpec > url for project in folder with file FAILED
    org.spockframework.runtime.SpockComparisonFailure at WorkspaceProtocolSpec.groovy:92

16 tests completed, 2 failed
:job-dsl-plugin:test FAILED

@sheehan
Copy link
Contributor Author

sheehan commented Dec 5, 2013

Strange. Works for me locally and on buildhive
https://buildhive.cloudbees.com/job/sheehan/job/job-dsl-plugin/ws/job-dsl-plugin/build/reports/tests/javaposse.jobdsl.plugin.WorkspaceProtocolSpec.html

Is there any more detail for those failures?

@daspilker
Copy link
Member

There seems to be an erroneous backslash. I'm using Windows...

javaposse.jobdsl.plugin.WorkspaceProtocolSpec > url for project in folder with file FAILED
    Condition not satisfied:

    url.file == '/files/'
    |   |    |
    |   |    false
    |   |    1 difference (87% similarity)
    |   |    /(\\)files/
    |   |    /(-~)files/
    |   /\files/
    workspace://folder%2Ftest-project/\files/
        at javaposse.jobdsl.plugin.WorkspaceProtocolSpec.url for project in folder with file(WorkspaceProtocolSpec.groovy:92)

@sheehan
Copy link
Contributor Author

sheehan commented Dec 9, 2013

Thanks. Tests should now pass in Windows.

import hudson.model.AbstractProject
import jenkins.model.Jenkins

class WorkspaceProtocol {
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need another class for this? This introduces a cyclic class dependency: WorkspaceProtocol > WorkspaceUrlHandler > WorkspaceUrlConnection > WorkspaceProtocol.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seemed important that the encode-to-url/decode-from-url logic be together. Previously encoding logic was in ScriptRequest and decoding was in WorkspaceUrlConnection which wasn't easy to follow. There doesn't seem to be a good OO way to encapsulate this.

Copy link
Member

Choose a reason for hiding this comment

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

ScriptRequest was definitely the wrong place for the logic and I guess that no one is going to win an OO design prize when using the Java URL API...

@daspilker
Copy link
Member

OK, cool. Works for me now. Can you address the inline comments?

@sheehan
Copy link
Contributor Author

sheehan commented Dec 18, 2013

Thanks. Added some comments.

@daspilker
Copy link
Member

OK, it does the trick, I will merge it. Is there a corresponding JIRA issue? And can you add a line to the Release Notes?

daspilker added a commit that referenced this pull request Dec 18, 2013
update workspace url to allow full job names
@daspilker daspilker merged commit 294a1f1 into jenkinsci:master Dec 18, 2013
@sheehan
Copy link
Contributor Author

sheehan commented Dec 19, 2013

No JIRA. Release Notes updated. Thanks!

@sheehan sheehan deleted the full-name-url branch February 8, 2014 03:52
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.

3 participants