So, ppl of Frappe/ERPNext, I am seeking to optimize our teams setup for contribution back to core. Please share experience on your setup.
We are trying to have stable Production server and at the same time contributing back.
Scenario:
We are using ERPNext with a small team of devs (2-3 persons). We have a feature we want to contribute back to core. This feature is essential for our end users and we need it to our system asap but in the same time is generic for everyone in the community. We first need to test it before pushing to code.
Note: Discuss about the feature is not part of this. We as seeking only git repo setup to optimize the process. Also git fetch and git pull are consider known steps.
Current Setup
Production Server :
- frappe: Official Repo remote in develop branch
- erpnext: Official Repo remote in develop branch
- customapp: Repo remote in production branch
Request is made for FeatureA that involve to change core fields / methods.
Initial Steps:
- Team Leader forks the Official ERPnext repo, I will call it “TL-ERPNext-fork”
- Each Dev forks TL-ERPNext-fork I will call it “DEV-ERPnext-fork”
- Team Leader create a new branch to “TL-ERPNext-fork” named after the feature example “feature-A”
- Each team member add to their local the TL-ERPNext-fork remote :
git remote add TL-ERPNext-fork <git url>
- Each team member add to their local the “DEV-ERPnext-fork” remote :
git remote add "DEV-ERPnext-fork" <git url>
So at this stage a dev for ERPNext repo will have 3 remotes:
- Official ERPNext
- DEV-ERPnext-fork
- TL-ERPNext-fork
Developing Feature:
- Dev member: `git checkout branch TL-ERPNext-fork/feature-A
- Make the changes
- Push to his/her own repo:
git push DEV-ERPnext-fork feature-A
- Ask your PR from TEAM Leader between branches DEV-ERPnext-fork/feature-A versus TL-ERPNext-fork/feature-A
- this circle is continuing until the feature is done
Here we start will the problems,
Testing the Feature in real Production Server case (show case to end users). Of course there can be a Staging Server for Testing but for now we assume as equal for simplicity.
- Team Leader add to Production server the new repo:
git add remote TL-ERPNext-fork <git url>
- Team Leader switch to branch with the feature:
git checkout TL-ERPNext-fork/feature-A
- Team Leader manually updates:
bench migrate
or maybe need css/js alsobench build
At this stage
we have The Problem 1 , the bench update
.
The Production server ERPNext is with remote to TL-ERPNext-fork but in the same time core team fix a bug that we need our system. If we bench update
we get the conflict … You aren’t in develop branch (because in our setup is the default).
In order to pass this one, we need big workarourd.
- Team Leader: Must push to TL-ERPNext-fork the new fetch/pull Official ERPNext
- Team Leader: Must rebase the feature,
git chekcout feature-A
,git rebase develop
- Next, Go to Production server and manual update will: fetch/pull and
bench migrate
OK, we can survive … we can do it manually
next the PR to the core… the feature is ready
- Team Leader creates a PR to Official ERPNext versus TL-ERPNext-fork/feature-A
- Write a commit message etc and get first review
we have the The Problem 2, the Code Review
The response for review is change the name of a field from fieldA to fieldB. (Team leader and dev members are having a break down, went for a beer, smashed an employee computer because it was asked to fix the printer).
- Team Leader: Make the changes and push updated updated PR
- Team Leader: Goes to production server updates again MANUALLY the server instance to play with the new field
The days are passed …
The Team Leader remember the days were a bench update
has enough.
PR is now merged we are in The Problem 3 ,
Our Production Server has the PR as branch … and is merged to the core !!!
Where is the data? Our users have used the feature and added data!!!
If we switch to Official ERPNext repo and bench update
the data? will be merged? NO!!!
The dark side of the data.
Please share experience…