简体   繁体   中英

How can I create a dot file in the workspace from the jenkins job

I have a jenkins job that amongst other things I want to dynamically create a .foo and a .bar file in my jenkins workspace home directory as the job is running.

How can I do that with bash as a part of the job?

The job will run after a Docker container has been created with the Docker Plugin.

So the order of precedence I want is :

Job starts:

  1. docker container get's created
  2. create .foo file (and enter foobarbaz as a content in the file)
  3. create .bar file (and enter foobarbaz as a content in the file)

How can I achieve this?

One simple solution would be to associate your Jenkins job with a source controlled repository URL, which already include the files with the right content.

Each job execution would create a workspace populated with that repo content, and launch your docker container.

If not, you would need to add a script step, like this one in Groovy .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM