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

New jenkins job doesn't get added to the Dashboard view using Python Jenkins

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • python-plugin
    • None
    • Jenkins ver. 2.138.1

      Hello there!

      We have a requirement where we add the jenkins job for the newly created branch to the Dashboard/Hotfixes view.

      The python tool when run for Hotfix branch gets added to the Hotfixes view cleanly. But, when we create a feature branch that has to get added to the Dashboard it doesn't get added.

      Note: Here view variable is either Dashboard or Hotfixes
      view_path = 'all/job/USM/view/{}'.format(view)
      view_cfg = server.get_view_config(view_path)
      update_cfg = []
      for num, line in enumerate(view_cfg.splitlines(), start=1):
          if line.strip().startswith('</jobNames>'):
              spaces = ' ' * 4
              update_cfg.append(u'{}<string>{}</string>'.format(spaces, branch))
           update_cfg.append(line)
      server.reconfig_view(view_path, new_view_cfg)

      Here we read the conflig xml of the view we want the job to be added.
      Then, we add the new branch before the jobNames end in the config xml file.
      Lastly, we update the view using reconfig_view.

      Not sure why the new job doesn't get added to the Dashboard view. But works fine when we added it to say Hotfixes view.

      Please advise if I am missing something here.

          [JENKINS-58353] New jenkins job doesn't get added to the Dashboard view using Python Jenkins

          Vineeth Karkad created issue -
          Vineeth Karkad made changes -
          Attachment New: Screenshot 2019-07-05 at 12.45.43 PM.png [ 47925 ]

          Added attachment of all jobs in the Hotfixes view.

          This is before adding the new branch KPAIDI_DEVELOPMENT to the view.

          Vineeth Karkad added a comment - Added attachment of all jobs in the Hotfixes view. This is before adding the new branch KPAIDI_DEVELOPMENT to the view.

          releng26.builders bin> python edit_jenkins_view.py IMS Hotfixes KPAIDI_DEVELOPMENT
          Project: IMS
          View: Hotfixes
          Branch: KPAIDI_DEVELOPMENT

          <<Before adding the new branch KPAIDI_DEVELOPMENT to the view>>
          Jobs in the all/job/IMS/view/Hotfixes view
          --------------------------------------------
          6.2.3-HOTFIX-BU
          6.2.3-HOTFIX-CJ
          6.2.3-HOTFIX-CN
          6.2.3-HOTFIX-CP
          6.2.3-HOTFIX-CQ
          6.2.3-HOTFIX-CR
          6.2.3-HOTFIX-CT
          6.2.3-HOTFIX-CU
          6.2.3-HOTFIX-CV
          6.2.3-HOTFIX-CW
          6.2.3-HOTFIX-CX
          6.2.3-HOTFIX-CY
          6.3.0-HOTFIX-C
          6.3.0-HOTFIX-M
          6.3.0-HOTFIX-S
          6.3.0-HOTFIX-T
          6.3.0-HOTFIX-U
          6.3.0-HOTFIX-V
          6.3.0-HOTFIX-W
          6.3.0-HOTFIX-X
          6.3.0-HOTFIX-Y
          6.3.0-HOTFIX-Z
          6.4.0-HOTFIX-A
          6.4.0-HOTFIX-C
          6.4.0-HOTFIX-D
          6.4.0-HOTFIX-E
          6.4.0-HOTFIX-F
          HOTFIX%20Branch%20Creation

          <<After adding the new branch KPAIDI_DEVELOPMENT/WRAPPER to the view>>
          Jobs in the all/job/IMS/view/Hotfixes view
          --------------------------------------------
          6.2.3-HOTFIX-BU
          6.2.3-HOTFIX-CJ
          6.2.3-HOTFIX-CN
          6.2.3-HOTFIX-CP
          6.2.3-HOTFIX-CQ
          6.2.3-HOTFIX-CR
          6.2.3-HOTFIX-CT
          6.2.3-HOTFIX-CU
          6.2.3-HOTFIX-CV
          6.2.3-HOTFIX-CW
          6.2.3-HOTFIX-CX
          6.2.3-HOTFIX-CY
          6.3.0-HOTFIX-C
          6.3.0-HOTFIX-M
          6.3.0-HOTFIX-S
          6.3.0-HOTFIX-T
          6.3.0-HOTFIX-U
          6.3.0-HOTFIX-V
          6.3.0-HOTFIX-W
          6.3.0-HOTFIX-X
          6.3.0-HOTFIX-Y
          6.3.0-HOTFIX-Z
          6.4.0-HOTFIX-A
          6.4.0-HOTFIX-C
          6.4.0-HOTFIX-D
          6.4.0-HOTFIX-E
          6.4.0-HOTFIX-F
          HOTFIX%20Branch%20Creation
          KPAIDI_DEVELOPMENT

          Vineeth Karkad added a comment - releng26.builders bin> python edit_jenkins_view.py IMS Hotfixes KPAIDI_DEVELOPMENT Project: IMS View: Hotfixes Branch: KPAIDI_DEVELOPMENT <<Before adding the new branch KPAIDI_DEVELOPMENT to the view>> Jobs in the all/job/IMS/view/Hotfixes view -------------------------------------------- 6.2.3-HOTFIX-BU 6.2.3-HOTFIX-CJ 6.2.3-HOTFIX-CN 6.2.3-HOTFIX-CP 6.2.3-HOTFIX-CQ 6.2.3-HOTFIX-CR 6.2.3-HOTFIX-CT 6.2.3-HOTFIX-CU 6.2.3-HOTFIX-CV 6.2.3-HOTFIX-CW 6.2.3-HOTFIX-CX 6.2.3-HOTFIX-CY 6.3.0-HOTFIX-C 6.3.0-HOTFIX-M 6.3.0-HOTFIX-S 6.3.0-HOTFIX-T 6.3.0-HOTFIX-U 6.3.0-HOTFIX-V 6.3.0-HOTFIX-W 6.3.0-HOTFIX-X 6.3.0-HOTFIX-Y 6.3.0-HOTFIX-Z 6.4.0-HOTFIX-A 6.4.0-HOTFIX-C 6.4.0-HOTFIX-D 6.4.0-HOTFIX-E 6.4.0-HOTFIX-F HOTFIX%20Branch%20Creation <<After adding the new branch KPAIDI_DEVELOPMENT/WRAPPER to the view>> Jobs in the all/job/IMS/view/Hotfixes view -------------------------------------------- 6.2.3-HOTFIX-BU 6.2.3-HOTFIX-CJ 6.2.3-HOTFIX-CN 6.2.3-HOTFIX-CP 6.2.3-HOTFIX-CQ 6.2.3-HOTFIX-CR 6.2.3-HOTFIX-CT 6.2.3-HOTFIX-CU 6.2.3-HOTFIX-CV 6.2.3-HOTFIX-CW 6.2.3-HOTFIX-CX 6.2.3-HOTFIX-CY 6.3.0-HOTFIX-C 6.3.0-HOTFIX-M 6.3.0-HOTFIX-S 6.3.0-HOTFIX-T 6.3.0-HOTFIX-U 6.3.0-HOTFIX-V 6.3.0-HOTFIX-W 6.3.0-HOTFIX-X 6.3.0-HOTFIX-Y 6.3.0-HOTFIX-Z 6.4.0-HOTFIX-A 6.4.0-HOTFIX-C 6.4.0-HOTFIX-D 6.4.0-HOTFIX-E 6.4.0-HOTFIX-F HOTFIX%20Branch%20Creation KPAIDI_DEVELOPMENT
          Vineeth Karkad made changes -
          Attachment New: Screenshot 2019-07-05 at 12.55.37 PM.png [ 47926 ]

          After adding the new branch KPAIDI_DEVELOPMENT to the Hotfixes view.

          Works perfectly fine.

          Vineeth Karkad added a comment - After adding the new branch KPAIDI_DEVELOPMENT to the Hotfixes view. Works perfectly fine.

          Vineeth Karkad added a comment - - edited

          Before proceeding with adding the new branch to Dashboard, I went about updating the view (Edit view option) and manually unchecked the jenkins job add to the Hotfixes view.

          Now, I will be re-running the tool to add the same branch to Dashboard view.

          Vineeth Karkad added a comment - - edited Before proceeding with adding the new branch to Dashboard, I went about updating the view (Edit view option) and manually unchecked the jenkins job add to the Hotfixes view. Now, I will be re-running the tool to add the same branch to Dashboard view.
          Vineeth Karkad made changes -
          Attachment New: Screenshot 2019-07-05 at 1.00.17 PM.png [ 47927 ]

          Displaying the Jobs part of the Dashboard view for reference (before running the tool to add to this view):

          Vineeth Karkad added a comment - Displaying the Jobs part of the Dashboard view for reference (before running the tool to add to this view):

          releng26.builders bin> python edit_jenkins_view.py IMS Dashboard KPAIDI_DEVELOPMENT
          Project: IMS
          View: Dashboard
          Branch: KPAIDI_DEVELOPMENT

          <<Before adding the new branch KPAIDI_DEVELOPMENT to the view>>
          Jobs in the all/job/IMS/view/Dashboard view
          --------------------------------------------
          6_5_0-LINA
          6_6_0-LINA
          DEV_PIPELINE
          DEVELOPMENT
          FAC
          GRADLE2
          IMS_6_2_2_6
          IMS_6_2_3
          IMS_6_2_3_14
          IMS_6_2_3_15
          IMS_6_3_0_4
          IMS_6_3_0_5
          IMS_6_3_0_5_AEP
          IMS_6_4_0_2
          IMS_6_4_0_3
          IMS_6_4_0_4
          IMS_6_5_0_IFT
          INTEG
          POLICY_APPLY
          SYBUPG
          TLS_13
          VIN_INF1
          VIN_INF2
          VULNPATCH
          WR_LTS18
          wr_rebase

          <<After adding the new branch KPAIDI_DEVELOPMENT/WRAPPER to the view>>
          Jobs in the all/job/IMS/view/Dashboard view
          --------------------------------------------
          6_5_0-LINA
          6_6_0-LINA
          DEV_PIPELINE
          DEVELOPMENT
          FAC
          GRADLE2
          IMS_6_2_2_6
          IMS_6_2_3
          IMS_6_2_3_14
          IMS_6_2_3_15
          IMS_6_3_0_4
          IMS_6_3_0_5
          IMS_6_3_0_5_AEP
          IMS_6_4_0_2
          IMS_6_4_0_3
          IMS_6_4_0_4
          IMS_6_5_0_IFT
          INTEG
          POLICY_APPLY
          SYBUPG
          TLS_13
          VIN_INF1
          VIN_INF2
          VULNPATCH
          WR_LTS18
          wr_rebase

          Vineeth Karkad added a comment - releng26.builders bin> python edit_jenkins_view.py IMS Dashboard KPAIDI_DEVELOPMENT Project: IMS View: Dashboard Branch: KPAIDI_DEVELOPMENT <<Before adding the new branch KPAIDI_DEVELOPMENT to the view>> Jobs in the all/job/IMS/view/Dashboard view -------------------------------------------- 6_5_0-LINA 6_6_0-LINA DEV_PIPELINE DEVELOPMENT FAC GRADLE2 IMS_6_2_2_6 IMS_6_2_3 IMS_6_2_3_14 IMS_6_2_3_15 IMS_6_3_0_4 IMS_6_3_0_5 IMS_6_3_0_5_AEP IMS_6_4_0_2 IMS_6_4_0_3 IMS_6_4_0_4 IMS_6_5_0_IFT INTEG POLICY_APPLY SYBUPG TLS_13 VIN_INF1 VIN_INF2 VULNPATCH WR_LTS18 wr_rebase <<After adding the new branch KPAIDI_DEVELOPMENT/WRAPPER to the view>> Jobs in the all/job/IMS/view/Dashboard view -------------------------------------------- 6_5_0-LINA 6_6_0-LINA DEV_PIPELINE DEVELOPMENT FAC GRADLE2 IMS_6_2_2_6 IMS_6_2_3 IMS_6_2_3_14 IMS_6_2_3_15 IMS_6_3_0_4 IMS_6_3_0_5 IMS_6_3_0_5_AEP IMS_6_4_0_2 IMS_6_4_0_3 IMS_6_4_0_4 IMS_6_5_0_IFT INTEG POLICY_APPLY SYBUPG TLS_13 VIN_INF1 VIN_INF2 VULNPATCH WR_LTS18 wr_rebase

            jhasse Jan Niklas Hasse
            vkarkad Vineeth Karkad
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: