Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Pavel Matyasko - pavel.matyasko@pricefx.com - Version 21.06

Table of Contents

Table of Contents
minLevel1
maxLevel7

Estimated time to read: 30 minutes

Why do we use Git

2

Why We Use Git

  • Used as source of truth.

    • every Every finished feature / user - story / bugfix must be resident stored in Git.

    • if there’s If there is a difference between Git and partition content, Git is expected to have the correct version.

  • Provides versioning of project configuration.

  • Allows cooperation of several developers on the project.

  • used Used for deployment of a project to the partition.

What files do we store to Git

...

Base Requirements

  • Git is used on every project.

  • Whoever contributes to the configuration, must commit their changes to the project Git repo. This is valid even for resources from the customer.

  • Each environment (DEV, QA, PROD etc.) should have a dedicated branch in the Git repo.

  • Every finished feature / user story must be committed immediately after completion. Changes done in the partition only without committing to Git are not allowed (except for feature branch development described below).

  • The actual version (of the configuration) should be possible to be deployed from Git to the partition at any point in time. That means that every commit to the branch should be deployed to the partition.

What Files Are Stored in Git

Generally, all project configuration must be in Git to facilitate potential recreation of the partition from scratch.

Files

...

configuration

...

To Be Versioned

  • Configuration

    • Tables definition metadata, e.g. folders:

      • PricingParameter

      • ProductAttribute

      • ProductExtension

    • logics Logics definition and groovy Groovy code, e.g. folders:

      • CalculationLogic

      • Workflow Formula

    • configuration Configuration settings, e.g. folders:

      • AdvancedConfiguration

      • Preference

      • QuoteType

      • SavedChart

  • project Project settings

    • .gitignore - this  – This is vital, so that developers do not accidentally commit files not relevant to the Pricefx project.

    • pom.xml - The POM  – This file is not needed vital for standard work using the Fetch/Test/Deploy actions , but it is a good practice to have the file in the project anywayand adding Groovy API. This file can be generated by the Pricefx studio plugin.
      Note: The Project Object Model file (POM) is an XML file that contains information about the project and configuration details used by Maven to build the project. We use it for referencing of our unit testing (TDD4C) libraries and for Studio’s Studio debug functionality.

    • config.json - this  – This file should generally NOT be in the version system, but as it does not contain any sensitive information, it could be beneficial for the team members to share this file too. Beware: the .
      Beware: The previous version of the file config.groovy -  – should never appear in the version control , because it contains information which is specific per developer.
      Note: the config.json contains information for connection of connecting Studio to Pricefx partition - particularly partition name and server URL. The username and password is are stored in IntelliJIntelliJ’s password safe store, not in the file.

Files

...

NOT

...

To Be Versioned

  • dataData

    • data Data are managed by customers, so we cannot have them in the version control system.

    • backup Backup of the data is always in the database backup of the server.

The only exception to the rule

...

is the data used as "project/partition settings"

...

which are managed by the solution implementation team (not by customer) and are not changed regularly

...

. Such data are usually stored in

...

Company Parameters, and Studio supports deployment of such CSV data to the

...

Company Parameter table.

Interaction of Git with

...

Other Tools

Let’s recap here how Git fits into the landscape and how it interact with other tools.

...

tools.drawio.svgImage Added

Local GIT repository:

  • stored Stored on developer the developer’s computer (in .git folder under project working folder).

  • used Used regularly during day to store snapshots of the working versions of the project user stories or features.

Remote GIT repository:

  • stored Stored on DevOps/Source Collaboration platform.

  • used Used for synchronization/cooperation among developers.

...

cooperation-studio-git.pngImage Added

Pricefx Git Workflow

While implementing a solution, all developers should use the same common flow of work with Git. You can see all important aspects of the workflow in the picture.

If you’re you are familiar with GitFlow, you will find this flow quite similar. The main reason for differences is that in Pricefx case, the configuration can only be tested against some partitions.

...

pricefx-gitflow.drawio.svgImage Added

Note: Deployment to PROD is usually done during the GO LIVE preparation phase. This diagram demonstrates the situation mainly after GO LIVE and when additional sprints are planned, focusing on the master branch. During development, before the PROD environment is established, the master branch is not maintained. It should be set to the corresponding version once the PROD environment becomes available.

Branches

  • master - used  – Used to store production version of the project. This version is also deployed on Production partition.

  • qa - stores  – Stores version of the project deployed on QA server and being which is tested by the customer. This version is also deployed on QA partition.

  • dev - the  – The latest working version of development with all finished features.

  • feature/XXXX-XXXX - keeps  – Keeps project version specific for development of one User Story user story or Featurefeature. Each UserStory user story or Feature feature (usually one JIRA ticket) should be versioned in one feature branch. The JIRA ticket number is then used as the name of the feature branch (the ticked ID is represented here by XXXX-XXXX). Every feature needs to be tested during the development on the customer-dev partition.

Partitions

Every project has commonly typically 3 partitions:

  • customer - partition named  – Partition name based on the customer name. It is used for production version of the project, and customer’s end-users are using use it on daily operations.

  • customer-qa - partition  – Partition with suffix "-qa" is typically used for UAT (User Acceptance Testing) of new features by the customer.

  • customer-dev - partition  – Partition used by the implementation and integration team teams for testing of newly developed features / user stories.

...

You will notice that branches do not exactly match exactly to partitions. Specifically, the dev and feature/XXXX-XXXX branches are sharing which share the same partition for testing purposes.

This is because it is not practical (and sometimes not even possible) to have one partition for each feature branch. One reason for not having a 1-1 one to one relation could be is the size of data you might need to replicate for each partition.

The development team should establish some rules regarding the dev partition. Thought should be given to how the team will share the dev partition, while testing different feature configurations, while not overriding one another’s configuration.

Pricefx "GitFlow"

When working in Git, a common flow should be used. GitFlow was considered but since there are some specifics to the Pricefx development, we adopted GitFlow with a few changes. The main reason for these differences is that the configuration can only be tested against some partitions.

Differences to standard GitFlow:

  • hotfix branch is not really needed since we don’t do not have a matching environment. hotfixes therefore  Hotfixes therefore can be committed to the master branch.

  • We do not use multiple release branches, we only use a single qa release branch holding the latest release. This situation exists since is because there is no way to use the previous release without the partition. A release commit can be tagged with a release name.

References

Knowledge Base

External Sources

...

  • .

Additional comments:

  • For the PROD environment the master branch is used.

  • The feature branches should be merged to dev using merge requests. It is recommended to rebase the feature branches before merging (using a button in the GitLab merge request) and possibly squash them (a checkbox at GitLab web), especially if there is a lot of intermediate commits. Always add the Solution Architect and/or other engineers on the project as reviewers for the merge request (so that everyone in the technical team is aware of this development change) and require at least 1 approval before merge.
    This guideline does not apply when the developer is the only technical person on the project.

  • Cherry picking is not recommended at all, we should use merge when making the releases. If the customer asks to take single features from QA to PROD, this should be avoided.

Testing

Every feature needs to be tested during the development on the xx-dev partition. There are some limitations which can cause a clash in testing. The common cases are described here:

  • Configuration engineer works on a completely new logic. => No problem since there is no conflict with others.

  • Two configuration engineers work on the same logic. => Temporarily rename the logic by adding a suffix, e.g. author's username. This logic can then be assigned to e.g.  LPG, PL, dashboard etc., but should not be committed to Git! The name should be reverted back before committing.

  • Two configuration engineers work on the same Groovy Library logic => Good communication in the team is the golden key in this case. Before developing the Groovy logic or deploying it to the xx-dev partition, do a fetch of the Groovy library from the partition first, so that you get the potential unfinished changes from your co-workers. You can also utilize the merge functionality in Studio (in the Fetch tool window) Then apply your changes there (e.g. from Stash) and then deploy changes together. Commit only your changes to Git once you are done.

Hotfixes

When a critical PROD bug is found after the project goes live, there needs to be a hotfix. The PROD hotfixes need to be tested and accepted by the customer. Since it is not possible to test on PROD once the customer is live, the hotfix needs to be developed and tested on QA, even though it can already contain features from the next sprint. In that case, there can be a gap in testing, since the testing will be done on a different configuration than on PROD. Unfortunately there is no other way to go around this, so you need to be extremely careful and individually evaluate if there can be a potential clash. Once the test is done on QA: 

  1. It should be committed and deployed to PROD branch master.

  2. The master branch needs to be merged into qa.

  3. Then qa needs to be merged into dev.

Merging master to qa should be possible at any point in time and without conflicts. This is ensured by merging from qa to prod and not committing any commits directly to master.

Hotfixes are typically very small changes, if you want create a merge request, you can use a hotfix branch "hotfix/XXXX-XXXX".

See also https://pricefx.atlassian.net/wiki/spaces/LEARN/pages/4546330841/Automated+Deployment+Using+Pipelines.