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

Read pod template yaml from external file

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      When creating a Jenkinsfile I'd like to read the pom template from an external yaml, and not from embedded yaml in the agent definition yaml field which is harder to edit

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            I think the solution here is to add a yamlFile or whatever parameter for the Kubernetes agent type, and modify KubernetesDeclarativeAgentScript to check if that parameter is given, and then assuming it is and the scm object in the Pipeline context is non-null (i.e., this is either a multibranch Pipeline or a standalone Pipeline with "Pipeline from SCM"), it would use readTrusted to load the yaml and pass it on from there. Seems pretty simple.

            Show
            abayer Andrew Bayer added a comment - I think the solution here is to add a yamlFile or whatever parameter for the Kubernetes agent type, and modify KubernetesDeclarativeAgentScript to check if that parameter is given, and then assuming it is and the scm object in the Pipeline context is non-null (i.e., this is either a multibranch Pipeline or a standalone Pipeline with "Pipeline from SCM"), it would use readTrusted to load the yaml and pass it on from there. Seems pretty simple.
            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - Got a preliminary PR up at https://github.com/jenkinsci/kubernetes-plugin/pull/355
            Hide
            csanchez Carlos Sanchez added a comment -

            Merged in 1.10.0

            Show
            csanchez Carlos Sanchez added a comment - Merged in 1.10.0
            Hide
            bowlingx David Heidrich added a comment -

            Using yamlFile does not work with parameterized git branch builds.

            I'm getting the following exception when the plugin tries to load the file:

            hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH} --prune" returned status code 128:
            stdout: 
            stderr: fatal: Couldn't find remote ref refs/heads/${BRANCH}
            
            Show
            bowlingx David Heidrich added a comment - Using yamlFile does not work with parameterized git branch builds. I'm getting the following exception when the plugin tries to load the file: hudson.plugins.git.GitException: Command "git fetch --tags --progress origin +refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH} --prune" returned status code 128: stdout: stderr: fatal: Couldn't find remote ref refs/heads/${BRANCH}
            Hide
            bowlingx David Heidrich added a comment - - edited

            Carlos Sanchez. See my previous comment regarding parameterized builds and declarative pipeline.

            Show
            bowlingx David Heidrich added a comment - - edited Carlos Sanchez . See my previous comment regarding parameterized builds and declarative pipeline.
            Hide
            csanchez Carlos Sanchez added a comment -

            isn't that JENKINS-52623 ?
            please do not reopen, and file a new issue instead if that's not the case

            Show
            csanchez Carlos Sanchez added a comment - isn't that JENKINS-52623 ? please do not reopen, and file a new issue instead if that's not the case
            Hide
            ajithkrishnar Ajith Krishna added a comment - - edited

            podTemplate(label: slave_label, cloud: "${cloud_name}", readFile : 'deploy.yml' ) {
             
            }
             
            i used deploy.yml and added all pod , namespace , name , image and resources etc.
            but pod is not creating . its not even reading the yaml file. instead its going to docker hub internet. but my image is in my own artifactory . i checked kubernetes dashboard pod is not creating due jnlp was not created.
            error is like pod bddrunner(my pod mentioned in yaml file) is offline
            please help me to fix it.
             
            yaml file:
            apiVersion: v1
            kind: Pod
            metadata:
            name: bdd-runner
            namespace: edison-core
            spec:
            containers:

            • name: 'jnlp'
              image: 'myartifactory/jenkins/jnlp-slave:3.10-1-alpine'
              command:
            • cat
              tty: true
            • name: 'custom-slave'
              image: 'my artifactorydocker-snapshot-abs/eis-test-data/absdata:latest'
              command:
            • cat
              tty: true
            Show
            ajithkrishnar Ajith Krishna added a comment - - edited podTemplate(label: slave_label, cloud: "${cloud_name}", readFile : 'deploy.yml' ) {   }   i used deploy.yml and added all pod , namespace , name , image and resources etc. but pod is not creating . its not even reading the yaml file. instead its going to docker hub internet. but my image is in my own artifactory . i checked kubernetes dashboard pod is not creating due jnlp was not created. error is like pod bddrunner(my pod mentioned in yaml file) is offline please help me to fix it.   yaml file: apiVersion: v1 kind: Pod metadata: name: bdd-runner namespace: edison-core spec: containers: name: 'jnlp' image: 'myartifactory/jenkins/jnlp-slave:3.10-1-alpine' command: cat tty: true name: 'custom-slave' image: 'my artifactorydocker-snapshot-abs/eis-test-data/absdata:latest' command: cat tty: true
            Hide
            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            Show
            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

              People

              Assignee:
              abayer Andrew Bayer
              Reporter:
              csanchez Carlos Sanchez
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: