- 👷🩹 — Add limitless patch and GitlabCI recipe - 📝 — Add instructions on how to use the patch from Framasoft - 💄 — Add logo, thanks to Geoffrey Dorne - 👷 — ARM64 cross-compilation in CI
3.2 KiB
How to use Framasoft’s patch to compile Mostlymatter
Setup the repository
git clone https://framagit.org/framasoft/framateam/mostlymatter.git
cd mostlymatter
git remote add upstream https://github.com/mattermost/mattermost.git
New version
Refresh you local repository.
git fetch -p --all
Set some env vars.
export NEW_VERSION=10.5.1
As you will need to cherry-pick some commits (the main fork commit and a fix-patch commit), you will need to go on an old release branch.
export OLD_VERSION=10.5.0
export BASE_VERSION=$(echo "$NEW_VERSION" | sed -e "s/\.[^.]\+$//")
git checkout "release-$OLD_VERSION"
git log --graph --abbrev-commit --date=relative \
--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr by %an)%Creset' \
--max-count=3
Note the commits you’ll need (usually, the two first commits).
Go to the main branch of the version you want and reset the code to this version, then create a new branch with the version you want to compile from the main branch of this version.
git branch | grep -q "release-$BASE_VERSION\$" &&
git checkout "release-$BASE_VERSION" ||
git checkout -b "release-$BASE_VERSION" "upstream/release-$BASE_VERSION"
git reset --hard "v$NEW_VERSION"
git checkout -b "release-$NEW_VERSION" "release-$BASE_VERSION"
Cherry-pick the commits (use the oldest first!).
for i in 4b3d29da 056a5f8c
do
git cherry-pick "$i"
done
If you compile a bugfix version (ex: 10.5.1, using the commits of the 10.5.0 version), you should be just fine
But if you compile a new version (ex: 10.6.0), there is a lot of chances that you need to fix the limitless.patch file.
To test the patch:
git apply limitless.patch &&
echo -e "\033[0;36mPatch applied successfully\033[0;36m" &&
rm -rf server/cmd/mostlymatter &&
git checkout -- server
If the patch does not apply, fix it. The fix is usually those steps:
- remove the
server/.golangci.ymlpart of the patch - manually apply this part (it’s mostly replacing
mattermostbymostlymatterin this file) git apply limitless.patchgit add servergit diff --cached > limitless.patchgit restore --staged -- servergit checkout -- serverrm -rf server/cmd/mostlymattergit add limitless.patchgit commit --amend
Now, you can retest the patch:
git apply limitless.patch &&
echo -e "\033[0;36mPatch applied successfully\033[0;36m" &&
rm -rf server/cmd/mostlymatter &&
git checkout -- server
Tag the new version (limitless is needed in the tag name for the CI to run) and push to Gitlab:
git tag "v$NEW_VERSION-limitless" -m "v$NEW_VERSION-limitless"
git push -u origin "release-$NEW_VERSION"
The CI will compile mostlymatter. Note that it will not be available as an artifact.
You can use the step of .gitlab-ci.yml to compile Mostlymatter without using the CI.
Publish
The secrets are set in GitLab CI variables :
MINISIG_KEYMINISIG_PWDDEPLOYEMENT_KEY(ssh private key encoded with base64)DEPLOYEMENT_USERDEPLOYEMENT_HOST
The CI will publish the compiled mostlymatter binary through sftp.