Ronald
Ronald

Reputation: 2917

HOW to enable jenkins job to read user input variable?

I have created jenkins job which create a new git branch and create some directory in the project using the following command:

mkdir -p myproject/newFolder

Now I would like to give to user to the possibility to give newFolder name from the job itself and not from the job configure. here is the use case:

  1. user go to the jenkins job
  2. user enter the name of newFolder let's say newFolder:ThisIsMyNewFolder
  3. user starts the job
  4. jenkins job runs and creates the new folder myproject/ThisIsMyNewFolder

Upvotes: 0

Views: 304

Answers (1)

Harshavardhan Konakanchi
Harshavardhan Konakanchi

Reputation: 4284

You can use a buildParameter and create parameterised build with FOLDERNAME as parameter

Then your batch will be like
       mkdir -p myproject/%FOLDERNAME%
and shell as
       mkdir -p myproject/$FOLDERNAME

Upvotes: 2

Related Questions