Skip to content

Commit 9da2c3f

Browse files
committed
update gitea docs and add diagram
1 parent 755facc commit 9da2c3f

File tree

1 file changed

+56
-4
lines changed

1 file changed

+56
-4
lines changed

docs/safe-haven-services/code-management-mirroring-service.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,32 +32,84 @@ Access must be requested from your Research Coordinator (RC). On being granted a
3232
- Gitea URL
3333
- Username
3434
- Initial Password
35+
- Whether egress mirroring is enabled
3536

3637
Gitea can be accessed from your VM desktop by opening a Web Browser and navigating to the provided URL. After logging in for the first time, you will be prompted to change your password.
3738

3839
Once logged-in, you will be presented with a dashboard showing recent activity in your organization. In Gitea, an "organization" is analagous to a project group, and you will be automatically granted access to the organization matching your TRE project identifier.
3940

4041
## Request a Repository
4142

42-
To request the creation of a repository in your organization, contact your RC and let them know the desired name. Multiple repositories may be created under each organization.
43+
To request the creation of a repository in your organization, contact your RC and let them know the desired name and external mirror repository, if applicable. The external repository must be empty, as any existing content will be overwritten by the mirroring process.
4344

4445
Once created, your repository will be visible from your Gitea dashboard or under the "Explore" tab.
4546

4647
!!! note "Repository Permissions"
4748
All members of an organization (TRE project) have full read/write access to each of its repositories, regardless of who requested its creation. This is the intended behaviour and will not be changed e.g., to restrict repository access to a subset of a TRE project's members. This is equivalent to the files in each `/safe_data/<project_id>` directory being accessible to all project members.
4849

50+
Multiple repositories may be created under each organization.
51+
4952
## Clone a Repository
5053

5154
SSH access is not enabled, so HTTPS must be used to clone repositories.
5255

53-
When running `git clone`, `git fetch`, and `git push`, you will be prompted for your Gitea username and password each time. For convenience, you may wish to generate an access token to avoid re-entering your credentials on each operation. To do this:
56+
When running `git clone`, `git pull`, and `git push`, you will be prompted for your Gitea username and password each time. For convenience, you may wish to generate an access token to avoid re-entering your credentials after the initial clone. To do this:
5457

55-
1. Click your profile picture in the top right and then on Settings
56-
1. Click Applications in the sidebar
58+
1. In Gitea, click your profile picture in the top right and then on "Settings"
59+
1. Click "Applications" in the sidebar
5760
1. Create a new token
5861
1. Enter a descriptive name
5962
1. Expand "Select permissions" and change "repository" to "Read and Write"
63+
1. Copy the generated token
6064
1. Clone the repo using the token, for example `git clone https://<token>@<url>/<organization>/<repo>.git`
65+
1. Note that in the test environment you will have to use "http" instead of "https"
66+
67+
## Request Code Egress
68+
69+
Egress mirroring is achieved through merging of code into a branch named `egress-mirror`. This is pre-created and will contain the same initial commit as the `main` branch.
70+
71+
If enabled, you may submit Pull Requests (PRs) for code to be mirrored to a repository external to the TRE:
72+
73+
1. From the repository page in Gitea, click "Pull Request"
74+
1. Click "New Pull Request"
75+
1. Click "merge into" and select the "egress-mirror" branch. This should cause the page to refresh and show the changes that will be requested
76+
1. Click "New Pull Request"
77+
1. Create the PR
78+
1. Provide a descriptive title
79+
1. Describe the changes that are being made, and any notes for reviewers
80+
1. Click the cog next to "Reviewers" in the right sidebar and select the RCs group for your project (`<project-id>/RCs`)
81+
1. Click "Create Pull Request"
82+
1. External email notifications are not enabled, so contact your RC via normal channels to make them aware of the PR
83+
84+
By default, PRs require approval from 2 RCs. Once approved and merged, the code changes will be automatically mirrored to the external repository.
85+
86+
!!! note "Squashed Commits"
87+
By default, all commits in a PR are "squashed" into a single commit on the mirror branch. This is to help ensure that any intermediate history containing potentially unwanted changes are not accidentally mirrored to the external repository.
88+
89+
### Branching Workflow
90+
91+
It is permitted for other branches and PRs to be created, to support standard software development practices. We suggest the following branching workflow, which uses feature branches and a periodic merge of main into the mirror branch.
92+
93+
```mermaid
94+
---
95+
config:
96+
gitGraph:
97+
mainBranchOrder: 1
98+
---
99+
gitGraph title Git Branch Workflow for Egress Mirroring
100+
checkout main
101+
commit id: "Initial commit"
102+
branch egress-mirror order: 2
103+
commit id: "-"
104+
checkout main
105+
commit id: "1"
106+
branch my-branch order: 0
107+
commit id: "2"
108+
checkout main
109+
merge my-branch
110+
checkout egress-mirror
111+
merge main tag: "3"
112+
```
61113

62114
## Further Reading and Help
63115

0 commit comments

Comments
 (0)