The original requirements

Due to the existence of different environments in project development and construction, there are branches corresponding to different environments

  • For example, the development environmentdevDevelopment branch
  • Test EnvironmenttestTest branch
  • Simulation environment correspondenceuatUat branch
  • Production EnvironmentprodProduction branch
  • The master generally acts as a stable branch in the production line, maintaining versions and acting on the base branch to create new branches.

After each requirement development goes online, each branch should be rebuilt based on the latest online code to ensure the unity of each branch code. Branches already under development can reverse merge themselves based on the latest Master branch

# your branch
$ git pull
$ git merge orgin/master
Copy the code

Since the code repository is managed on the basis of GitLab, each reconstruction of each branch requires repeated operations, so make a tool that can rebuild the environment branch with one click

function

  • Log in with gitlab account
  • Quickly rebuild branches with one click based on the warehouse
  • Support batch reconstruction of multiple warehouses
  • Support flying books, enterprise wechat notification
  • Viewing the Rebuild Log

TODO

  • Support for creating new version tags
  • .

Code implementation

Technology stack: electron-vue

Train of thought

Graph TD get all the repositories under the current account permission -> select the repository -> delete the branches -> rebuild the branches based on the master

The core source

// re-create branch (id, brancheName) {return new Promise(resolve, reject) => { const createBranch = () => { axios.post(`/projects/${id}/repository/branches? branch=${brancheName}&ref=master`).then((response) => { resolve(response); }, (err) => { reject(err); }); }; axios.delete(`/projects/${id}/repository/branches/${brancheName}`).then(() => { createBranch(); }, (err) => {// Delete branch 404, indicating that the branch does not exist, If (err.response && err.response.status && err.response.status === 404) {createBranch(); } else { reject(err); }}); }); }Copy the code

reference

  • Electron document: electron
  • Electron – vue: electron – vue
  • UI framework: Vuesax
  • Gitlab operation documentation: GitLab documentation