Gated Commit is an integration pattern that means the commit does not happens until a set of checks is passed against the code. It helps the developers to avoid breaking the code and prevents bad code from going into the integration branch. This should take place before committing changes to the Version Control System(VCS i.e. central server).
- Download the installer file from your Embold Account’s section > Releases tab. There will be one file with names similar to the following: ‘embold_ubuntu_with_dependencies_126.96.36.199.run’.
- Go to the Corona path $CORONA_HOME/coronacli/config/cli.properties and add Embold credentials in CLI properties file.
- Make sure that installer file ‘embold_ubuntu_with_dependencies_188.8.131.52.run’ has execution permission. To check the permissions of the installer file, run the following command in the terminal.
If the file does not have the execution permission, use the following command to grant the permission.
sudo chmod 755 embold_ubuntu_with_dependencies_184.108.40.206.run
- Copy the file from Corona folder to source base directory.
- For Git: Copy “commit-msg” from $CORONA_HOME/coronacli/config/commit-msg to baseDir/.git/hooks
- For SVN: Copy “pre-commit” file to svn/hooks/pre-commit (This pre-commit files should always be present on the server)
Check if commit-msg and pre-commit have execution permissions.
- Make the necessary code changes if required.
- Commit the changes done using the below command:
git commit -m "Committing changes"
- If the commit is successful, no errors are displayed on the console.
- If the commit fails, the list of issues is displayed on the console.
What if you still want to commit?
Sometimes, the user may have to accidentally commit and push their code to the main branch. There are 2 ways through which a user can commit these changes:
- Force-commit: User may have to immediately commit the code changes due to any of the emergency condition. Embold analysis will be done and still, commit will not fail.
There may be a list of issues present while committing these changes.
Added issues will be attached to the commit-msg.
- Below is the command for force-commit:
git commit -m "Committing changes embold --force-commit"
- Skip: Users may have to skip gated commit if bad code is present. Embold analysis will not be done. The commit-msg will be updated.
- Below is the command for skip:
git commit -m "Committing changes embold --skip"