| 1 |
{% extends "base.html" %} |
| 2 |
{% import "webhooks_panel.html" as w %} |
| 3 |
{% import "assistants_panel.html" as ai %} |
| 4 |
{% import "variables_panel.html" as va %} |
| 5 |
{% import "secrets_panel.html" as se %} |
| 6 |
{% import "repo_tabs.html" as m %} |
| 7 |
{% block title %}Settings · {{ repo.owner }}/{{ repo.name }}{% endblock %} |
| 8 |
{% block bodyattrs %} data-repo="{{ repo.url }}"{% endblock %} |
| 9 |
{% block tabs %}{% call m::tabs(repo, "settings") %}{% endblock %} |
| 10 |
{% block content %} |
| 11 |
<div class="head"><h1>Settings <small>{{ repo.owner }}/{{ repo.name }}</small></h1></div> |
| 12 |
{% if let Some(n) = notice %}<p class="note">{{ n }}</p>{% endif %} |
| 13 |
{% if let Some(e) = error %}<p class="error">{{ e }}</p>{% endif %} |
| 14 |
<div class="sectioned"> |
| 15 |
<nav class="section-nav" aria-label="Sections"> |
| 16 |
<a href="#general">General</a> |
| 17 |
<a href="#landing">Landing requirements</a> |
| 18 |
<a href="#git-mirror">Git mirror</a> |
| 19 |
<a href="#checks">Required checks</a> |
| 20 |
<a href="#flow">OxygenFlow</a> |
| 21 |
<a href="#coverage">Coverage</a> |
| 22 |
{% if role == crate::auth::Role::Admin %}<a href="#webhooks">Webhooks</a> |
| 23 |
<a href="#variables">Variables</a> |
| 24 |
<a href="#secrets">Secrets</a> |
| 25 |
<a href="#assistants">AI assistants</a> |
| 26 |
{% if storage.is_some() %}<a href="#storage">Storage</a>{% endif %} |
| 27 |
<a href="#collaborators">Collaborators</a> |
| 28 |
<a href="#advanced">Advanced</a>{% endif %} |
| 29 |
</nav> |
| 30 |
<div class="sections"> |
| 31 |
<form class="card wide" id="general" method="post" action="{{ repo.url }}/settings"> |
| 32 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 33 |
<h2>General</h2> |
| 34 |
<label for="description">Description</label><input type="text" id="description" name="description" value="{{ row.description }}"> |
| 35 |
<label for="topics">Topics</label><input type="text" id="topics" name="topics" value="{{ row.topics }}" placeholder="rust version-control retro"> |
| 36 |
<p class="small mute">Separated by spaces or commas; letters, digits and dashes. People find repositories by them under Explore.</p> |
| 37 |
<label for="default_bookmark">Default bookmark</label><input type="text" id="default_bookmark" name="default_bookmark" value="{{ row.default_bookmark }}"> |
| 38 |
<label>Visibility{% if role != crate::auth::Role::Admin %} <span class="mute">(admins only)</span>{% endif %}</label> |
| 39 |
<div class="choice"> |
| 40 |
<label><input type="radio" name="visibility" value="public"{% if row.visibility == "public" %} checked{% endif %}> public</label> |
| 41 |
<label><input type="radio" name="visibility" value="internal"{% if row.visibility == "internal" %} checked{% endif %}> internal</label> |
| 42 |
<label><input type="radio" name="visibility" value="private"{% if row.visibility == "private" %} checked{% endif %}> private</label> |
| 43 |
</div> |
| 44 |
<button type="submit">SAVE</button> |
| 45 |
</form> |
| 46 |
<form class="card wide" id="landing" method="post" action="{{ repo.url }}/settings/requirements"> |
| 47 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 48 |
<h2>Landing requirements</h2> |
| 49 |
<label for="required_approvals">Sealed approvals required</label><input type="number" id="required_approvals" name="required_approvals" min="0" value="{{ requirements.required_approvals }}"> |
| 50 |
<div class="choice"> |
| 51 |
<label><input type="checkbox" name="require_owners" value="1"{% if requirements.require_owners %} checked{% endif %}> code owners from <code>.oxyowners</code> must approve</label> |
| 52 |
<label><input type="checkbox" name="allow_conflicts" value="1"{% if requirements.allow_conflicts %} checked{% endif %}> allow landing with conflicts</label> |
| 53 |
</div> |
| 54 |
<button type="submit">SAVE</button> |
| 55 |
</form> |
| 56 |
<form class="card wide" id="git-mirror" method="post" action="{{ repo.url }}/settings/mirror"> |
| 57 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 58 |
<h2>Git mirror</h2> |
| 59 |
<div class="choice"><label><input type="checkbox" name="enabled" value="1"{% if row.git_mirror %} checked{% endif %}> keep a read-only Git mirror of <strong>{{ row.default_bookmark }}</strong></label></div> |
| 60 |
<p class="small mute">For tools that only speak Git (CI runners, IDEs): <code>git clone {{ shell.base_url }}{{ repo.url }}.git</code>. Private repositories take a personal access token as the password. Pushing to the mirror is refused.{% if row.git_mirror && !row.git_mirror_state.is_empty() %} Last exported state <code>{{ row.git_mirror_state|short }}</code>.{% endif %}</p> |
| 61 |
<button type="submit">SAVE</button> |
| 62 |
</form> |
| 63 |
<form class="card wide" id="checks" method="post" action="{{ repo.url }}/settings/checks"> |
| 64 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 65 |
<h2>Required checks</h2> |
| 66 |
<label for="required_checks">Check names that must pass on a proposal's projected state (comma-separated)</label><input type="text" id="required_checks" name="required_checks" value="{{ required_checks }}" placeholder="build, test"> |
| 67 |
<p class="small mute">Any token with <code>checks:write</code> reports checks with <code>POST {{ shell.base_url }}/api/v1/repos/{{ repo.owner }}/{{ repo.name }}/checks</code>.</p> |
| 68 |
<button type="submit">SAVE</button> |
| 69 |
</form> |
| 70 |
<form class="card wide" id="flow" method="post" action="{{ repo.url }}/settings/flow"> |
| 71 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 72 |
<h2>OxygenFlow</h2> |
| 73 |
<p>Pushes to this repository {% if flow_enabled %}<strong>start runs</strong>{% else %}<strong>do not start runs</strong>{% endif %} of its <code>.flow/pipeline.kdl</code>.</p> |
| 74 |
{% if site_admin %} |
| 75 |
<div class="choice"> |
| 76 |
<label><input type="radio" name="flow" value="on"{% if row.flow == "on" %} checked{% endif %}> on</label> |
| 77 |
<label><input type="radio" name="flow" value="off"{% if row.flow == "off" %} checked{% endif %}> off</label> |
| 78 |
<label><input type="radio" name="flow" value="default"{% if row.flow.is_empty() %} checked{% endif %}> site default ({% if flow_default %}on{% else %}off{% endif %}, from <code>[flow] repos</code> in <code>hub.toml</code>)</label> |
| 79 |
</div> |
| 80 |
<p class="small mute">Runs use the site's runners, so only site administrators change this. It takes effect at the next push.</p> |
| 81 |
<button type="submit">SAVE</button> |
| 82 |
{% else %} |
| 83 |
<p class="small mute">A site administrator turns OxygenFlow on or off here.</p> |
| 84 |
{% endif %} |
| 85 |
</form> |
| 86 |
<form class="card wide" id="diffusion" method="post" action="{{ repo.url }}/settings/diffusion"> |
| 87 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 88 |
<h2>Diffusion</h2> |
| 89 |
<p>When a repository this one pins as a subrepo moves on, Diffusion opens a proposal here that moves the pin, tested by this repository's own pipeline, with the upstream's changes listed. By default it never lands anything by itself.</p> |
| 90 |
<div class="choice"> |
| 91 |
<label><input type="radio" name="diffusion" value="green"{% if row.diffusion == "green" %} checked{% endif %}> when the upstream's checks pass</label> |
| 92 |
<label><input type="radio" name="diffusion" value="any"{% if row.diffusion == "any" %} checked{% endif %}> on every upstream move</label> |
| 93 |
<label><input type="radio" name="diffusion" value="off"{% if row.diffusion == "off" %} checked{% endif %}> off</label> |
| 94 |
<label><input type="radio" name="diffusion" value="default"{% if row.diffusion.is_empty() %} checked{% endif %}> site default ({{ diffusion_site }}, from <code>[diffusion] follow</code> in <code>hub.toml</code>)</label> |
| 95 |
</div> |
| 96 |
<h3>Landing</h3> |
| 97 |
<div class="choice"> |
| 98 |
<label><input type="radio" name="land" value="propose"{% if row.diffusion_land != "auto" %} checked{% endif %}> propose only: a person lands each bump</label> |
| 99 |
<label><input type="radio" name="land" value="auto"{% if row.diffusion_land == "auto" %} checked{% endif %}> land by itself when both halves are green: the upstream state it pins passed its own checks and this repository's run on the bump passed</label> |
| 100 |
</div> |
| 101 |
<p class="small mute">An untested (amber) upstream always waits for a person. A landing by Diffusion still needs this repository's required checks and approvals, and a trust policy that lets the hub's key move the bookmark; otherwise the bump waits, and its timeline says why.</p> |
| 102 |
<p class="small mute">A subrepo's <code>.oxymodules</code> entry overrides this with <code>follow = green</code>, <code>any</code> or <code>off</code>; <code>land = auto</code> or <code>propose</code> overrides the landing, <code>target</code> names the bookmark to move (else the one this repository's proposals land on) and <code>watch</code> lists paths whose upstream changes are flagged.</p> |
| 103 |
<button type="submit">SAVE</button> |
| 104 |
</form> |
| 105 |
{% if role == crate::auth::Role::Admin %} |
| 106 |
<form class="card wide" id="coverage" method="post" action="{{ repo.url }}/settings/coverage"> |
| 107 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 108 |
<h2>Coverage</h2> |
| 109 |
<p class="small mute">A job's <code>coverage</code> artifact (LCOV) gives each run a <code>coverage</code> check, measured against <strong>{{ row.default_bookmark }}</strong>. Without rules it only reports; with them it fails when they are broken, and a required check named <code>coverage</code> then holds a proposal back.</p> |
| 110 |
<div class="row"> |
| 111 |
<div><label for="cov_min">Fail below this percentage</label><input type="number" id="cov_min" name="min" min="0" max="100" step="0.1" value="{% if let Some(m) = coverage.min %}{{ m }}{% endif %}" placeholder="e.g. 80"></div> |
| 112 |
<div><label for="cov_drop">Fail when it falls by more than (points)</label><input type="number" id="cov_drop" name="max_drop" min="0" max="100" step="0.1" value="{% if let Some(m) = coverage.max_drop %}{{ m }}{% endif %}" placeholder="e.g. 0.5"></div> |
| 113 |
</div> |
| 114 |
<button type="submit">SAVE</button> |
| 115 |
</form> |
| 116 |
<section class="panel" id="runners"> |
| 117 |
<h2>Runners</h2> |
| 118 |
<p class="small">The OxygenFlow runners that may take this repository's jobs: the site's, {{ row.owner }}'s, and this repository's own.</p> |
| 119 |
{% if let Some(t) = runner_token %}<p class="note">Register a runner for this repository with:</p><pre class="snippet">flow runner register {{ shell.base_url }} --token {{ t }} --name NAME</pre>{% endif %} |
| 120 |
{% if runners.is_empty() %}<p class="mute small">None yet: runs wait until a runner that serves this repository is added.</p>{% else %} |
| 121 |
<div class="table"><table> |
| 122 |
<tr><th>Runner</th><th>Status</th><th>Serves</th><th>Machine</th><th></th></tr> |
| 123 |
{% for (r, serves, own) in runners %}<tr><td><strong>{{ r.name }}</strong></td><td><span class="runner-status st-{{ r.status() }}">{{ r.status() }}</span></td><td class="small">{{ serves }}</td><td class="small">{% if r.arch.is_empty() %}<span class="mute">unknown</span>{% else %}{{ r.arch }} · {{ r.os }}{% endif %}</td> |
| 124 |
<td>{% if *own %}<form class="tiny" method="post" action="{{ repo.url }}/settings/runners/{{ r.id }}/remove" onsubmit="return confirm('Remove {{ r.name }}? Its credential stops working.')"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button class="danger-btn">remove</button></form>{% endif %}</td></tr>{% endfor %} |
| 125 |
</table></div>{% endif %} |
| 126 |
<form method="post" action="{{ repo.url }}/settings/runners/token"><input type="hidden" name="_csrf" value="{{ shell.csrf }}"><button type="submit">Add a runner for this repository</button></form> |
| 127 |
</section> |
| 128 |
{% call w::panel(repo.url ~ "/settings", hooks, shell.csrf, "Each delivery is signed with the secret (X-Oxyhub-Signature) and retried with backoff for a day.") %} |
| 129 |
{% call va::panel(repo.url ~ "/settings", variables, shell.csrf, "This repository's jobs get these, beside the ones the site and its owner set.") %} |
| 130 |
{% call se::panel(repo.url ~ "/settings", secrets, shell.csrf, "This repository's jobs may use these, beside the ones the site and its owner set.") %} |
| 131 |
{% call ai::panel(repo.url ~ "/settings", assistants, shell.csrf, "This repository may ask these, beside the ones the site and its owner provide.") %} |
| 132 |
{% if role == crate::auth::Role::Admin %}{% if let Some(st) = storage %}<section class="panel" id="storage"> |
| 133 |
<h2>Storage</h2> |
| 134 |
<p>This repository's data lives in <code>{{ st.url }}</code>, your bucket. This server keeps a cache and the credentials, sealed.</p> |
| 135 |
<dl class="facts"> |
| 136 |
<dt>Since</dt><dd><time title="{{ st.created_ms|when_i }}">{{ st.created_ms|ago_i }}</time></dd> |
| 137 |
<dt>Last check</dt><dd>{% if let Some(t) = st.checked_ms %}<time title="{{ t|when_i }}">{{ t|ago_i }}</time>: {{ st.check_result }}{% else %}<span class="mute">never</span>{% endif %}</dd> |
| 138 |
</dl> |
| 139 |
<form class="inline" method="post" action="{{ repo.url }}/settings/storage"> |
| 140 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 141 |
<input type="hidden" name="action" value="check"> |
| 142 |
<button type="submit" title="Write, read, list and delete under a probe prefix of the bucket, and compare-and-swap a record">CHECK THE BUCKET</button> |
| 143 |
</form> |
| 144 |
<details> |
| 145 |
<summary>Replace the credentials</summary> |
| 146 |
<form class="card" method="post" action="{{ repo.url }}/settings/storage"> |
| 147 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 148 |
<input type="hidden" name="action" value="credentials"> |
| 149 |
<p class="small mute">The new credentials must pass the check before they replace the old ones. Fill the fields for your provider.</p> |
| 150 |
{% if st.url.starts_with("s3://") %}<div class="row"> |
| 151 |
<div><label for="sak">Access key ID</label><input type="text" id="sak" name="access_key_id" autocomplete="off" required></div> |
| 152 |
<div><label for="ssk">Secret access key</label><input type="password" id="ssk" name="secret_access_key" autocomplete="new-password" required></div> |
| 153 |
</div>{% else if st.url.starts_with("gs://") %}<label for="ssa">Service account key</label><textarea id="ssa" name="service_account_key" rows="3" required spellcheck="false"></textarea>{% else %}<div class="row"> |
| 154 |
<div><label for="stn">Tenant ID</label><input type="text" id="stn" name="tenant_id" autocomplete="off" required></div> |
| 155 |
<div><label for="sci">Client ID</label><input type="text" id="sci" name="client_id" autocomplete="off" required></div> |
| 156 |
<div><label for="scs">Client secret</label><input type="password" id="scs" name="client_secret" autocomplete="new-password" required></div> |
| 157 |
</div>{% endif %} |
| 158 |
<button type="submit">SAVE</button> |
| 159 |
</form> |
| 160 |
</details> |
| 161 |
</section>{% endif %}{% endif %} |
| 162 |
<section class="panel" id="collaborators"> |
| 163 |
<h2>Collaborators</h2> |
| 164 |
{% if collaborators.is_empty() %}<p class="mute small">Nobody beyond the owner{% if !teams.is_empty() %} and the organisation's members{% endif %}.</p>{% else %} |
| 165 |
<table class="small"> |
| 166 |
{% for c in collaborators %} |
| 167 |
<tr><td>{% if let Some(a) = c.account %}<a href="/{{ a.username }}">{{ a.username }}</a>{% else if let Some(t) = c.team %}team {{ t.name }}{% endif %}</td><td>{{ c.role }}</td> |
| 168 |
<td><form class="tiny" method="post" action="{{ repo.url }}/settings/collaborators"><input type="hidden" name="_csrf" value="{{ shell.csrf }}">{% if let Some(a) = c.account %}<input type="hidden" name="username" value="{{ a.username }}">{% else if let Some(t) = c.team %}<input type="hidden" name="team" value="{{ t.name }}">{% endif %}<button name="remove" value="1">remove</button></form></td></tr> |
| 169 |
{% endfor %} |
| 170 |
</table>{% endif %} |
| 171 |
<form class="card" method="post" action="{{ repo.url }}/settings/collaborators"> |
| 172 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 173 |
<div class="row"> |
| 174 |
<div><label for="username">Account</label><input type="text" id="username" name="username"></div> |
| 175 |
{% if !teams.is_empty() %}<div><label for="team">or team</label><select id="team" name="team"><option value="">—</option>{% for t in teams %}<option value="{{ t.name }}">{{ t.name }}</option>{% endfor %}</select></div>{% endif %} |
| 176 |
<div><label for="role">Role</label><select id="role" name="role"><option value="read">read</option><option value="triage">triage</option><option value="write" selected>write</option><option value="maintain">maintain</option><option value="admin">admin</option></select></div> |
| 177 |
</div> |
| 178 |
<button type="submit">ADD</button> |
| 179 |
</form> |
| 180 |
</section> |
| 181 |
<section class="panel danger-zone" id="advanced"> |
| 182 |
<h2>Advanced</h2> |
| 183 |
<p class="small mute">Settings that change what this repository is. Each asks you to confirm; none can be undone from here except archiving.</p> |
| 184 |
<div class="danger-row"> |
| 185 |
<div><strong>Transfer ownership</strong><p class="small mute">Move this repository to a user or an organisation you may create repositories under. Its address changes to <code>/OWNER/{{ repo.name }}</code>; the old address redirects, and <code>oxy</code> remotes keep working.</p></div> |
| 186 |
<details class="danger-act"><summary class="danger-btn">Transfer</summary> |
| 187 |
<form class="card" method="post" action="{{ repo.url }}/settings/transfer"> |
| 188 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 189 |
<label for="towner">New owner</label><input type="text" id="towner" name="owner" placeholder="an organisation or a user" required> |
| 190 |
<label for="tconfirm">Type <code>{{ repo.owner }}/{{ repo.name }}</code> to confirm</label><input type="text" id="tconfirm" name="confirm" required autocomplete="off"> |
| 191 |
<button type="submit">TRANSFER</button> |
| 192 |
</form> |
| 193 |
</details> |
| 194 |
</div> |
| 195 |
<div class="danger-row"> |
| 196 |
<div><strong>{% if row.archived %}Bring this repository back{% else %}Archive this repository{% endif %}</strong><p class="small mute">{% if row.archived %}It is archived: read-only for everyone, shown with a badge.{% if !row.archived_reason.is_empty() %} Reason: {{ row.archived_reason }}{% endif %}{% else %}Read-only for everyone, including you: no pushes, edits, issues, proposals or comments, until an admin brings it back. Say why, for whoever finds it later.{% endif %}</p></div> |
| 197 |
<details class="danger-act"><summary class="danger-btn">{% if row.archived %}Unarchive{% else %}Archive{% endif %}</summary> |
| 198 |
<form class="card" method="post" action="{{ repo.url }}/settings/archive"> |
| 199 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 200 |
{% if row.archived %}<input type="hidden" name="action" value="unarchive"><button type="submit">BRING IT BACK</button>{% else %}<input type="hidden" name="action" value="archive"> |
| 201 |
<label for="areason">Reason (optional)</label><textarea id="areason" name="reason" rows="2" maxlength="500" placeholder="Superseded by …"></textarea> |
| 202 |
<button type="submit">ARCHIVE</button>{% endif %} |
| 203 |
</form> |
| 204 |
</details> |
| 205 |
</div> |
| 206 |
<div class="danger-row"> |
| 207 |
<div><strong>Delete wiki data</strong><p class="small mute">{% if repo.wiki %}The wiki's repository moves to the trash with its history; a new first page starts a fresh one.{% else %}This repository has no wiki.{% endif %}</p></div> |
| 208 |
{% if repo.wiki %}<details class="danger-act"><summary class="danger-btn">Delete wiki data</summary> |
| 209 |
<form class="card" method="post" action="{{ repo.url }}/settings/wiki/delete"> |
| 210 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 211 |
<label for="wconfirm">Type <code>{{ repo.owner }}/{{ repo.name }}</code> to confirm</label><input type="text" id="wconfirm" name="confirm" required autocomplete="off"> |
| 212 |
<button type="submit">DELETE WIKI DATA</button> |
| 213 |
</form> |
| 214 |
</details>{% else %}<button class="danger-btn" type="button" disabled>Delete wiki data</button>{% endif %} |
| 215 |
</div> |
| 216 |
<div class="danger-row"> |
| 217 |
<div><strong>Delete this repository</strong><p class="small mute">The repository moves to the trash and is removed after the retention period.</p></div> |
| 218 |
<details class="danger-act"><summary class="danger-btn">Delete</summary> |
| 219 |
<form class="card" method="post" action="{{ repo.url }}/settings/delete"> |
| 220 |
<input type="hidden" name="_csrf" value="{{ shell.csrf }}"> |
| 221 |
<label for="dconfirm">Type <code>{{ repo.owner }}/{{ repo.name }}</code> to confirm</label><input type="text" id="dconfirm" name="confirm" required autocomplete="off"> |
| 222 |
<button type="submit">DELETE</button> |
| 223 |
</form> |
| 224 |
</details> |
| 225 |
</div> |
| 226 |
</section> |
| 227 |
{% endif %} |
| 228 |
</div> |
| 229 |
</div> |
| 230 |
{% endblock %} |