1

I want to set up a staging server where each developer will have his own docker container running the app and Jenkins .

I want each one to be able to connect his github branch with his jenkins server with the github plugin for jenkins and create the automated build pipeline. But every branch will be in the same corporate private repository.

Push code from IDE -> Code goes on Github -> Github pushes to jenkins(in container) -> jenkins builds new code(in container) -> tester connects to container and browses the app branch

I have made 2 containers each with a jenkins server. One is connected with master branch and the other with branch1 of the same repo. But each repo allows only one implementation of the github plugin for jenkins. Setting one new repo for every branch seems kind of silly and wasteful.

Best case scenario would be to connect many jenkins servers with the same repo but on different ports by specifying different branches.

Is something like this possible?

Kostas Demiris
  • 3,415
  • 8
  • 47
  • 85

1 Answers1

0

If those docker container can mount the same data container with the git repo in it, that means they can checkout different branches per repo.

For that, they need a recent git (2.5+) and to use the new git worktree add command.
Then those containers would work in a worktree set to a different branch per container, but all pointing to the same repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • VonC to the rescue...again! :] So Git has a solution for this. Could you give a simple example to better understand it [even though I will dive into it in the next days]? How would it be best set up in order to be automated? How does Github fit into it? How would it be used by a developer with a new branch? Thanks! – Kostas Demiris Oct 16 '15 at 18:52
  • @KostasDemiris GitHub is a repo hosting service, so it wouldn't fit except to propose repos to be cloned. Once cloned, a repo can be checked out into multiple work tree. That means a docker container can be created to run a `git worktree add []`, getting a new working tree for the same repo. – VonC Oct 16 '15 at 19:15