Git/CI workflow: remote branch to specify version to deploy on integration-test system?

48 views Asked by At

We are currently using a remote branch to point at the version to be deployed by our continous-integration system (Jenkins) on the integration test system (using Docker). Whenever we update the remote branch, the CI system checks out and builds the branch and deploys the result on the integration test system.

This works fine, as long as this branch follows another branch (merges and fast-forward commits). When we want to switch the integration-test system between feature branches, it would be easier to reset the branch pointer. However, reseting the remote branch pointer seems to be prohibited in the default configuration (Git reset --hard and a remote repository).

Before we are going to change the default configuration - is there a (best-practice) alternative to using a remote branch for the workflow that we've realized?

1

There are 1 answers

1
JasonRobinson On

Try the following:

  • set up a generic job with no git repo
  • set up the job with the paramaterized build plugin
  • provide the branch name as an on demand build parameter but also have a default value
  • in the build steps, manually kick off a git command that makes use of the branch name via the parameter you provided

This will not automate the process unless you schedule this job to run every "X" interval. Since there is no Repo for jenkins to check, this job will run every time it is scheduled.