v0.4.1 122e784

externals.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3package sandbox
4
5import (
6	"crypto/sha256"
7	"encoding/hex"
8	"sort"
9)
10
11// External is one tool the host provides outside the image (Node.js), attached
12// read-only at GuestExternalsDir/<Name>.
13type External struct {
14	// Name is the directory below GuestExternalsDir: node20, node24,
15	// node20_alpine, node24_alpine.
16	Name string
17	// ID identifies the content: it changes whenever the files (or the reason of
18	// an unavailable tool) change, so that drivers can key caches on it.
19	ID string
20	// Dir is the host directory that is attached. For an unavailable tool it
21	// holds the file ExternalUnavailableFile with the reason, and a bin/node
22	// script that prints it and fails.
23	Dir string
24	// Unavailable is true when the tool is missing on this runner.
25	Unavailable bool
26}
27
28// ExternalsSource hands the drivers the current set of externals. It is called
29// at every sandbox start and may change between calls (a download finishing).
30type ExternalsSource interface {
31	Externals() []External
32}
33
34// ExternalsKey is the cache key of a set: the same tools give the same key, in
35// any order, and any change of content gives another.
36func ExternalsKey(set []External) string {
37	ids := make([]string, 0, len(set))
38	for _, e := range set {
39		ids = append(ids, e.Name+"="+e.ID)
40	}
41	sort.Strings(ids)
42	h := sha256.New()
43	for _, id := range ids {
44		h.Write([]byte(id))
45		h.Write([]byte{0})
46	}
47	return hex.EncodeToString(h.Sum(nil))[:16]
48}
49
50// ExternalsOf returns the current set of cfg (nil when there is none).
51func (c Config) ExternalsOf() []External {
52	if c.Externals == nil {
53		return nil
54	}
55	return c.Externals.Externals()
56}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 4

Tags 11

↑↓ moveenter openesc close