Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-30906

MultiJobBuild.SubBuild does not contain full job name (if using folders)

    Details

    • Similar Issues:

      Description

      When using the MultiJob plugin with the CloudBees folder plugin, the MultiJobBuild.SubBuild class contains only the short job name. For example if we have 'MultiJobA' which runs job 'FolderFoo/JobB' as subtask, the info about the build does not contain 'FolderFoo/JobB' but only 'JobB' (the contained URL is fine). Thus, there is no easy way to understand which JobB was executed.

        Attachments

        1. build.png
          build.png
          4 kB
        2. jenkins-multijob-plugin.hpi
          112 kB
        3. screenshot-1.png
          screenshot-1.png
          17 kB

          Issue Links

            Activity

            Hide
            vvv444 Vasili Galka added a comment - - edited

            hagzag Haggai, any chance you can take a look on this? Many thanks! Vasili

            Show
            vvv444 Vasili Galka added a comment - - edited hagzag Haggai, any chance you can take a look on this? Many thanks! Vasili
            Hide
            hagzag hagzag added a comment -

            itai Or / itai Or -> I took a look and didn't quite get how we get the folder name ... we should discuss this today looks like a small fix no ?

            Show
            hagzag hagzag added a comment - itai Or / itai Or -> I took a look and didn't quite get how we get the folder name ... we should discuss this today looks like a small fix no ?
            Hide
            vvv444 Vasili Galka added a comment -

            hagzag As far as I know, project.getFullName() gives the full path e.g. FooFolder/BarFolder/JobA

            Show
            vvv444 Vasili Galka added a comment - hagzag As far as I know, project.getFullName() gives the full path e.g. FooFolder/BarFolder/JobA
            Hide
            chenc Chen Cohen added a comment -

            Trying to understand this issue I created the following structure (see screenshot-1)
            Where exactly do you expect to see 'folder1/job1', is it in this view?
            Please elaborate.
            Thanks, Chen.

            Show
            chenc Chen Cohen added a comment - Trying to understand this issue I created the following structure (see screenshot-1) Where exactly do you expect to see 'folder1/job1', is it in this view? Please elaborate. Thanks, Chen.
            Hide
            vvv444 Vasili Galka added a comment -

            Hi Chen,
            No, I don't refer to the project class. I have mentioned the MultiJobBuild.SubBuild class. It contains info about specific build that took place, like #123 you know... See the attached picture. The code building this page has no simple way to know the job was Foo/SvnUpdate.
            Best, Vasili

            Show
            vvv444 Vasili Galka added a comment - Hi Chen, No, I don't refer to the project class. I have mentioned the MultiJobBuild.SubBuild class. It contains info about specific build that took place, like #123 you know... See the attached picture. The code building this page has no simple way to know the job was Foo/SvnUpdate. Best, Vasili
            Hide
            hagzag hagzag added a comment -

            hi Vasili Galka, Chen Cohen & I discussed and I have to say we didn't understand the issue yet ...
            Is it the display name of the job when you are in the context of a folder, is it the link to the specific job or maybe a third option you might have described and we both didn't understand yet ...

            Pending you input.
            HP

            Show
            hagzag hagzag added a comment - hi Vasili Galka , Chen Cohen & I discussed and I have to say we didn't understand the issue yet ... Is it the display name of the job when you are in the context of a folder, is it the link to the specific job or maybe a third option you might have described and we both didn't understand yet ... Pending you input. HP
            Hide
            vvv444 Vasili Galka added a comment - - edited

            Hi hagzag,

            My apologies for unclear explanation. Let me explain in more detail:

            Say we have the following job configuration:

            MultiJob1
                Phase1
                   MyFolder/Job1
            

            Suppose this job was executed and it resulted in build MultiJob1 #1 which in turn executed build MyFolder/Job1 #5.

            Now, say we write some Java/Groovy code that needs to access this information. For instance, in my specific case I was designing some Email generating code. The code has reference to MultiJobBuild object describing MultiJob1 #1:

            MultiJobBuild build1;
            SubBuild subBuild = build1.getBuilders().get(0);
            // subBuild.getBuildNumber() is 5
            // subBuild.getJobName() is "Job1"
            // There is no "MyFolder/Job1" info in the subBuild object.
            

            I want to obtain AbstractBuild object describing MyFolder/Job1 #5 basing on the information in subBuild. But how can I do it? As far as I understand there is no enough info for that in the SubBuild object.

            Best,
            Vasili

            Show
            vvv444 Vasili Galka added a comment - - edited Hi hagzag , My apologies for unclear explanation. Let me explain in more detail: Say we have the following job configuration: MultiJob1 Phase1 MyFolder/Job1 Suppose this job was executed and it resulted in build MultiJob1 #1 which in turn executed build MyFolder/Job1 #5 . Now, say we write some Java/Groovy code that needs to access this information. For instance, in my specific case I was designing some Email generating code. The code has reference to MultiJobBuild object describing MultiJob1 #1 : MultiJobBuild build1; SubBuild subBuild = build1.getBuilders().get(0); // subBuild.getBuildNumber() is 5 // subBuild.getJobName() is "Job1" // There is no "MyFolder/Job1" info in the subBuild object. I want to obtain AbstractBuild object describing MyFolder/Job1 #5 basing on the information in subBuild. But how can I do it? As far as I understand there is no enough info for that in the SubBuild object. Best, Vasili
            Hide
            chenc Chen Cohen added a comment -

            Hi Vasili and thanks for your detailed explanation.

            Since MultiJobBuild is sub-type of AbstractBuild you can use the following:

            MultiJobBuild mjb;
            mjb.getProject().getFullName();
            

            When debugging the example in screenshot-1.png the above code returns: folder1/job1
            Please let me know if it worked for you.

            Thanks,
            Chen

            Show
            chenc Chen Cohen added a comment - Hi Vasili and thanks for your detailed explanation. Since MultiJobBuild is sub-type of AbstractBuild you can use the following: MultiJobBuild mjb; mjb.getProject().getFullName(); When debugging the example in screenshot-1.png the above code returns: folder1/job1 Please let me know if it worked for you. Thanks, Chen
            Hide
            vvv444 Vasili Galka added a comment -

            Hi Chen Cohen,

            But my question was, how do I get the mjb corresponding to the subBuild?

            Best,
            Vasili

            Show
            vvv444 Vasili Galka added a comment - Hi Chen Cohen , But my question was, how do I get the mjb corresponding to the subBuild? Best, Vasili
            Hide
            chenc Chen Cohen added a comment -

            Hi Vasili,

            MultiJobBuild.SubBuild is not aware of its container. You can't do that.

            Regards,
            Chen

            Show
            chenc Chen Cohen added a comment - Hi Vasili, MultiJobBuild.SubBuild is not aware of its container. You can't do that. Regards, Chen
            Hide
            vvv444 Vasili Galka added a comment -

            Hi Chen,

            I'm not interested in the container. I'm interested in the AbstractBuild corresponding to the SubBuild (the sub-job that was executed).

            Regards,
            Vasili

            Show
            vvv444 Vasili Galka added a comment - Hi Chen, I'm not interested in the container. I'm interested in the AbstractBuild corresponding to the SubBuild (the sub-job that was executed). Regards, Vasili
            Hide
            chenc Chen Cohen added a comment -

            Hi Vasili,

            I've added AbstractBuild to SubBuild, so you can call SubBuild.getBuild to get the data you requested. I've uploaded a locally build hpi that I was hoping you can try and confirm that it solves this issue.
            Please let me know how it worked.

            Thanks,
            Chen.

            Show
            chenc Chen Cohen added a comment - Hi Vasili, I've added AbstractBuild to SubBuild, so you can call SubBuild.getBuild to get the data you requested. I've uploaded a locally build hpi that I was hoping you can try and confirm that it solves this issue. Please let me know how it worked. Thanks, Chen.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Haggai Philip Zagury
            Path:
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
            src/main/java/com/tikal/jenkins/plugins/multijob/StatusJob.java
            http://jenkins-ci.org/commit/tikal-multijob-plugin/170e19a30b422cd445334edd29918277da298eb7
            Log:
            Fix JENKINS-30906 -> Restore build on scm changes logic

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Haggai Philip Zagury Path: src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java src/main/java/com/tikal/jenkins/plugins/multijob/StatusJob.java http://jenkins-ci.org/commit/tikal-multijob-plugin/170e19a30b422cd445334edd29918277da298eb7 Log: Fix JENKINS-30906 -> Restore build on scm changes logic
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Haggai Philip Zagury
            Path:
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
            src/main/java/com/tikal/jenkins/plugins/multijob/StatusJob.java
            http://jenkins-ci.org/commit/tikal-multijob-plugin/0c815f76b66fc532e7585c6a801cd4fcbeb161ce
            Log:
            Merge pull request #76 from hagzag/master

            Fix JENKINS-30906 -> Restore build on scm changes logic

            Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/34eeddd1c4d3...0c815f76b66f

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Haggai Philip Zagury Path: src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java src/main/java/com/tikal/jenkins/plugins/multijob/StatusJob.java http://jenkins-ci.org/commit/tikal-multijob-plugin/0c815f76b66fc532e7585c6a801cd4fcbeb161ce Log: Merge pull request #76 from hagzag/master Fix JENKINS-30906 -> Restore build on scm changes logic Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/34eeddd1c4d3...0c815f76b66f
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Chen Cohen
            Path:
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
            http://jenkins-ci.org/commit/tikal-multijob-plugin/67e0633fad2789a1c4dc89cd76beef6166addf68
            Log:
            fix JENKINS-30906

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Chen Cohen Path: src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java http://jenkins-ci.org/commit/tikal-multijob-plugin/67e0633fad2789a1c4dc89cd76beef6166addf68 Log: fix JENKINS-30906
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Haggai Philip Zagury
            Path:
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java
            src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
            http://jenkins-ci.org/commit/tikal-multijob-plugin/ec5919885e001c4aa8d6baa8c8687d1252a979a0
            Log:
            Merge pull request #80 from cohencil/master

            Fix JENKINS-30906 - Add support for Full job name via API

            Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/6b4fe28c649c...ec5919885e00

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Haggai Philip Zagury Path: src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuild.java src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java http://jenkins-ci.org/commit/tikal-multijob-plugin/ec5919885e001c4aa8d6baa8c8687d1252a979a0 Log: Merge pull request #80 from cohencil/master Fix JENKINS-30906 - Add support for Full job name via API Compare: https://github.com/jenkinsci/tikal-multijob-plugin/compare/6b4fe28c649c...ec5919885e00
            Hide
            chenc Chen Cohen added a comment -

            Added AbstractBuild to SubBuild. See PR #80

            Show
            chenc Chen Cohen added a comment - Added AbstractBuild to SubBuild. See PR #80

              People

              • Assignee:
                chenc Chen Cohen
                Reporter:
                vvv444 Vasili Galka
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: