Git merge conflicts when upgrading OpenSource server from 2.4.0 to 2.5.0

Hi there,

I am following the instructions to upgrade the Mender server, in particular the part about using the git commands to integrate the changes from mainline (i.e. 2.5.0) into our branch (with mods to prod.yml).

The doc says to use git merge to merge 2.5.0 into our branch. However, when I do that I get many merge conflicts in the following files:

Unmerged paths:                                                                                                                                                                                                                               
  (use "git add <file>..." to mark resolution)                                                                         
                                                                                                                       
        both modified:   ../docker-compose.client.rofs.yml                                                             
        both modified:   ../docker-compose.client.yml                                                                                                                                                                                         
        both modified:   ../docker-compose.docker-client.yml                                                                                                                                                                                  
        both modified:   ../docker-compose.enterprise.yml                                                                                                                                                                                     
        both modified:   ../docker-compose.yml                                                                                                                                                                                                
        both modified:   ../extra/changelog-generator/changelog-generator                                                                                                                                                                     
        both modified:   ../extra/changelog-generator/test-changelog-generator                                         
        both modified:   ../extra/gitdm/company-map                                                                                                                                                                                           
        both modified:   ../extra/gitdm/mailmap                                                                                                                                                                                               
        both modified:   ../git-versions-enterprise.yml                                                                
        both modified:   ../git-versions.yml                                                                                                                                                                                                  
        both modified:   ../other-components.yml  

Conflicts are pretty easy to fix as they are related to the various version upgrades, for instance:

# This file lists software components that are part of a Mender Enterprise release
# which are published with the global Mender product version. The versions here
# therefore point to the internal Git tags/branches. We keep this information as a
# docker-compose YAML file for parsing purposes.
services:

    #
    # backend enterprise services
    #
    mender-deployments:
<<<<<<< HEAD
        image: registry.mender.io/mendersoftware/deployments-enterprise:2.0.0

    mender-inventory:
        image: registry.mender.io/mendersoftware/inventory-enterprise:2.0.0

    mender-workflows-server:
        image: registry.mender.io/mendersoftware/workflows-enterprise:1.1.0

    mender-workflows-worker:
        image: registry.mender.io/mendersoftware/workflows-enterprise-worker:1.1.0

    mender-tenantadm:
        image: registry.mender.io/mendersoftware/tenantadm:2.0.0

    mender-useradm:
        image: registry.mender.io/mendersoftware/useradm-enterprise:1.11.0
=======
        image: registry.mender.io/mendersoftware/deployments-enterprise:2.1.0

    mender-inventory:
        image: registry.mender.io/mendersoftware/inventory-enterprise:2.1.0

    mender-workflows-server:
        image: registry.mender.io/mendersoftware/workflows-enterprise:1.2.0

    mender-workflows-worker:
        image: registry.mender.io/mendersoftware/workflows-enterprise-worker:1.2.0

    mender-tenantadm:
        image: registry.mender.io/mendersoftware/tenantadm:2.1.0

    mender-useradm:
        image: registry.mender.io/mendersoftware/useradm-enterprise:1.12.0

    mtls-ambassador:
        image: registry.mender.io/mendersoftware/mtls-ambassador:1.0.0
>>>>>>> 2.5.0

I can undertstand why the conflict exists (changes from both sides on the same line) but I was not expecting them.

Is that expected or did I make a mistake here?

Thanks for the feedback!

I don’t immediately see any concerns here. I think @kacf has looked into the merging stuff for upgrades. Maybe he has some more insight.
Drew

Unfortunately the server upgrade guide is known to have some problems. We are looking for ways to improve it, but this work is still pending. For now what you can do is this: For every conflicted file, as long as it’s not a file you have changed yourself, you can simply run git checkout 2.5.0 -- <FILE>, and run git commit at the end when all files have been handled.

Hi @kacf @drewmoseley, thanks for your quick answers.

@kacf: yes, I understand what needs to be done here, thanks for confirming the guide might not have everything available. I am fully aware of how much work writing such a guide is, esp when you want to make a complex upgrade process like that to work. A quick mention about the possibility of conflicts would help here, just like what you replied.

I’ll proceed as you mentioned. Indeed manually reviewing the files and favoring the 2.5.0 branch when there are conflicts is the right way to do it. I don’t know if a more automated way could be used via sth like git merge -s ours et al. to favor the new 2.5.0 branch for those files. AFAIK, -s ours overwrites all changes w/ one side, but that might be tweakable.

Yes, we considered the git merge -s ours strategy, but it cannot be used as-is because it would overwrite your own files too. It may be possible to put something smarter together by using merge drivers together with paths (see “Defining a custom merge driver” in the gitattributes man page), but this requires some setup scripts as well (a repository cannot install a merge driver just by being cloned).

Thanks for the additional reply @kacf, I will look into merge drivers for my own curiosity.

Does this mean you would actually recommend to redeploy from scratch a new version (transferring any Docker volumes) rather than upgrading via the current instructions? Or are you guys actualling using the Helm chart?

I am asking as I’d like to find the best method to lower server downtime as much as possible when doing an upgrade …

I know we are using Helm charts for Hosted Mender, so that is definitely worth looking at.

But if you want to stick with docker-compose, then I think upgrading via the instructions we have discussed should be good enough. It’s really just Git mechanics which are getting in the way here, the actual docker-compose setup is fine (and this is what we use in our test farm).

thanks @kacf for the information, I am using Compose indeed so will continue to do that then.

Just for reference, helm charts for Mender can be found here