1

So basically I already have the deploy part working in one job, using MSBuild 14.0 and the above configuration:

/p:Configuration=Release 
/p:Platform=AnyCPU 
/t:WebPublish 
/p:WebPublishMethod=FileSystem 
/p:DeleteExistingFiles=True 
/p:publishUrl=C:\website

Now what I want to is to push this folder to another repository, which has the exact file structure (I want to overwrite the files) but I can't figure out how. What I've tried so far is:

  1. Use Git Publisher, but since I want to push to ANOTHER repository, I didn't know how to reference this other repo in my Jenkins Job. If I define both repositories in the SCM configuration, the job's workspace is overwritten by one of the repositories' folders, but I need both of them, since I build one repo and want the output to be sent to the other one.

  2. Try to call another job when the build job is completed successfully, with the repository to be pushed configured as my SCM, and make the /p:publishUrl property on MSBuild point to that job's workspace. This doesn't work, because when this second job starts it overwrites all the files that I got from the build in the first job.

  3. Build and deploy the repo in one job, and publish it to a folder where I already have a clone of the target repo. Then I added the following steps to the build to commit the changes:

    cd C:\website
    git checkout test
    git commit -am "Commit made from Jenkins job"
    

This does nothing - The job tries to fetch the repo to build and this never ends, and I have no idea why.

Ideally, is there any way to make a job that only commits a local folder to a git repo, without building anything previously?

0 Answers0