How to create, and push new Github branches using Jenkins for many repos?

Viewed 1073

I have a multi-repo project on GitHub.

I want to use a branching system to cut the branches and create release/version branches for all the repos (could be up to 50)

What would the best approach be on Jenkins to go through all of these repos and create these branches?

Is the best approach to use the Jenkins shell to repetitively on each repo?

git checkout -b new-branch
git push -u origin new-branch
...repeat for all repos.

How to create new git branch with jenkins shell

However, for this approach I get a "could not read Username for 'https://github.com': No such device or address" as mentioned here: Jenkins - could not read Username for 'https://github.com': No such device or address

Is there a solution, or plugin that Jenkins has for creating and pushing a new branch to many different repos within one job?

Also, I may only want to create a release branch, if there has been new commits since the last time a release branch was created. Would there be a way to do this?

1 Answers

The way that I ended up solving this was to create multiple Jenkins jobs, each pointing to a single repo.

I was unable to find a way that achieved the above, and managed to combine multiple repository references, and pushes, into a single job.

I created an additional Jenkins job that called all the other jobs to Start that I wanted to run simultaneously.

Related