v0.4.1 122e784

actions_job.go RawHistoryFolder

1// SPDX-License-Identifier: MIT
2
3package executor
4
5import "os"
6
7// prepareJob is the actions part of "Set up job" (ActionManager.PrepareActionsAsync
8// and JobExtension.cs:299-362): resolve and download the actions of the job,
9// and build the queue of the steps: the steps that pull and build images, the
10// pre stages in the order of the steps, then the steps themselves.
11func (j *job) prepareJob() ([]qstep, error) {
12	j.actions = newActionState()
13	// The actions of a previous job are not reused (ActionManager.cs:97-100).
14	_ = os.RemoveAll(j.state.Layout().Actions)
15	if err := os.MkdirAll(j.state.Layout().Actions, 0o755); err != nil {
16		return nil, err
17	}
18	j.own(j.state.Layout().Actions)
19	nodes, err := newNodes(j.jb.Steps, nil, "")
20	if err != nil {
21		return nil, err
22	}
23	j.actions.nodes = nodes
24	if err := j.prepare(j.ctx(), 1, nodes, 0, nil); err != nil {
25		return nil, j.setupError(err)
26	}
27	queue := j.setupSteps()
28	// JobExtension.cs:434-440: every runner step of the job gets a random "N"
29	// context name before anything runs; its final result, skipped included,
30	// is in the steps context. The ones the composite actions run get a "__"
31	// name (CompositeActionHandler.cs:121-123) and are not registered, which is
32	// why only this queue has ids.
33	for i := range queue {
34		queue[i].ctxID = newRunnerStepID()
35	}
36	// JobExtension.cs:317-331: the images of the actions are pulled first, then
37	// the containers start.
38	if j.cs != nil {
39		ic := j.initContainersStep()
40		ic.ctxID = newRunnerStepID()
41		queue = append(queue, ic)
42	}
43	for _, n := range nodes {
44		if j.actions.pre[n] {
45			queue = append(queue, qstep{n: n, stage: stagePre, cond: n.def.preIf()})
46		}
47	}
48	// The pre steps come before every main step: they were collected while
49	// walking the steps, the mains follow.
50	for _, n := range nodes {
51		queue = append(queue, qstep{n: n, stage: stageMain})
52	}
53	return queue, nil
54}
55
56// setupError words an error of the preparation like the runner reports it:
57// errors of the manifests were logged already; "Failed to resolve action
58// download info." and "Failed to download archive ..." carry the inner message.
59func (j *job) setupError(err error) error {
60	return err
61}

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