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

Make Label Linked Jobs plugin compatible with Jenkins Clouds definition

      With fixed slaves, Label Linked Jobs dashboard shows available labels and the jobs associated with them correctly.

      But when slaves are temporary - created on-demand when a job starts, then destroyed when the job is complete - those labels do not appear in the Label Linked Jobs dashboard. For example, the Docker Plugin allows creating a "cloud" where the "cloud" contains slaves that will be created from docker containers on demand. Each slave does have a label string associated with, just like a normal slave.

      Not sure if the Jenkins generic cloud has a way of getting the labels or not. There are other plugins that create slaves on demand; they may have the same problem as the Docker Plugin.

          [JENKINS-32445] Make Label Linked Jobs plugin compatible with Jenkins Clouds definition

          Jason Swager created issue -

          Hello

          The plugin is not meant to be compatible out of the box with all features and plugins of Jenkins, so I consider this requirement as an Improvement rather than a Bug .

          It would indeed be interesting to make the plugin able to gather data from Clouds' definitions.
          As you suspected however there is very little data available to the plugin via generic Jenkins APIs. In fact I can see only one relevant function, canProvision(Label) which could be used to detect if a Label defined by a job is also supported by a Cloud, and to determine whether a job cannot be executed at all because no fixed slaves nor Clouds support it.
          Note that this generic Jenkins API works only at the Cloud level, it doesn't allow granularity at template's level, which may be a concept specific to the Docker plugin.

          Considering this, what would you suggest for the dashboard?

          Dominique Brice added a comment - Hello The plugin is not meant to be compatible out of the box with all features and plugins of Jenkins, so I consider this requirement as an Improvement rather than a Bug . It would indeed be interesting to make the plugin able to gather data from Clouds' definitions. As you suspected however there is very little data available to the plugin via generic Jenkins APIs . In fact I can see only one relevant function, canProvision(Label) which could be used to detect if a Label defined by a job is also supported by a Cloud, and to determine whether a job cannot be executed at all because no fixed slaves nor Clouds support it. Note that this generic Jenkins API works only at the Cloud level, it doesn't allow granularity at template 's level, which may be a concept specific to the Docker plugin. Considering this, what would you suggest for the dashboard?
          Dominique Brice made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          Summary Original: Temporary slaves aren't counted New: Make Label Linked Jobs plugin compatible with Jenkins Clouds definition

          Note: I took the liberty to change this issue name & type, and I cross-referenced it in the plugin page.

          Dominique Brice added a comment - Note: I took the liberty to change this issue name & type, and I cross-referenced it in the plugin page .

          Jason Swager added a comment -

          You are correct, this really is a feature - not a bug.

          I'm not sure if this would work, but perhaps for every label or combination of labels that the Linked Jobs plugin is processing, it could do a canProvision() on that label against each Cloud instance that's currently registered in Jenkins. If a Cloud responds affirmative, then the dashboard could just note the Clouds that support that combination. The dashboard wouldn't be able to tell how many nodes would support the label combination in that particular Cloud, but it would at least know that it can be handled.

          This logic could be used to determine if orphan jobs (jobs that have no runnable node) are really orphans or if some cloud can support them.

          Jason Swager added a comment - You are correct, this really is a feature - not a bug. I'm not sure if this would work, but perhaps for every label or combination of labels that the Linked Jobs plugin is processing, it could do a canProvision() on that label against each Cloud instance that's currently registered in Jenkins. If a Cloud responds affirmative, then the dashboard could just note the Clouds that support that combination. The dashboard wouldn't be able to tell how many nodes would support the label combination in that particular Cloud, but it would at least know that it can be handled. This logic could be used to determine if orphan jobs (jobs that have no runnable node) are really orphans or if some cloud can support them.

          Dominique Brice added a comment - - edited

          It seems technically doable.

          Dominique Brice added a comment - - edited It seems technically doable.

          Dominique Brice added a comment - https://github.com/jenkinsci/label-linked-jobs-plugin/commits/feature/JENKINS-32445

          jswager1, do you have a sandbox instance of jenkins where you could test a new version of the plugin with realistic clouds settings?
          Since I don't use clouds, my test cases may be missing some settings that occur in "production" environments. Let me know if you have the possibility to test a dev/snapshot version of the plugin, and I'll upload it to jenkins plugins snapshot repository.

          Dominique Brice added a comment - jswager1 , do you have a sandbox instance of jenkins where you could test a new version of the plugin with realistic clouds settings? Since I don't use clouds, my test cases may be missing some settings that occur in "production" environments. Let me know if you have the possibility to test a dev/snapshot version of the plugin, and I'll upload it to jenkins plugins snapshot repository .

          Dominique Brice added a comment - - edited

          I added two things that are visible:

          • on the labels dashboard, if there is at least one cloud defined in the Jenkins instance, each label has an indication to give the number of clouds which can provision it (see screenshot)
          • on the labels linked jobs, cloud(s) able to provision each label listed (atomic or composite) is/are listed (see screenshot)

          Provisioning clouds are also taken into account to determine the list of orphaned jobs on the dashboard.

          A snapshot plugin version with this new feature is available there.

          Dominique Brice added a comment - - edited I added two things that are visible: on the labels dashboard, if there is at least one cloud defined in the Jenkins instance, each label has an indication to give the number of clouds which can provision it (see screenshot) on the labels linked jobs, cloud(s) able to provision each label listed (atomic or composite) is/are listed (see screenshot) Provisioning clouds are also taken into account to determine the list of orphaned jobs on the dashboard. A snapshot plugin version with this new feature is available there .
          Dominique Brice made changes -
          Attachment New: LabelLinkedJobs.png [ 32080 ]
          Attachment New: Dashboard.png [ 32081 ]

            dominiquebrice Dominique Brice
            jswager1 Jason Swager
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: