forked from drone/drone-runtime
/
state.go
38 lines (33 loc) · 763 Bytes
/
state.go
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
37
38
package runtime
import "github.com/drone/drone-runtime/engine"
// State defines the pipeline and process state.
type State struct {
hook *Hook
config *engine.Config
engine engine.Engine
fs FileSystem
// Global state of the runtime.
Runtime struct {
// Runtime time started
Time int64
// Runtime pipeline error state
Error error
}
// Runtime pipeline step
Step *engine.Step
// Current process state.
State *engine.State
}
// snapshot makes a snapshot of the runtime state.
func snapshot(r *Runtime, step *engine.Step, state *engine.State) *State {
s := new(State)
s.Runtime.Error = r.error
s.Runtime.Time = r.start
s.config = r.config
s.hook = r.hook
s.engine = r.engine
s.Step = step
s.State = state
s.fs = r.fs
return s
}