Skip to content

Commit 8fb10ce

Browse files
authored
Merge pull request #683 from octue/add-updating-service-docs
Add documentation on updating Octue services
2 parents 25b6c08 + 5ecacb9 commit 8fb10ce

11 files changed

+464
-146
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: check-added-large-files
1414

1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: v0.6.2
16+
rev: v0.6.9
1717
hooks:
1818
- id: ruff
1919
args: [--fix, --exit-non-zero-on-fix]
43.1 KB
Loading
Loading
465 KB
Loading
Loading

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ We use `GitHub Issues <https://github.com/octue/octue-sdk-python/issues>`_ [#]_
8585
services
8686
asking_questions
8787
creating_services
88+
updating_services
8889
running_services_locally
8990
deploying_services
9091
testing_services

docs/source/inter_service_compatibility.rst

+97-93
Large diffs are not rendered by default.

docs/source/updating_services.rst

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
.. _updating_services:
2+
3+
Updating an Octue service
4+
=========================
5+
6+
This page describes how to update an existing, deployed Octue service - in other words, how to deploy a new Octue
7+
service revision.
8+
9+
We assume that:
10+
11+
- Your service's repository is on GitHub and you have push access to it
12+
- Octue's `standard deployment GitHub Actions workflow <https://github.com/octue/workflows/blob/main/.github/workflows/deploy-cloud-run-service.yml>`_
13+
is set up in the repository and being used to deploy the service to Google Cloud Run on merge of a pull request into
14+
the ``main`` branch (see an example `here <https://github.com/octue/example-service-cloud-run/blob/main/.github/workflows/cd.yaml>`_)
15+
- A release workflow is set up that will tag and release the new service revision on GitHub (see an example
16+
`here <https://github.com/octue/example-service-cloud-run/blob/main/.github/workflows/release.yml>`_)
17+
18+
Instructions
19+
-------------
20+
21+
1. Check out and pull the ``main`` branch to make sure you're up to date with the latest changes
22+
23+
.. code-block:: shell
24+
25+
git checkout main
26+
git pull
27+
28+
2. Install your service locally so you can run the tests and your development environment can lint the code etc.:
29+
30+
.. code-block:: shell
31+
32+
poetry install
33+
34+
3. Set up `pre-commit <https://pre-commit.com/>`_ to enforce code quality:
35+
36+
.. code-block:: shell
37+
38+
pre-commit install && pre-commit install -t commit-msg
39+
40+
4. Check out a new branch so you can work independently of any other work on the code happening at the same time
41+
42+
.. code-block:: shell
43+
44+
git checkout -b my-new-feature
45+
46+
5. Add and make changes to your app's code as needed, committing each self-contained change. Use the `Conventional
47+
Commits <https://www.conventionalcommits.org/en/v1.0.0/>`_ commit message format so the new version for your service
48+
can be automatically calculated.
49+
50+
.. code-block:: shell
51+
52+
git add a-new-file another-new-file
53+
git commit -m "Your commit message"
54+
...repeat...
55+
56+
Push your commits frequently so your work is backed up on GitHub
57+
58+
.. code-block:: shell
59+
60+
git push
61+
62+
6. Write any new tests you need to verify your code works and update any old tests as needed
63+
64+
7. Run the tests locally using ``pytest`` and fix anything that makes them fail
65+
66+
.. image:: images/updating_services/pytest.png
67+
68+
8. Update the `semantic version <https://semver.org/>`_ of your app. This communicates to anyone updating from a
69+
previous version of the service whether they can use it as before or if there might be changes they need to make to
70+
their own code or data first.
71+
72+
- ``poetry version patch`` for a bug fix or small non-code change
73+
- ``poetry version minor`` for a new feature
74+
- ``poetry version major`` for a breaking change
75+
76+
Don't forget to commit this change, too.
77+
78+
9. When you're ready to review the changes, head to GitHub and open a pull request of your branch into ``main``. This
79+
makes it easy for you and anyone else to see what's changed. Check the "Files Changed" tab to make sure everything's
80+
there and consistent (it's easy to forget to push a commit). Ask your colleagues to review the code if required.
81+
82+
.. image:: images/updating_services/diff.png
83+
84+
10. When you're ready to release the new version of your service, check that the GitHub checks have passed. These ensure
85+
code quality, that the tests pass, and that the new version number is correct.
86+
87+
.. image:: images/updating_services/checks.png
88+
89+
11. Merge the pull request into ``main``. This will run the deployment workflow (usually called ``cd`` - continuous
90+
deployment), making the new version of the service available to everyone.
91+
92+
12. Check that the deployment workflow has run successfully (this can take a few minutes). You can check the progress in
93+
the "Actions" tab of the GitHub repository
94+
95+
.. image:: images/updating_services/deployment.png

0 commit comments

Comments
 (0)