2

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

1 Answer 1

3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.