Service-template-node/Updating

Updates to the service template are being regularly released. They usually contain important structural and/or security improvements, so it is important to keep your derived service up to date.

The very first step is adding the template repository's ref to your service repo's:

$ git remote add template https://github.com/wikimedia/service-template-node.git

Update the refs and check-out the template locally into a branch:

$ git fetch --all
$ git checkout -b tpl/vXXX template/master

Now switch to a topic branch and squash-merge the changes from the template:

$ git checkout -b tpl/update origin/master
$ git merge --squash tpl/vXXX  # possibly also needs --allow-unrelated-histories

There will likely be conflicts for you to resolve, so do it and add the resolved files to the commit index. Note that you need to be careful with package.json: you will surely have conflicts there, so pay attention to the dependencies versions listed in the template's index and use them in yours. Be aware that the template itself also contains files that you do not really need, such as documentation files or the specification template (spec.template.yaml). Inspect the list of such files and remove all of the unneeded ones:

$ git status
# look for files marked with "new file" by git
$ git rm -f <list-of-files-your-service-does-not-need>

Once you have made order in the repo (conflicts resolved, extra files removed from the index), commit your changes:

$ git commit -m "Update to service-template-node vX.X.X"

Now, all you have to do is to submit your changes (for review or create a PR) and you are done. Easy-peasy!