Contribution Guidelines

Thank you for your interest in contributing to this project. Please review the following guidelines before submitting your work.

We are going to use Github Flow from August 26 on.

How We Do It

So, what is GitHub Flow?

  • To work on something new, create a descriptively named branch off of master (ie: add-foops-assessment)

  • After someone else has reviewed and signed off on the feature, you can merge it into master

  • Commit to that branch locally and regularly push your work to the same named branch on the server

  • When you need feedback or help, or you think the branch is ready for merging, open a pull request

  • Once it is merged and pushed to 'master', you can and should deploy immediately

  • Anything in the master branch is deployable


mermaid code

%%{init: {'flowchart': {'useMaxWidth': false, 'width': 1400}}}%%
flowchart LR
    subgraph github["GitHub - repository"]
        direction TB
        featBranch["feature branch"]
        masterBranch(["master"])
        relTag{{"tag vMAJOR.MINOR.PATCH"}}
        featBranch -->|"pull request"| masterBranch
        masterBranch -->|"git tag v6.5.1"| relTag
    end

    subgraph deployment["agroportal_deployment"]
        direction TB
        preCmd["./deploy.sh UI pre_prod"]
        prodCmd["./deploy.sh UI prod v6.5.1"]
        tagCheck{"v6.5.1 tag exists?"}
        abortMsg["deploy aborts"]
        prodCmd --> tagCheck
        tagCheck -->|"no"| abortMsg
    end

    subgraph servers["Servers"]
        direction TB
        preSrv[["pre-production"]]
        prodSrv[["production"]]
    end

    masterBranch ==>|"every merge"| preCmd
    featBranch -.->|"test it"| preCmd
    relTag ==> prodCmd
    preCmd ==> preSrv
    tagCheck ==>|"yes"| prodSrv

    classDef guard fill:#fdecea,stroke:#c0392b,color:#7b241c
    class abortMsg guard

Hotfixes

If we want to deploy a hotfix:

  • We create a new branch based on the deployed tag and apply the fix there

  • We cherry-pick the fix on top of the master branch

  • tag this branch

  • deploy it


mermaid code

flowchart LR
    subgraph github["GitHub — application repository"]
        direction TB
        masterBranch(["master<br/>has unreleased work, not shippable yet"])
        prodTag{{"v6.5.1<br/>currently running on production"}}
        hotfixBranch["hotfix/fix-xyz"]
        hotfixTag{{"v6.5.2"}}

        prodTag ==>|"git switch -c hotfix/fix-xyz v6.5.1<br/>commit the fix"| hotfixBranch
        hotfixBranch ==>|"git tag v6.5.2<br/>git push origin v6.5.2"| hotfixTag
        hotfixBranch -->|"cherry-pick or PR<br/>so the next release keeps the fix"| masterBranch
    end

    subgraph deployment["agroportal_deployment"]
        direction TB
        preCmd["./deploy.sh UI pre_production hotfix/fix-xyz"]
        prodCmd["./deploy.sh UI production v6.5.2"]
    end

    subgraph servers["Servers"]
        direction TB
        preSrv[["pre-production"]]
        prodSrv[["production"]]
    end

    hotfixBranch -.->|"optional: check the fix first"| preCmd
    hotfixTag ==> prodCmd
    preCmd -.-> preSrv
    prodCmd ==> prodSrv

    blocked["the hotfix branch itself never goes to production<br/>it ships as the tag v6.5.2"]
    hotfixBranch -.-> blocked

    classDef guard fill:#fdecea,stroke:#c0392b,color:#7b241c
    class blocked guard