Source Repository
GIT best practices
- A develop branch should be created from the master branch (this step should be done only if the branch doesn’t exist, it’s an initial project step)
- A branch/feature should be created for each use case (new use case or expansion/update of an existing one) from the develop branch, the name of the feature must include the JIRA story id
- One or more developers work on the defined branches
- The developers make a pull request to the develop branch
- A lead architect/developer reviews the code and merges the feature branch to the develop branch from the develop branch
- After a set of developed and tested features you will have a stable develop version
- A lead architect/developer should create a release branch, change the pom.xml version and merge the branch with the master branch, tag it and merge it with the develop branch
Gitignore recommendations
Add the following lines to the default .gitignore file generated by Anypoint Studio (from File → New → Mule Project → Version Control System Support):
.gitignore
#Manually added
catalog/
.mule
.DS_Store
src/main/api/.repository/
velocity.log
|
References:
|
Description
|
---|---|
catalog/ |
Anypoint Studio mapping metadata. |
.mule/ |
Mule temp folder for storing object store, batch and queue data. |
.DS_Store | MacOS temp files. |
src/main/api/.repository/ |
Generated by APISync. |
velocity.log |
Log file generated Studio/Eclipse when an error occurs. |
GIT Cheat Sheet
//Initial steps
from master: git checkout -b develop
from develop: git checkout -b feature/JIRA_ID
//Adding local changes, prior to commit. (Ignored files will not be added)
from feature/xx: git add *
//Adding deleted resources to changeset, prior to commit.
from feature/xx: git add -u .
//Commiting changes
from feature/xx: git commit -m ‘Message’
from feature/xx: git push
from any branch: git status
//Merging branches to develop
from develop: git merge –no-ff feature/JIRA_ID
from develop: git push
//Closing/deleting branches
from develop: git branch -d feature/JIRA_ID
from develop: git push origin :feature/JIRA_ID
//Defining a release from a stable develop branch
from develop: git checkout -b release/1.0.0-rc.1
from release/xx: git commit -m ‘Message’
from release/xx: git push
//Merging the release with develop and master
from develop: git merge –no-ff release/1.0.0-rc.1
from develop: git push
from master: git merge –no-ff develop
from master: git push
//Tagging the version
from master: git tag 1.0.0-rc.1
from master: git push origin tag 1.0.0-rc.1
|
GIT useful references
Name |
Link |
Git Flow CheatSheet | http://danielkummer.github.io/git-flow-cheatsheet/ |
Git Flow | http://jeffkreeftmeijer.com/2010/why-arent-you-using-git-flow/ |
Git Flow explained | https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow |
Understanding the GitHub Flow | https://guides.github.com/introduction/flow/?utm_source=onboarding-series&utm_medium=email&utm_content=read-the-guide-cta&utm_campaign=learn-github-flow-email |
Git Branching Model | http://nvie.com/posts/a-successful-git-branching-model/ |
Versioning Levels and Conventions
- Mule Project Version: Is the version defined in the pom.xml of the mule-project, this version is useful only for the developers and the internal team. This version is visible in the Runtime Manager (Anypoint Platform) since the file-name of the deployed project contains the project-name and the version. This version should follow the “Semantic Versioning” (http://semver.org/) standard (e.g. 1.0.1-rc.1)
- Application Version/Stage in the domain: Is the domain name + environment defined in CloudHub (e.g. students-sys-dev.cloudhub.io), as a best practice include the environment in the domain {domain}-env.cloudhub.io. Include the version of the application in the domain, if the coexistence of multiple applications is required (e.g. students-sys-v2-dev.cloudhub.io). The access to the application is managed by the DLB mapping rules, so it can mask the real name/domain of the applications (e.g. https://sandbox.api.nyu.edu/students -> pointing to students-sys-v2-dev)