internal/web/templates/settings.html
345 lines · 22510 bytes
1{{define "width"}}wide{{end}}
2{{define "title"}}settings · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}}
4{{$base := printf "/%s/%s/settings" .Repo.OwnerName .Repo.Name}}
5<h1>Settings</h1>
6{{if .Notice}}{{if .Saved}}<p class="notice" role="status">{{.Notice}}</p>{{else}}<p class="error" role="alert">{{.Notice}}{{if .Reauth}} <a href="/login">Sign in again</a>{{end}}</p>{{end}}{{end}}
7<div class="withcol narrow">
8<nav class="sidecol" aria-label="Sections">
9<details class="sidedrop">
10<summary><span class="sideword">Sections</span></summary>
11 <div class="grp"><h2 class="colhead">Sections</h2>
12 <ul>
13 <li><a href="#identity">Identity</a></li>
14 <li><a href="#access">Access</a></li>
15 <li><a href="#webhooks">Webhooks</a></li>
16 <li><a href="#gates">Merge gates</a></li>
17 {{if or .ScanAvailable .Security.Enabled}}<li><a href="#security">Code scanning</a></li>{{end}}
18 <li><a href="#secrets">Secret scan</a></li>
19 <li><a href="#branches">Protected branches</a></li>
20 <li><a href="#tags">Protected tags</a></li>
21 <li><a href="#deps">Dependencies</a></li>
22 <li><a href="#runners">Runners</a></li>
23 <li><a href="#lifecycle">Lifecycle</a></li>
24 </ul></div>
25</details>
26</nav>
27<div class="colmain">
28
29<section id="identity"><h2>Identity</h2>
30<form method="post" action="{{$base}}" class="setform">
31 <input type="hidden" name="field" value="description">
32 <div><label for="description">Description</label></div>
33 <div><input type="text" id="description" name="description" value="{{or (index .Submitted "description") .Desc}}" placeholder="one line, shown in listings"></div>
34 <div><button type="submit">Save</button></div>
35</form>
36<form method="post" action="{{$base}}" class="setform">
37 <input type="hidden" name="field" value="website">
38 <div><label for="website">Website</label></div>
39 <div><input type="text" id="website" name="website" value="{{or (index .Submitted "website") .Repo.Settings.Website}}" placeholder="https://example.org"></div>
40 <div><button type="submit" class="btn">Save</button></div>
41</form>
42<form method="post" action="{{$base}}" class="setform">
43 <input type="hidden" name="field" value="topics">
44 <div><label for="topics">Topics</label><p class="hint">Comma separated, lower case.</p></div>
45 <div><input type="text" id="topics" name="topics" value="{{or (index .Submitted "topics") (join .Topics ", ")}}"></div>
46 <div><button type="submit" class="btn">Save</button></div>
47</form>
48{{if .Branches}}<form method="post" action="{{$base}}" class="setform">
49 <input type="hidden" name="field" value="default-branch">
50 <div><label for="default-branch">Default branch</label></div>
51 <div><select id="default-branch" name="default-branch">{{$cur := .Repo.DefaultBranch}}{{range .Branches}}<option value="{{.Name}}"{{if eq .Name $cur}} selected{{end}}>{{.Name}}</option>{{end}}</select></div>
52 <div><button type="submit" class="btn">Save</button></div>
53</form>{{end}}
54</section>
55
56<section id="access"><h2>Access</h2>
57<form method="post" action="{{$base}}" class="setform">
58 <input type="hidden" name="field" value="visibility">
59 <div><span class="fieldname">Visibility</span></div>
60 <div class="check">
61 <label><input type="radio" name="visibility" value="public"{{if eq .Repo.Visibility "public"}} checked{{end}}> Public</label>
62 <label><input type="radio" name="visibility" value="private"{{if eq .Repo.Visibility "private"}} checked{{end}}> Private</label>
63 </div>
64 <div><button type="submit" class="btn">Save</button></div>
65</form>
66<form method="post" action="{{$base}}" class="setform">
67 <input type="hidden" name="field" value="git-daemon">
68 <div><label for="git-daemon">Serve over git://</label><p class="hint">Public repositories only.</p></div>
69 <div class="check"><input type="checkbox" id="git-daemon" name="git-daemon" value="on"{{if .Repo.Settings.GitDaemon}} checked{{end}}></div>
70 <div><button type="submit" class="btn">Save</button></div>
71</form>
72<h3>Who can reach this repository</h3>
73{{if .Access}}<div class="tablewrap"><table class="keys">
74<thead><tr class="cols"><th scope="col">user</th><th scope="col">role</th><th scope="col">via</th><th scope="col"><span class="vh">actions</span></th></tr></thead>
75<tbody>{{range .Access}}<tr>
76 <td class="mono"><a href="/{{.User}}">{{.User}}</a></td>
77 <td>{{.Role}}</td>
78 <td>{{.Source}}</td>
79 <td class="act">{{if eq .Source "direct"}}<form method="post" action="{{$base}}" class="inline">
80 <input type="hidden" name="field" value="access-revoke">
81 <input type="hidden" name="user" value="{{.User}}">
82 <button type="submit" class="danger">Revoke</button>
83 </form>{{end}}</td>
84</tr>{{end}}</tbody></table></div>
85{{else}}<p class="meta">Nobody else can reach it.</p>{{end}}
86<form method="post" action="{{$base}}" class="setform">
87 <input type="hidden" name="field" value="access-grant">
88 <div><label for="grant-user">Grant access</label><p class="hint">An account name and a role. A grant adds to what an organization or team already gives.</p></div>
89 <div><input type="text" id="grant-user" name="user" value="{{index .Submitted "user"}}" autocomplete="off" spellcheck="false" placeholder="username">
90 <select name="role" aria-label="Role">{{$role := index .Submitted "role"}}<option value="read"{{if eq $role "read"}} selected{{end}}>read</option><option value="write"{{if eq $role "write"}} selected{{end}}>write</option><option value="admin"{{if eq $role "admin"}} selected{{end}}>admin</option></select></div>
91 <div><button type="submit" class="btn">Grant</button></div>
92</form>
93</section>
94
95<section id="webhooks"><h2>Webhooks</h2>
96{{if .Hooks}}
97<ul class="protlist">
98{{range .Hooks}}<li><span class="mono">#{{.ID}}</span> <code>{{.URL}}</code> <span class="meta">{{.Events}}{{if .Secret}}, signed{{end}}</span>
99 <form method="post" action="{{$base}}" class="inline">
100 <input type="hidden" name="field" value="webhook-remove">
101 <input type="hidden" name="id" value="{{.ID}}">
102 <button type="submit" class="danger">Remove</button>
103 </form></li>
104{{end}}
105</ul>
106{{else}}<p class="meta">No webhooks.</p>{{end}}
107<form method="post" action="{{$base}}" class="setform stack" autocomplete="off">
108 <input type="hidden" name="field" value="webhook-add">
109 <label for="hook-url">Add a webhook</label>
110 <input type="text" id="hook-url" name="url" value="{{index .Submitted "url"}}" placeholder="https://ci.example.org/hook" spellcheck="false">
111 <label for="hook-events">Events</label>
112 <p class="hint">Comma separated, or <code>*</code> for all.</p>
113 <input type="text" id="hook-events" name="events" value="{{or (index .Submitted "events") "*"}}" spellcheck="false">
114 <label for="hook-secret">Secret</label>
115 <p class="hint">Optional. Signs each delivery; it is not shown again.</p>
116 <input type="password" id="hook-secret" name="secret" value="" autocomplete="new-password">
117 <button type="submit" class="btn">Add</button>
118</form>
119<h3>Recent deliveries</h3>
120{{if .Deliveries}}<div class="tablewrap"><table class="keys">
121<thead><tr class="cols"><th scope="col">id</th><th scope="col">event</th><th scope="col">url</th><th scope="col">state</th><th scope="col"><span class="vh">actions</span></th></tr></thead>
122<tbody>{{range .Deliveries}}<tr>
123 <td class="mono">{{.ID}}</td>
124 <td>{{.Event}}</td>
125 <td class="mono">{{.URL}}</td>
126 <td>{{.Status}} ({{.Attempts}} attempts){{if .LastError}}<br><span class="meta">{{.LastError}}</span>{{end}}</td>
127 <td class="act"><form method="post" action="{{$base}}" class="inline">
128 <input type="hidden" name="field" value="webhook-redeliver">
129 <input type="hidden" name="delivery" value="{{.ID}}">
130 <button type="submit" class="btn">Redeliver</button>
131 </form></td>
132</tr>{{end}}</tbody></table></div>
133{{else}}<p class="meta">Nothing delivered yet.</p>{{end}}
134</section>
135
136<section id="gates"><h2>Merge gates</h2>
137<p class="meta">Checked before a merge, in this order: checks, approvals, resolved threads, signatures.</p>
138<form method="post" action="{{$base}}" class="setform">
139 <input type="hidden" name="field" value="require-checks">
140 <div><label for="require-checks">Required checks</label><p class="hint">Requires CI to succeed.{{with .Repo.Settings.RequiredContexts}} Also waits for {{range $i, $c := .}}{{if $i}}, {{end}}<code>{{$c}}</code>{{end}} until they report{{if not $.Repo.Settings.RequireChecks}}, once this is on{{end}}.{{end}}</p></div>
141 <div class="check"><input type="checkbox" id="require-checks" name="require-checks" value="on"{{if .Repo.Settings.RequireChecks}} checked{{end}}></div>
142 <div><button type="submit" class="btn">Save</button></div>
143</form>
144<form method="post" action="{{$base}}" class="setform">
145 <input type="hidden" name="field" value="require-contexts">
146 <div><label for="contexts">Required contexts</label><p class="hint">Statuses the checks gate waits for until they report, separated by spaces. Saving any turns required checks on; saving none leaves it as it is.</p></div>
147 <div><input type="text" id="contexts" name="contexts" value="{{range $i, $c := .Repo.Settings.RequiredContexts}}{{if $i}} {{end}}{{$c}}{{end}}" autocomplete="off"></div>
148 <div><button type="submit" class="btn">Save</button></div>
149</form>
150<form method="post" action="{{$base}}" class="setform">
151 <input type="hidden" name="field" value="require-approvals">
152 <div><label for="approvals">Approvals</label><p class="hint">Approvals from anyone with write access. Zero means none required.</p></div>
153 <div class="num"><input type="number" id="approvals" name="approvals" min="0" max="10" value="{{.Repo.Settings.RequireApprovals}}"></div>
154 <div><button type="submit" class="btn">Save</button></div>
155</form>
156<form method="post" action="{{$base}}" class="setform">
157 <input type="hidden" name="field" value="require-resolved">
158 <div><label for="require-resolved">Review threads</label><p class="hint">Every thread on the diff must be resolved before merging.</p></div>
159 <div class="check"><input type="checkbox" id="require-resolved" name="require-resolved" value="on"{{if .Repo.Settings.RequireResolved}} checked{{end}}></div>
160 <div><button type="submit" class="btn">Save</button></div>
161</form>
162<form method="post" action="{{$base}}" class="setform">
163 <input type="hidden" name="field" value="require-codeowners">
164 <div><label for="require-codeowners">CODEOWNERS</label><p class="hint">Code owners must approve.</p></div>
165 <div class="check"><input type="checkbox" id="require-codeowners" name="require-codeowners" value="on"{{if .Repo.Settings.RequireCodeowners}} checked{{end}}></div>
166 <div><button type="submit" class="btn">Save</button></div>
167</form>
168<form method="post" action="{{$base}}" class="setform">
169 <input type="hidden" name="field" value="require-signed">
170 <div><label for="require-signed">Signed commits</label><p class="hint">Every commit in the request must carry a verified signature. Squash and merge strategies are refused, since both mint an unsigned commit.</p></div>
171 <div class="check"><input type="checkbox" id="require-signed" name="require-signed" value="on"{{if .Repo.Settings.RequireSignedCommits}} checked{{end}}></div>
172 <div><button type="submit" class="btn">Save</button></div>
173</form>
174</section>
175
176{{if or .ScanAvailable .Security.Enabled}}<section id="security"><h2>Code scanning</h2>
177<form method="post" action="{{$base}}" class="setform">
178 <input type="hidden" name="field" value="security">
179 <div><label for="security-enabled">Scheduled scan</label><p class="hint">Runs the instance's code scanner over <code>{{.Repo.DefaultBranch}}</code> on its schedule, on a runner attached to this repository, and keeps an issue of what it finds.</p></div>
180 <div class="check"><input type="checkbox" id="security-enabled" name="security" value="on"{{if .Security.Enabled}} checked{{end}}></div>
181 <div><button type="submit" class="btn">Save</button></div>
182</form>
183{{if .Security.Enabled}}
184<p class="meta">Next scan {{.Security.NextRun}} · last results {{if .Security.LastResults}}{{when .Security.LastResults}}{{else}}never{{end}}{{if .Security.IssueNumber}} · <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Security.IssueNumber}}">#{{.Security.IssueNumber}}</a>{{end}}</p>
185{{if .Security.Findings}}<div class="tablewrap"><table class="keys">
186<tr class="cols"><th scope="col">location</th><th scope="col">rule</th><th scope="col">level</th></tr>
187{{range .Security.Findings}}<tr>
188 <td class="mono">{{.Path}}:{{.Line}}</td>
189 <td class="mono">{{.Rule}}</td>
190 <td>{{.Level}}</td>
191</tr>
192{{end}}</table></div>
193{{else if .Security.LastResults}}<p class="none">The last scan found nothing.</p>{{end}}
194{{end}}
195</section>
196{{end}}
197
198<section id="secrets"><h2>Secret scan</h2>
199<form method="post" action="{{$base}}" class="setform">
200 <input type="hidden" name="field" value="secret-scan">
201 <div><label for="secret-scan">Pushes</label><p class="hint">Each push's new files are checked for credentials in known formats. Warn accepts the push and tells the pusher where; block refuses it. Only the path, line and kind of credential are reported, never the value.</p></div>
202 <div><select id="secret-scan" name="secret-scan">{{$mode := or .Repo.Settings.SecretScan "warn"}}<option value="off"{{if eq $mode "off"}} selected{{end}}>off</option><option value="warn"{{if eq $mode "warn"}} selected{{end}}>warn</option><option value="block"{{if eq $mode "block"}} selected{{end}}>block</option></select></div>
203 <div><button type="submit" class="btn">Save</button></div>
204</form>
205<form method="post" action="{{$base}}" class="setform">
206 <input type="hidden" name="field" value="secret-scan-allow">
207 <div><label for="secret-scan-allow">Allowed paths</label><p class="hint">Findings under these paths are ignored, for test fixtures. Path globs separated by spaces: <code>testdata/**</code>, <code>*_test.go</code>.</p></div>
208 <div><input type="text" id="secret-scan-allow" name="secret-scan-allow" value="{{join .Repo.Settings.SecretScanAllow " "}}"></div>
209 <div><button type="submit" class="btn">Save</button></div>
210</form>
211</section>
212
213<section id="branches"><h2>Protected branches</h2>
214{{if .Repo.Settings.ProtectedBranches}}
215<ul class="protlist">
216{{$mr := .Repo.Settings.RequireMR}}{{range .Repo.Settings.ProtectedBranches}}<li><code>{{.}}</code>{{if $mr}} <span class="hint">Direct pushes refused, merge requests only.</span>{{end}}
217 <form method="post" action="{{$base}}" class="inline">
218 <input type="hidden" name="field" value="unprotect">
219 <input type="hidden" name="branch" value="{{.}}">
220 <button type="submit" class="danger">Unprotect</button>
221 </form></li>
222{{end}}
223</ul>
224{{else}}<p class="meta">No protected branches. A protected branch refuses deletion and force-pushes.</p>{{end}}
225<form method="post" action="{{$base}}" class="setform">
226 <input type="hidden" name="field" value="protect">
227 <div><label for="branch">Protect a branch</label></div>
228 <div><select id="branch" name="branch">{{range .Branches}}<option value="{{.Name}}">{{.Name}}</option>{{end}}</select></div>
229 <div><button type="submit" class="btn">Protect</button></div>
230</form>
231<form method="post" action="{{$base}}" class="setform">
232 <input type="hidden" name="field" value="require-mr">
233 <div><label for="require-mr">Require merge requests</label><p class="hint">Every protected branch changes through a merge request. A direct push is refused in pre-receive.</p></div>
234 <div class="check"><input type="checkbox" id="require-mr" name="require-mr" value="on"{{if .Repo.Settings.RequireMR}} checked{{end}}></div>
235 <div><button type="submit" class="btn">Save</button></div>
236</form>
237</section>
238
239<section id="tags"><h2>Protected tags</h2>
240{{if .Repo.Settings.ProtectedTags}}
241<ul class="protlist">
242{{range .Repo.Settings.ProtectedTags}}<li><code>{{.}}</code>
243 <form method="post" action="{{$base}}" class="inline">
244 <input type="hidden" name="field" value="unprotect-tag">
245 <input type="hidden" name="glob" value="{{.}}">
246 <button type="submit" class="danger">Unprotect</button>
247 </form></li>
248{{end}}
249</ul>
250{{else}}<p class="meta">No protected tags. A tag matching a protected glob is created once and refuses moves and deletion. A tag a release is anchored to refuses both regardless.</p>{{end}}
251<form method="post" action="{{$base}}" class="setform">
252 <input type="hidden" name="field" value="protect-tag">
253 <div><label for="glob">Protect tags matching</label></div>
254 <div><input type="text" id="glob" name="glob" placeholder="v*"></div>
255 <div><button type="submit" class="btn">Protect</button></div>
256</form>
257</section>
258
259<section id="deps"><h2>Dependencies</h2>
260<form method="post" action="{{$base}}" class="setform">
261 <input type="hidden" name="field" value="deps">
262 <div><label for="deps-enabled">Check for updates and advisories</label><p class="hint">Evaluates the manifests and lockfiles on <code>{{.Repo.DefaultBranch}}</code> against the registries and OSV, and opens an issue for each. Updates for Go, NPM, Crates, and PyPI; advisories for those and SwiftPM.</p></div>
263 <div class="check"><input type="checkbox" id="deps-enabled" name="deps" value="on"{{if .DepsEnabled}} checked{{end}}></div>
264 <div><button type="submit" class="btn">Save</button></div>
265</form>
266{{if .DepsEnabled}}
267<p class="meta">Last checked {{if .Deps.LastCheck}}{{when .Deps.LastCheck}}{{else}}never{{end}}{{if .Deps.IssueNumber}} · <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Deps.IssueNumber}}">#{{.Deps.IssueNumber}}</a>{{end}}{{if .Deps.AdvisoryIssueNumber}} · advisories <a href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/issues/{{.Deps.AdvisoryIssueNumber}}">#{{.Deps.AdvisoryIssueNumber}}</a>{{end}}</p>
268{{if .Deps.LastError}}<p class="error" role="alert">{{.Deps.LastError}}</p>{{end}}
269{{if .Deps.Behind}}<div class="tablewrap"><table class="keys">
270<tr class="cols"><th scope="col">dependency</th><th scope="col">pinned</th><th scope="col">latest</th></tr>
271{{range .Deps.Behind}}<tr>
272 <td class="mono">{{.Ecosystem}} {{.Name}}</td>
273 <td class="mono">{{.Current}}</td>
274 <td class="mono">{{.Latest}}</td>
275</tr>
276{{end}}</table></div>
277{{else}}<p class="none">Nothing behind{{if not .Deps.LastCheck}} — the first check has not run yet{{end}}.</p>{{end}}
278{{if .Deps.Advisories}}<div class="tablewrap"><table class="keys">
279<tr class="cols"><th scope="col">dependency</th><th scope="col">version</th><th scope="col">advisory</th><th scope="col">fixed in</th></tr>
280{{range .Deps.Advisories}}<tr>
281 <td class="mono">{{.Ecosystem}} {{.Name}}</td>
282 <td class="mono">{{.Version}}</td>
283 <td class="mono"><a href="https://osv.dev/vulnerability/{{.ID}}">{{.ID}}</a></td>
284 <td class="mono">{{.Fixed}}</td>
285</tr>
286{{end}}</table></div>
287{{else if .Deps.LastCheck}}<p class="none">No known advisories.</p>{{end}}
288{{end}}
289</section>
290
291<section id="runners"><h2>Runners</h2>
292{{if .Runners}}
293<ul class="protlist">
294{{range .Runners}}<li><code>{{.Fingerprint}}</code> <span class="meta">{{.Username}}{{if .LastSeen}}, last poll {{when .LastSeen}}{{else}}, never polled{{end}}{{if .BuildNumber}}, running {{.BuildRepo}} #{{.BuildNumber}} {{.BuildJob}}{{end}}{{if .Jobs}}, only {{join .Jobs ", "}}{{end}}</span>
295 <form method="post" action="{{$base}}" class="inline">
296 <input type="hidden" name="field" value="runner-remove">
297 <input type="hidden" name="fingerprint" value="{{.Fingerprint}}">
298 <button type="submit" class="danger">Detach</button>
299 </form></li>
300{{end}}
301</ul>
302{{else}}<p class="meta">No runners attached. Builds for this repository run on the runners attached here; a repository with none queues builds nothing claims.</p>{{end}}
303<form method="post" action="{{$base}}" class="setform stack">
304 <input type="hidden" name="field" value="runner-add">
305 <label for="runner-key">Attach a runner</label>
306 <p class="hint">Install <code>gitbay-runner</code>, run <code>gitbay-runner init</code>, and paste the key it prints. The runner builds your commits with the repository's secrets; merge requests from forks wait unless it runs with <code>-untrusted</code>.</p>
307 <textarea id="runner-key" name="key" rows="3" spellcheck="false" placeholder="ssh-ed25519 AAAA… (from gitbay-runner init)">{{index .Submitted "key"}}</textarea>
308 <label for="runner-jobs">Jobs</label>
309 <p class="hint">Leave empty for every job. Name jobs, comma-separated, to have this runner claim only those here, for instance <code>gitbay-security</code> on a runner with the code scanning image.</p>
310 <input type="text" id="runner-jobs" name="jobs" value="{{index .Submitted "jobs"}}">
311 <button type="submit" class="btn">Attach</button>
312</form>
313</section>
314
315<section id="lifecycle"><h2>Lifecycle</h2>
316<form method="post" action="{{$base}}" class="setform">
317 <input type="hidden" name="field" value="archive">
318 <div><label for="archive">Archived</label><p class="hint">Read-only for everyone. Issues and requests close to new activity. Reversible.</p></div>
319 <div class="check"><input type="checkbox" id="archive" name="archive" value="on"{{if .Repo.Settings.Archived}} checked{{end}}></div>
320 <div><button type="submit" {{if .Repo.Settings.Archived}}class="btn"{{else}}class="danger"{{end}}>Save</button></div>
321</form>
322<form method="post" action="{{$base}}" class="setform">
323 <input type="hidden" name="field" value="rename">
324 <div><label for="rename">Name</label><p class="hint">Clone URLs change. The old path stops resolving.</p></div>
325 <div><input type="text" id="rename" name="name" value="{{or (index .Submitted "name") .Repo.Name}}" autocomplete="off" spellcheck="false"></div>
326 <div><button type="submit" class="btn">Rename</button></div>
327</form>
328{{$path := printf "%s/%s" .Repo.OwnerName .Repo.Name}}
329<form method="post" action="{{$base}}" class="setform stack">
330 <input type="hidden" name="field" value="transfer">
331 <label for="new-owner">Transfer</label>
332 <p class="hint">Move it to your own account or an organization you administer. Clone URLs change.</p>
333 <input type="text" id="new-owner" name="new-owner" value="{{index .Submitted "new-owner"}}" placeholder="new owner" autocomplete="off" spellcheck="false">
334 <p>{{template "confirmfield" $path}} <button type="submit" class="danger">Transfer</button></p>
335</form>
336<form method="post" action="{{$base}}" class="setform stack">
337 <input type="hidden" name="field" value="delete">
338 <span class="fieldname">Delete</span>
339 <p class="hint">Removes the repository, its issues and merge requests. Cannot be undone.</p>
340 <p>{{template "confirmfield" $path}} <button type="submit" class="danger">Delete repository</button></p>
341</form>
342</section>
343</div>
344</div>
345{{end}}