0

I want to use property file in DSL job which will take my project name in job name and svn location . Can anyone have idea how to write and syntax?

1 Answers1

0

For handling properties files stored outside your repository, you have a plugin called "Config File Provider Plugin".

You use it like this:

stage('Add Config files') {
        steps {
            configFileProvider([configFile(fileId: 'ID-of-file0in-jenkins', targetLocation: 'path/destinationfile')]) {
            // some block
            }
        }
}

It is capable of replacing tokens in json and xml or the whole file (as in the example)

For handling data comming from the SVN or project name you can access the environment variables. See this thread and this link

TudorIftimie
  • 1,050
  • 11
  • 21
  • Hi, That means in property file in config file provider I can write "JOB_NAME: 'Project1' SVN_URL: 'http://myIP/svn/trunk-29April2020/trunk/' " like this and call this property file in DSL job script – user13249852 May 21 '20 at 06:07
  • Hi, @user13249852, please consider sharing a the pipeline code (masking the sensitive areas). – TudorIftimie May 21 '20 at 07:16
  • Hi , I am using a DSL job syntax: mavenJob('test') { logRotator(-1, 10) jdk('Java 8') scm { svn { location('http://myIP/svn/trunk-29April2020/trunk/') { credentials('hshshsxbhsbxhabskbab') } } goals('clean verify') } and in test.properties file I have defined projectName=Project1 SVN=http://svnurl – user13249852 May 21 '20 at 08:54