gophergfer
gophergfer

Reputation: 311

How do I define the parameterized SVN url in the Jenkins SCM pipeline

I used the Pipeline script from SCM method to build, like this: enter image description here

Here you need to fill in a svn url, but my svn has many branches, like this:

172.20.1.1/testProject/trunk/xxx
172.20.1.1/testProject/branches/xxx
172.20.1.1/testProject/branches/yyy

Each of these branches has its own jenkinsfile, so when I submit a new code in a branch, I need to start a new build. When building, I decide which branch to use according to the parameters I filled in, so I put the Repository here The URL is changed to a parameterized format, but it doesn’t work no matter how I test it.such as: $SVN_URL,${SVN_URL}, etc. He will give error enter image description here

can you give me some help, thanks in advance

Upvotes: 2

Views: 917

Answers (2)

jhn
jhn

Reputation: 71

From my point of view, your issue is not so much with the job configuration. Defining a parameterized job and referencing the variable later in that job is fine (no matter the variable format, e.g., $var or ${var}).

However, you seem to suffer from a bug in the underlying pipeline SCM plugin.

I am summarizing the SO answer that solved it for git-based Jenkins pipeline jobs but also applies to svn-based jobs: https://stackoverflow.com/a/57065165/1994888 (credits go to @rupesh).

Summary

  1. Edit your job config
  2. go to the Pipeline section
  3. go to the definition Pipeline script from SCM
  4. uncheck Lightweight checkout

The issue seems to be with the scm-api-plugin (see the bug report in the Jenkins issue tracker), hence, it is not specific to a version control system.

Upvotes: 2

cloud4dev
cloud4dev

Reputation: 11

I had the same problem and I solved it settin base path of url repo

  1. Create Globals properties in "Manage Jenkins" -> "Configure System" Name: SVN_URL Value : http://172.20.1.1/testProject/trunk/

  2. In the job configuration set the repository url base parametrized: ${SVN_URL}/xxx

  3. Inside SCM configuration in Check-out Strategy: Check the option -> Quiet check-out

Upvotes: 1

Related Questions