Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
48e6981
Add a private Gitea lifecycle check (#5141)
JayDoubleu Oct 24, 2026
eabf485
Create the Gitea file share through Resource Manager (#5141)
JayDoubleu Oct 24, 2026
7e953b1
Keep the Gitea workspace repositories on the file share
JayDoubleu Oct 24, 2026
960f8bb
Wrap a long CHANGELOG entry
JayDoubleu Oct 25, 2026
f1f342d
Stop writing Gitea secrets to the console log
JayDoubleu Oct 24, 2026
6345ac5
Make sure that the Gitea console log shows no secret
JayDoubleu Oct 24, 2026
361b9b8
Wrap a long CHANGELOG entry
JayDoubleu Oct 25, 2026
5c5fd11
Give the Gitea identity a role on its own secrets only
JayDoubleu Oct 25, 2026
7f310dc
Give the shared Gitea identity a role on its own secrets only
JayDoubleu Oct 25, 2026
efe6e9d
Give the Nexus identity a role on its own secrets only
JayDoubleu Oct 25, 2026
d1c5822
Use one workspace owner token in the Gitea test (#5141)
JayDoubleu Oct 28, 2026
9cd14a9
Use one version bump for each Gitea and Nexus bundle
JayDoubleu Oct 28, 2026
d6e0cf2
Hide the shared Gitea admin password and reload changed OIDC settings
JayDoubleu Oct 28, 2026
f4dd202
Stop and start the Gitea app in the test and read all its references
JayDoubleu Oct 28, 2026
eaa5571
Make the Gitea workspace service 2.0.0, because its upgrade needs steps
JayDoubleu Oct 28, 2026
3e29891
Wait for the Gitea log lines of the start after the stop
JayDoubleu Oct 28, 2026
8329404
Remove the leaked service principal password in the Gitea steps
JayDoubleu Oct 28, 2026
95a2efa
Test the Gitea stop when the OIDC settings change
JayDoubleu Oct 29, 2026
7853874
Rotate a registered workspace secret through the Key Vault
JayDoubleu Oct 30, 2026
72ea496
Link the new Gitea CHANGELOG entries to their issue
JayDoubleu Oct 30, 2026
dabfe28
Make the shared Gitea admin script executable
JayDoubleu Oct 30, 2026
c31938d
Explain the bundle test deadlines in the workflow
JayDoubleu Oct 30, 2026
30f9562
Tell operators how to replace the migration token after a password ch…
JayDoubleu Oct 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/deploy_tre_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,9 @@ jobs:
[deploy_shared_services, register_bundles, register_user_resource_bundles, e2e_tests_smoke]
timeout-minutes: 300
steps:
# The job timeout is 300 minutes. Each step below sets an absolute deadline 270 minutes
# (270 * 60 seconds) after the job start. The lifecycle helper keeps the last 120 minutes
# before the deadline for the clean-up. The 30 minutes after the deadline are for the report.
- name: Reserve SQL cleanup and reporting time
if: inputs.e2eBundle == 'tre-workspace-service-azuresql'
run: echo "SQL_VALIDATION_DEADLINE=$(( $(date +%s) + 270 * 60 ))" >> "$GITHUB_ENV"
Expand All @@ -1077,6 +1080,10 @@ jobs:
if: inputs.e2eBundle == 'tre-workspace-service-mysql'
run: echo "MYSQL_VALIDATION_DEADLINE=$(( $(date +%s) + 270 * 60 ))" >> "$GITHUB_ENV"

- name: Reserve Gitea cleanup and reporting time
if: inputs.e2eBundle == 'tre-workspace-service-gitea'
run: echo "GITEA_VALIDATION_DEADLINE=$(( $(date +%s) + 270 * 60 ))" >> "$GITHUB_ENV"
Comment thread
JayDoubleu marked this conversation as resolved.
Resolved

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
Expand Down Expand Up @@ -1105,6 +1112,7 @@ jobs:
TEST_RUN_CERTIFICATE_TESTS_ON_WEEKENDS=${{ inputs.runCertificateTestsOnWeekends }}
SQL_VALIDATION_DEADLINE=${{ env.SQL_VALIDATION_DEADLINE }}
MYSQL_VALIDATION_DEADLINE=${{ env.MYSQL_VALIDATION_DEADLINE }}
GITEA_VALIDATION_DEADLINE=${{ env.GITEA_VALIDATION_DEADLINE }}
TEST_BUNDLE_REQUEST_FILE=e2e_tests/bundle-validation-request.json make test-e2e-bundle
DEVCONTAINER_TAG: ${{ inputs.DEVCONTAINER_TAG }}
CI_CACHE_ACR_NAME: ${{ secrets.CI_CACHE_ACR_NAME}}
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
* Existing resources with legacy Porter parameter overrides must complete a resource upgrade before custom actions or uninstall. The current template version can be reused. See [upgrading resources](docs/tre-admins/upgrading-resources.md#upgrade-existing-resources-for-document-based-porter-parameters). (`resource_processor` 0.13.10) ([#4904](https://github.com/microsoft/AzureTRE/pull/4904))
* Set `enable_legacy_airlock` explicitly to `true` in your `config.yaml`. It currently defaults to `true` but will default to `false` in a future release;
Setting to `false` will delete existing airlock storage accounts and must only be done once all workspaces use the v2 airlock. ([#5048](https://github.com/microsoft/AzureTRE/pull/5048))
* `tre-workspace-service-gitea` 2.0.0 keeps the Git repositories on its file share. The upgrade restarts the web app, so the repositories on the container disk are lost.
Mirror the repositories before the upgrade, and rotate the workspace client secret after it. See the [Gitea upgrade steps](docs/tre-templates/workspace-services/gitea.md#upgrading-to-version-200). The upgrade needs a [force version update](docs/tre-admins/upgrading-resources.md#force-version-update). ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))

ENHANCEMENTS:
* Register the OpenAI bundle for branch validation, add GPT-5.1 as the default model and check regional model and quota prerequisites before its private lifecycle test. (`tre-workspace-service-openai` 1.1.0) ([#5150](https://github.com/microsoft/AzureTRE/issues/5150))
* Add a private MySQL lifecycle check. A Nexus-backed Linux VM writes a row through private DNS, the SKU changes from Burstable to General Purpose, and the VM reads the row again. ([#5148](https://github.com/microsoft/AzureTRE/issues/5148))
* Run the `stop`, `start` and `reset_password` actions in the Guacamole Linux VM check, and make sure of the VM power state and the new Key Vault secret version through Azure. ([#5145](https://github.com/microsoft/AzureTRE/issues/5145))
* Add a private Gitea lifecycle check. A workspace VM uses the Gitea API through private DNS, gets HTTP 401 without credentials and with a wrong password, and commits a file to a private repository.
The VM reads the file again after an update, a change of the OIDC client ID, a stop and a start of the app. The check also makes sure that the OIDC change stops Gitea one time and that the console log of the web app shows no secret. ([#5141](https://github.com/microsoft/AzureTRE/issues/5141))
* Select individual bundle tests and record lifecycle evidence for base workspaces, private Azure SQL, Airlock, Linux VMs and certificate reuse across reinstallation. ([#5255](https://github.com/microsoft/AzureTRE/pull/5255))
* Enable `user_management_enabled`, `auto_workspace_group_creation`, and `auto_grant_workspace_consent` by default in `config.sample.yaml` for a better out-of-the-box experience ([#5050](https://github.com/microsoft/AzureTRE/issues/5050))
* Add shared repository instructions and TRE-prefixed component skills for agent-assisted development, security review, validation and troubleshooting. ([#5111](https://github.com/microsoft/AzureTRE/issues/5111))
Expand Down Expand Up @@ -42,7 +46,16 @@ BUG FIXES:
(`tre-workspace-base` 2.12.4, `tre-workspace-unrestricted` 0.15.3, `tre-workspace-airlock-import-review` 0.18.3) ([#5135](https://github.com/microsoft/AzureTRE/issues/5135))
* Clean up backup-test workspaces after failed provisioning. ([#5135](https://github.com/microsoft/AzureTRE/issues/5135))
* Create the OpenAI private endpoint after the model deployment, so that Azure does not reject it while the deployment updates the account. (`tre-workspace-service-openai` 1.1.0) ([#5249](https://github.com/microsoft/AzureTRE/issues/5249))
* Give the Gitea workspace service identity the Key Vault role only on the three secrets that its web app reads. It had the role on the whole workspace Key Vault. (`tre-workspace-service-gitea` 2.0.0) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Disable public network access on the MySQL flexible server, so that clients can connect only through the private endpoint. Move the MySQL bundle to azurerm 4.27.0, which has this setting. An upgrade changes the setting in place. (`tre-workspace-service-mysql` 1.0.16) ([#5148](https://github.com/microsoft/AzureTRE/issues/5148))
* Create the Gitea workspace service file share through Resource Manager. Terraform used the file endpoint of the storage account, which the TRE firewall blocks until the private endpoint and its DNS record exist. So an install can fail, and after a delete removes the private endpoint, each later update or delete fails.
Also disable public network access on the Gitea MySQL server. An upgrade keeps the existing share and changes the server setting in place. (`tre-workspace-service-gitea` 2.0.0) ([#5141](https://github.com/microsoft/AzureTRE/issues/5141))
* Keep the Git repositories of the Gitea workspace service on its file share. Gitea used its image default `/data/git/repositories`, which is on the container disk. So each restart of the web app deleted all repositories. MySQL kept their records, and Gitea returned HTTP 500 for them. The upgrade restarts the app, so copy the repositories before the upgrade. (`tre-workspace-service-gitea` 2.0.0) ([#5141](https://github.com/microsoft/AzureTRE/issues/5141))
* Stop writing Gitea secrets to the console log, which the web app sends to Log Analytics. The start script of the Gitea workspace service printed the admin password and the client secret of the workspace application. Gitea also prints the full command line when a command fails, so each restart printed the admin password again.
The admin user create in both Gitea bundles also made an access token and printed it, and the shared service printed its admin password at each restart. The start scripts of both bundles now hide the secrets in the Gitea output and create the admin user only if it does not exist.
The workspace start script gives the OIDC source the current client secret at each start, and it stops Gitea one time when the OIDC settings change. The web app reads the client secret through a Key Vault reference. (`tre-workspace-service-gitea` 2.0.0, `tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Give the Gitea shared service identity the Key Vault role only on the two secrets that its web app reads. It had the role on the whole core Key Vault. (`tre-shared-service-gitea` 1.2.6) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Give the Nexus VM identity the Key Vault role only on the Nexus admin password and the Nexus TLS certificate. It had the role on the whole core Key Vault. (`tre-shared-service-sonatype-nexus` 3.11.4) ([#5283](https://github.com/microsoft/AzureTRE/issues/5283))
* Update `vite` from 7.3.6 to 7.3.7 and the UI Vitest packages from 4.1.11 to 4.1.12 to address security advisories in the development server and the test mocker. (`ui` 0.10.4) ([#5274](https://github.com/microsoft/AzureTRE/pull/5274))
* Update `aiohttp` from 3.14.3 to 3.14.4 in `api_app`, `resource_processor`, and the CLI to address security advisories. (`API` 0.28.7, `resource_processor` 0.13.15, `CLI` 0.2.13) ([#5270](https://github.com/microsoft/AzureTRE/pull/5270))
* Rename a test variable in the E2E polling tests so that CodeQL stops reporting false clear-text logging alerts. ([#5266](https://github.com/microsoft/AzureTRE/pull/5266))
Expand Down
35 changes: 35 additions & 0 deletions devops/tests/test_key_vault_scopes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Make sure that the shared service identities read only their own Key Vault secrets."""

from pathlib import Path
import re
import unittest


ROOT = Path(__file__).resolve().parents[2]
# Each of these identities reads a fixed list of secrets from the core Key Vault.
FILES = (
ROOT / "templates/shared_services/gitea/terraform/gitea-webapp.tf",
ROOT / "templates/shared_services/sonatype-nexus-vm/terraform/vm.tf",
)
ASSIGNMENT = re.compile(r'^resource "azurerm_role_assignment" "(\w+)" \{(\n.*?)^\}', re.MULTILINE | re.DOTALL)
VAULT_SCOPE = re.compile(r"\n scope\s*=\s*data\.azurerm_key_vault\.\w+\.id\n")


class KeyVaultScopeTests(unittest.TestCase):
def test_secret_roles_are_not_on_the_whole_vault(self):
for path in FILES:
roles = [
(name, body)
for name, body in ASSIGNMENT.findall(path.read_text())
if '"Key Vault Secrets User"' in body
]
with self.subTest(path=str(path.relative_to(ROOT))):
self.assertTrue(roles)
for name, body in roles:
with self.subTest(path=str(path.relative_to(ROOT)), role=name):
self.assertNotRegex(body, VAULT_SCOPE)
self.assertIn("for_each = {", body)


if __name__ == "__main__":
unittest.main()
19 changes: 19 additions & 0 deletions docs/tre-developers/end-to-end-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,25 @@ The VM reads the administrator password from the workspace Key Vault through a t
The MySQL job uses the SQL time limits above with its own `MYSQL_VALIDATION_DEADLINE`. If the case creates Nexus, it removes Nexus after the VM.
These checks do not prove previous-version upgrades or researcher access.

### Gitea selection

Select `tre-workspace-service-gitea` to run `test_gitea.py::test_private_gitea_repository_survives_update`.
The case creates its own workspace, Guacamole service, Windows VM and Gitea service.
It gives the VM identity a temporary Key Vault Secrets User role on the secret that holds the Gitea admin password.
From the VM, the case makes sure that the Gitea host resolves to a private address and that the Gitea API is available.
It also makes sure that Gitea rejects a repository create without credentials (HTTP 401) and a request with a wrong password (HTTP 401).
The VM then creates a private repository with the admin account and commits a file. An anonymous read of the repository gets HTTP 404.
An update changes the display name. Then the case gives the web app a new OIDC client ID.
The start script must stop Gitea one time for the new OIDC settings, and App Service must start it again.
Then the case stops and starts the web app. The VM reads the file again and deletes the repository.
Then the case makes sure that the web app resolves its three Key Vault references, for the admin password, the OIDC client secret and the database password.
It also counts lines in the web app console log in the TRE Log Analytics workspace. No line can show a password, a client secret or a new access token.
The count waits for the start script lines of the start after the stop, and then for two more minutes, because the lines of one start can arrive at different times.
The last start has the same OIDC settings, so the log must show only one stop for the new OIDC settings.
The query returns counts only. The CI identity needs read access to the Log Analytics workspace.
At the end, the case makes sure that the web app and MySQL have public network access disabled, and that the storage firewall denies by default.
The Gitea job uses the SQL time limits with its own `GITEA_VALIDATION_DEADLINE`.

### Run the branch workflow before merge

1. Push the reviewed changes to a branch in `microsoft/AzureTRE`.
Expand Down
2 changes: 1 addition & 1 deletion docs/tre-developers/github-pr-bot-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The table describes the selected assertions. A passing command does not prove ev
| `/test-airlock` | Import requests, access checks, the import review VM flow and export request storage routing | No export review VM or migration proof. |
| `/test-backups` | Base workspace deployment with backups enabled and disabled | No backup restore or retention proof. |

The `workspace_services`, `linux_vm`, `airlock_validation`, `sql_validation` and `mysql_validation` markers have no dedicated slash command.
The `workspace_services`, `linux_vm`, `airlock_validation`, `sql_validation`, `mysql_validation` and `gitea_validation` markers have no dedicated slash command.
Use the branch workflow or the local test runner for these selections.
The `airlock_validation` marker selects two Airlock cases. It does not select the full `airlock` suite.
See [bundle selection](end-to-end-tests.md#validate-one-bundle) for exact cases and declared coverage gaps.
Expand Down
21 changes: 21 additions & 0 deletions docs/tre-templates/shared-services/gitea.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,24 @@ Gitea needs to be able to access the following resource outside the Azure TRE VN
## Upgrading to version 1.0.0

Migrating existing Gitea services to the major version 1.0.0 is not currently supported. This is due to the breaking change in the Terraform to migrate from the deprecated mysql_server to the new mysql_flexible_server.

## Upgrading to version 1.2.6

Before version 1.2.6, the Gitea shared service wrote secrets to the console log of its web app. The web app sends this log to the Log Analytics workspace of the TRE core, so all people who can read it can read these secrets:

- An access token of the `giteaadmin` user, with the name `gitea-admin`. Gitea printed it at the first start.
- The password of the `giteaadmin` user. Gitea printed it at each later start, because the user create failed.

If a Gitea shared service ran an earlier version, do these steps after the upgrade:

1. Sign in to Gitea as `giteaadmin`. In the user settings, open Applications and delete the access token `gitea-admin`. Keep the token with the name `giteaadmin`, because `gitea_migrate_repo.sh` uses it.
2. If the people who can read Log Analytics must not get admin access to Gitea, change the password of `giteaadmin` in Gitea. Keep the new password in a safe location. The Key Vault secret `gitea-<TRE_ID>-administrator-password` keeps the old value, because the start script does not change the password of an existing admin user.
3. If you changed the password, `gitea_migrate_repo.sh` cannot make a new access token, because it signs in with the old password from the Key Vault:
- Do not set the Key Vault secret `gitea-<TRE_ID>-admin-token` to `null`.
- Do not write the new password to `gitea-<TRE_ID>-administrator-password`. The next update of the service writes the old value back.
- To replace the token, make it with the new password on the jumpbox, and store it in the Key Vault. `curl` asks for the password:

```bash
curl -X POST -H "Content-Type: application/json" -u giteaadmin -d '{"name": "giteaadmin-<date>"}' https://gitea-<TRE_ID>.azurewebsites.net/api/v1/users/giteaadmin/tokens
az keyvault secret set --name gitea-<TRE_ID>-admin-token --vault-name kv-<TRE_ID> --value <sha1 value from the response>
```
Loading