Details

    • Similar Issues:

      Description

      Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

      The issues I ran into:

      1. Accessing a tool in a declarative pipeline should work just fine.
      2. Defining a custom workspace is not allowed in a declarative pipeline.
      3. Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

      This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

      node {
          def goHome = tool('go-1.11')
          
          ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
              withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
              ...
          }
      }
      

        Attachments

          Activity

          bmuchko Benjamin Muschko created issue -
          bmuchko Benjamin Muschko made changes -
          Field Original Value New Value
          Description Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

           

          The issue I ran into:

           
           # Accessing a tool in a declarative pipeline should work just fine.
           # Defining a custom workspace is not allowed in a declarative pipeline.
           # Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

           

          This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

           

          {{node {}}
          {{ def goHome = tool('go-1.11')}}
           
          {{ ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {}}
          {{   withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {}}

          {{       ... }}

          {{    }}}

          {{}}}
          Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

           

          The issue I ran into:

           
           # Accessing a tool in a declarative pipeline should work just fine.
           # Defining a custom workspace is not allowed in a declarative pipeline.
           # Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

           

          This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

          <code>
          node {
              def goHome = tool('go-1.11')
              
              ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
                  withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
                  ...
              }
          }
          </code>
          bmuchko Benjamin Muschko made changes -
          Description Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

           

          The issue I ran into:

           
           # Accessing a tool in a declarative pipeline should work just fine.
           # Defining a custom workspace is not allowed in a declarative pipeline.
           # Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

           

          This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

          <code>
          node {
              def goHome = tool('go-1.11')
              
              ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
                  withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
                  ...
              }
          }
          </code>
          Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

           

          The issue I ran into:

           
           # Accessing a tool in a declarative pipeline should work just fine.
           # Defining a custom workspace is not allowed in a declarative pipeline.
           # Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

           

          This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

          {code}
          node {
              def goHome = tool('go-1.11')
              
              ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
                  withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
                  ...
              }
          }
          {code}
          bmuchko Benjamin Muschko made changes -
          Description Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

           

          The issue I ran into:

           
           # Accessing a tool in a declarative pipeline should work just fine.
           # Defining a custom workspace is not allowed in a declarative pipeline.
           # Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

           

          This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

          {code}
          node {
              def goHome = tool('go-1.11')
              
              ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
                  withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
                  ...
              }
          }
          {code}
          Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

          The issues I ran into:
           # Accessing a tool in a declarative pipeline should work just fine.
           # Defining a custom workspace is not allowed in a declarative pipeline.
           # Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

          This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

          {code}
          node {
              def goHome = tool('go-1.11')
              
              ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
                  withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
                  ...
              }
          }
          {code}
          bmuchko Benjamin Muschko made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              orrc Christopher Orr
              Reporter:
              bmuchko Benjamin Muschko
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: