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

Kubernetes agent environment not working with Git Parameter branch variable in SCM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Blocker Blocker
    • kubernetes-plugin
    • None

      When using Git Parameter variable (ex ${BRANCH}) git checkout can be made in any "phisical node" but branch variable is not recognize by  any kubernetes agent, but if a string is used instead checkout is meade in kubernetes properly.

      JOB CONFIG

      1) Git Parameter configuration in job

      2) SCM configuration

      FAILED PIPELINE LOGS

      1) Correct SCM in 'master' label \\{_}Stage => Prepare\\{_}, ${BRANCH} variable is highlighted

      (pipeline code block)

      Branch was clone fine

      2) When trying to clone inside kubernetes environment ${BRANCH} is not recognized \\{_}Stage =>\\{_} \\{_}Build PHP test image\\{_}. Variable is highlighted, values is not recognized (seems treated as string).

      (pipeline code block)

      SUCCESS PIPELINE LOGS

      If the needed branch is hardcoded instead of the Git Parameter variable, checkouts work fine even in kubernetes environment

      1) SCM configuration

      2) Kubernetes agent/pod is created and checkout is performed inside, branch name is now correct (highlighted) \\{_}Stage =>\\{_} \\{_}Build PHP test image\\{_}

      • Why is the Git Parameter variable not recognized by kubernetes?
      • How can we pass that variable to kubernete-pligin?

      Could you help on this? Thanks in advance

      Regards!

      PS: This is the kubernetes agent definition

      kaniko-pod-definition.yaml

      (Also attahced)

       

        1. image-2023-08-11-17-19-47-664.png
          32 kB
          David
        2. image-2023-08-11-17-20-44-031.png
          52 kB
          David
        3. image-2023-08-11-17-28-13-417.png
          123 kB
          David
        4. image-2023-08-11-17-31-36-824.png
          138 kB
          David
        5. image-2023-08-11-17-37-56-019.png
          168 kB
          David
        6. image-2023-08-11-17-50-31-412.png
          55 kB
          David
        7. image-2023-08-11-18-01-25-547.png
          195 kB
          David
        8. image-2023-08-11-18-04-59-450.png
          35 kB
          David
        9. image-2023-08-15-13-16-26-101.png
          18 kB
          David
        10. image-2023-08-15-13-16-44-532.png
          22 kB
          David
        11. kaniko-pod-definition.yaml
          0.3 kB
          David

            Unassigned Unassigned
            tang81 David
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: