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)

       

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

              Created:
              Updated: