[JIRA] (JENKINS-50718) append tool HOME to PATH in declarative Pipeline

4 views
Skip to first unread message

domi@fortysix.ch (JIRA)

unread,
Apr 10, 2018, 10:27:02 AM4/10/18
to jenkinsc...@googlegroups.com
Dominik Bartholdi created an issue
 
Jenkins / Improvement JENKINS-50718
append tool HOME to PATH in declarative Pipeline
Issue Type: Improvement Improvement
Assignee: Oleg Nenashev
Components: customtools-plugin
Created: 2018-04-10 14:26
Environment: custom-tools-plugin: 0.5
Jenkins: 2.89.4.1
Priority: Minor Minor
Reporter: Dominik Bartholdi

I have the following custom-tool configured:

 

Name: jx-release-version
Install automatically: on
Script:

#!/bin/sh
set -e

JX_RELEASE_VERSION=v1.0.10
JX_RELEASE_VERSION_DIR=${HOME}/tools/jx-release-version-${JX_RELEASE_VERSION}

if test ! -x "${JX_RELEASE_VERSION_DIR}"/firefox ; then
  mkdir -p "${JX_RELEASE_VERSION_DIR}"
  cd "${JX_RELEASE_VERSION_DIR}"
  wget https://github.com/jenkins-x/jx-release-version/releases/download/${JX_RELEASE_VERSION}/jx-release-version-linux
  mv jx-release-version-linux jx-release-version
  chmod 755 jx-release-version
fi

Tool Home: /${HOME}/tools/jx-release-version-v1.0.10

 

And I try to use it in my pipeline, the tool gets installed, but its HOME is not added to PATH:

pipeline {
  agent { label 'lxc-fedora25' }
  tools {
    'com.cloudbees.jenkins.plugins.customtools.CustomTool' 'jx-release-version'
  }
  stages {
    stage ('step 1') {
      steps {
        script {
          sh "jx-release-version"
        }
      }
    }
  }
}

If I do it this way, then it works all fine, but this is not really the declarative way to do it:

pipeline {
  agent { label 'lxc-fedora25' }
  environment {
    jx_path = tool name: 'jx-release-version', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
  }
  stages {
    stage ('step 1') {
      steps {
        script {
          sh "${jx_path}/jx-release-version"
        }
      }
    }
  }
}

So my request is, to support the first pipeline definition and add the custom-tool HOME to PATH, which I'm sure is what people would expect this plugin todo.

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

domi@fortysix.ch (JIRA)

unread,
Jun 15, 2018, 7:47:02 AM6/15/18
to jenkinsc...@googlegroups.com
Dominik Bartholdi commented on Improvement JENKINS-50718
 
Re: append tool HOME to PATH in declarative Pipeline

Andrew Bayer just a little ping about this issue, as we discussed a couple of weeks ago...

domi@fortysix.ch (JIRA)

unread,
Jun 15, 2018, 7:48:02 AM6/15/18
to jenkinsc...@googlegroups.com
Dominik Bartholdi updated an issue
 
Change By: Dominik Bartholdi
I have the following custom-tool configured:

 

Name: jx-release-version
Install automatically: on
Script:
{code:java}

#!/bin/sh
set -e

JX_RELEASE_VERSION=v1.0.10
JX_RELEASE_VERSION_DIR=${HOME}/tools/jx-release-version-${JX_RELEASE_VERSION}

if test ! -x "${JX_RELEASE_VERSION_DIR}"/ firefox jx-release-version ; then

  mkdir -p "${JX_RELEASE_VERSION_DIR}"
  cd "${JX_RELEASE_VERSION_DIR}"
  wget https://github.com/jenkins-x/jx-release-version/releases/download/${JX_RELEASE_VERSION}/jx-release-version-linux
  mv jx-release-version-linux jx-release-version
  chmod 755 jx-release-version
fi{code}

Tool Home: /$\{HOME}/tools/jx-release-version-v1.0.10

 

And I try to use it in my pipeline, the tool gets installed, but its HOME is not added to PATH:
{code:java}

pipeline {
  agent { label 'lxc-fedora25' }
  tools {
    'com.cloudbees.jenkins.plugins.customtools.CustomTool' 'jx-release-version'
  }
  stages {
    stage ('step 1') {
      steps {
        script {
          sh "jx-release-version"
        }
      }
    }
  }
}{code}

If I do it this way, then it works all fine, but this is not really the declarative way to do it:
{code:java}

pipeline {
  agent { label 'lxc-fedora25' }
  environment {
    jx_path = tool name: 'jx-release-version', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
  }
  stages {
    stage ('step 1') {
      steps {
        script {
          sh "${jx_path}/jx-release-version"
        }
      }
    }
  }
}{code}

So my request is, to support the first pipeline definition and add the custom-tool HOME to PATH, which I'm sure is what people would expect this plugin todo.

 

o.v.nenashev@gmail.com (JIRA)

unread,
Jan 2, 2019, 4:12:02 AM1/2/19
to jenkinsc...@googlegroups.com
Oleg Nenashev assigned an issue to Unassigned
Change By: Oleg Nenashev
Assignee: Oleg Nenashev
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

o.v.nenashev@gmail.com (JIRA)

unread,
Jan 2, 2019, 4:13:02 AM1/2/19
to jenkinsc...@googlegroups.com
Oleg Nenashev commented on Improvement JENKINS-50718
 
Re: append tool HOME to PATH in declarative Pipeline

No plan to work on this feature, I have marked the plugin for adoption.

Dominik Bartholdi is it a Jenkins X-related feature request just in case?

domi@fortysix.ch (JIRA)

unread,
Jan 23, 2019, 5:52:46 AM1/23/19
to jenkinsc...@googlegroups.com

Oleg Nenashev no, its not related to Jenkins X - it just happens that we use a Tool provided by Jenkins X in a standalone way

domi@fortysix.ch (JIRA)

unread,
Jan 23, 2019, 5:53:21 AM1/23/19
to jenkinsc...@googlegroups.com

domi@fortysix.ch (JIRA)

unread,
Jan 23, 2019, 5:53:26 AM1/23/19
to jenkinsc...@googlegroups.com

benjamin.steinwender@k-ai.at (JIRA)

unread,
Jul 1, 2019, 3:47:02 PM7/1/19
to jenkinsc...@googlegroups.com

I usually add it manually:

  environment {
    jx_path = tool name: 'jx-release-version', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
    PATH = "${jx_path}\\bin;${PATH}"
  }

then the tool is also first in path

benjamin.steinwender@k-ai.at (JIRA)

unread,
Jul 1, 2019, 3:48:03 PM7/1/19
to jenkinsc...@googlegroups.com
Benjamin St. edited a comment on Improvement JENKINS-50718
I usually add it manually:
{code:java}

  environment {
    jx_path = tool name: 'jx-release-version', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
    PATH = "${jx_path}
\\bin :${PATH}"
//    PATH = "${jx_path}
;${PATH}" // on windows, you need ;
  }
{code}

then the tool is also first in path
Reply all
Reply to author
Forward
0 new messages