How can I setup hudson (or jenkins) build from release/hotfix branches using the git-flow branching model?

StackOverflow https://stackoverflow.com/questions/7785455

  •  10-02-2021
  •  | 
  •  

Pergunta

My company is switching from svn to git and I am researching various branching models. The one I like the most so far is git-flow but I have one major unresolved issue with it.

We use hudson (soon to be jenkins) for our CI server. There are 5 applications, with 3 environments each: development, qa, and production. With git-flow, it would be obvious to point the development build to the "develop" branch and the production build to the "master" branch, but what is the best way to go about setting things up so that we can easily redirect the qa environment to the latest hotfix or release branch if one exists, or develop if not. We currently just update the jenkins jobs manually, but its a pain (and error prone) to manually change 5 jobs.

Some things I've considered:

  1. Adding a qa branch and merging into it from release/hotfix branches. This is a non-starter because we'd have to remember to merge into the qa branch anytime we make a change to release/hotfix and that gets old fast.

  2. Creating a symbolic-ref "refs/heads/qa" and just updating it to point to whatever we want QA to test. This is better than above, but doesn't work because we would need to update the sym-ref on our git server, and normal developers don't have permissions to do so.

So far, neither of these options seem viable to me, are there some other options I am missing? Thanks.

Foi útil?

Solução

I'm not quite getting the specifics of your question, but how about this:

In the build config, check "This build is parameterized", then create a string or choice parameter called "branch" (or similar), which defaults to your develop branch.

Then, in the git config, where the branch name normally goes, use "${branch}" instead of hardcoding the branch name.

If a build is triggered automatically, it will use the develop branch. But when you start a build manually, you'll get the option of specifying a new branch name.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top