<p>You can pass your data using environment variables or through job parameters. </p>

<p>Here's an example of setting environment variables in a pipeline:</p>



<pre class="lang-java prettyprint-override"><code>pipeline {
    agent any
    environment {
        FILE = "Makefile"
        SERVER = "example.com"
        VERSION = "v1.1.0"
    }
    stages {
        stage ('build') {
            steps {
                echo "VERSION is: $VERSION"
                bat "script.exe ${version} ${server} ${file}"
            }
        }
    }
}
</code></pre>

<p>If you want to use parameters instead you could do so in the following pipeline example:</p>

<pre class="lang-java prettyprint-override"><code>pipeline {
  agent any
  parameters {
    string(description: 'file', name: 'file')
    string(description: 'server', name: 'server')
    string(description: 'version', name: 'version')
  }
  stages {
    stage("foo") {
      steps {
        echo "VERSION is: ${params.version}"
        bat "script.exe ${params.version} ${params.server} ${params.file}"
      }
    }
  }
}
</code></pre>

<p>See the following documentation for building a parameterized pipeline:
<a href="https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Parametrized-pipelines" rel="nofollow noreferrer">https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Parametrized-pipelines</a></p>

<p>If you're using a freestyle job it's slightly different but you can find detailed instructions here:
<a href="https://wiki.jenkins.io/display/JENKINS/Parameterized+Build" rel="nofollow noreferrer">https://wiki.jenkins.io/display/JENKINS/Parameterized+Build</a></p>

CC BY-SA 4.0
2018-02-22T19:06:50.760Z
2018-07-20T18:53:22.937Z
2018-07-20T18:53:22.937Z
casey vega
<p>I've build which is checked-in on the PTC Integrity and I've raised the CR or SR ticket(Build &amp; Deploy Request) on the PTC life manager by developer for deploy his build on some XXXX server and the version of the build is xxxx.</p>

<p>As of now as a deployment team we are following the below process</p>

<p>If we get a ticket we assigned it to us.
And then collect all those details which is on the ticket by manually and doing deployment also by manually.</p>

<p>Instead of this now we are planning to do this on automation.</p>

<p>How do I get the following details on the Jenkins to do my deployment. I've some bat script to do the deployment. To kick off that bat file, it needs the following details:</p>

<ol>
<li>Version of the build</li>
<li>Which server the Build needs to deploy</li>
<li>Where the build file is located</li>
</ol>

<p>I need to collect all those above details from the PTC ticket which I had created earlier
Is there any possiblity from Jenkins can I able to get those values from the ticket number.</p>

<p>I'm very new to PTC.
I came to know from google there is a plugin available for PTC with Jenkins</p>

<p>Could someone please help on this</p>

<jenkins><jenkins-plugins>
PTC with Jenkins on Deployment based on the Build request which raised on PTC
Narayana Boominathan
# PTC with Jenkins on Deployment based on the Build request which raised on PTC

(Asked by: username_0 on 2018-02-20)

I've build which is checked-in on the PTC Integrity and I've raised the CR or SR ticket(Build & Deploy Request) on the PTC life manager by developer for deploy his build on some XXXX server and the version of the build is xxxx.

As of now as a deployment team we are following the below process

If we get a ticket we assigned it to us.
And then collect all those details which is on the ticket by manually and doing deployment also by manually.

Instead of this now we are planning to do this on automation.

How do I get the following details on the Jenkins to do my deployment. I've some bat script to do the deployment. To kick off that bat file, it needs the following details:

1. Version of the build
2. Which server the Build needs to deploy
3. Where the build file is located

I need to collect all those above details from the PTC ticket which I had created earlier
Is there any possiblity from Jenkins can I able to get those values from the ticket number.

I'm very new to PTC.
I came to know from google there is a plugin available for PTC with Jenkins

Could someone please help on this

**Tags:** jenkins, jenkins-plugins


---

## 1 answers

### Answer by username_1 on 2018-02-22. Score: 3 | Accepted answer

You can pass your data using environment variables or through job parameters. 
Here's an example of setting environment variables in a pipeline:
pipeline {
    agent any
    environment {
        FILE = "Makefile"
        SERVER = "example.com"
        VERSION = "v1.1.0"
    }
    stages {
        stage ('build') {
            steps {
                echo "VERSION is: $VERSION"
                bat "script.exe ${version} ${server} ${file}"
            }
        }
    }
}

If you want to use parameters instead you could do so in the following pipeline example:
pipeline {
  agent any
  parameters {
    string(description: 'file', name: 'file')
    string(description: 'server', name: 'server')
    string(description: 'version', name: 'version')
  }
  stages {
    stage("foo") {
      steps {
        echo "VERSION is: ${params.version}"
        bat "script.exe ${params.version} ${params.server} ${params.file}"
      }
    }
  }
}

See the following documentation for building a parameterized pipeline:
https://github.com/jenkinsci/pipeline-model-definition-plugin/wiki/Parametrized-pipelines
If you're using a freestyle job it's slightly different but you can find detailed instructions here:
https://wiki.jenkins.io/display/JENKINS/Parameterized+Build


---

