Perform jenkins build on local files

2019-08-19 18:47发布

We have a Jenkins server where I have already defined my job. It uses Perforce as SCM.

I would like to replicate all the steps that Jenkins takes to build the project but use the files in my local workspace instead. Basically, I would like to run a jenkins build locally based on a job defined on another server.

How would I do the same?

3条回答
家丑人穷心不美
2楼-- · 2019-08-19 19:29

1) Install Jenkins on your local workstation (if you have no already done so).

2) Copy the /Jenkins/jobs/ directory to the /Jenkins/jobs/ directory on your local workstation.

3) Fire it up and edit the Perforce workspace (and any other settings) as necessary.

查看更多
Rolldiameter
3楼-- · 2019-08-19 19:31

Something like what I created for my Perforce users might work for you -- I added a job in Jenkins that will grab shelved files (so, the user would need to shelve the files), create a build from there, then let the user know if it was successful (they also have the option of running tests or creating a deployable build). The gist of it is to request the shelved changelist #, then do this: "p4 unshelve -s %SHELVEDCL% " and proceed as usual. They use it when they feel like it; it's been useful. But it does require access to Jenkins.

查看更多
Luminary・发光体
4楼-- · 2019-08-19 19:47

IMO, you should probably takes these steps:

  1. Create a new Jenkins job from the existing one. 2) Modify the job to be a string "parameterized" job where you pass branch-name as the parameter. You can do using "This build is parameterized" option in the configuration of the job. 3) Under the configuration of the job, for Source Code Management section, change the Branch Specifier to use the String Parameter variable name (created from #2 above). 4) Create your feature branch on Perforce and make intended changes there. 5) Run the newly created job with your branch as the parameter to it.

Hope this helps.

查看更多
登录 后发表回答