summaryrefslogtreecommitdiff
path: root/build/phases.go
blob: a65672755f73144f430b8f09c9ae836ec9ebb314 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package build

// Phase enum type
type Phase int

// Distinct build phases that each compiler implementation should pass to
// PhaseCompileable configuration (in the order they are defined here) to
// allow for dependency injection during compilation.
//
const (
	PhasePrivileged       Phase = iota // first, copies/execution done as root
	PhasePrivilegeDropped              // second, copies/execution done as unprivileged user from here on
	PhasePreInstall                    // third, before application files and artifacts are copied
	PhaseInstall                       // fourth, application files and artifacts are copied
	PhasePostInstall                   // fifth, after application files and artifacts are copied
)

// PhaseCompileable defines and interface that all configuration types should
// implement if they want to inject build instructions into any of the defined
// build phases.
//
type PhaseCompileable interface {
	InstructionsForPhase(phase Phase) []Instruction
}

// Phases returns all build phases in the order to be compiled.
//
func Phases() []Phase {
	return []Phase{
		PhasePrivileged,
		PhasePrivilegeDropped,
		PhasePreInstall,
		PhaseInstall,
		PhasePostInstall,
	}
}