pipeline: #compute -> #up

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-04-02 14:58:12 -07:00 committed by Solomon Hykes
parent 6486e159c1
commit 8a4aa4d42b
5 changed files with 10 additions and 7 deletions

View File

@ -199,7 +199,7 @@ func (d *Deployment) LocalDirs() map[string]string {
flow := cueflow.New(&cueflow.Config{}, inst, newTaskFunc(inst, noOpRunner)) flow := cueflow.New(&cueflow.Config{}, inst, newTaskFunc(inst, noOpRunner))
for _, t := range flow.Tasks() { for _, t := range flow.Tasks() {
v := compiler.Wrap(t.Value(), inst) v := compiler.Wrap(t.Value(), inst)
localdirs(v.Lookup("#compute")) localdirs(v.Lookup("#up"))
} }
// 2. Scan the plan // 2. Scan the plan

View File

@ -93,7 +93,7 @@ func (dir dirInput) Compile() (*compiler.Value, error) {
} }
} }
llb := fmt.Sprintf( llb := fmt.Sprintf(
`#compute: [{do:"local",dir:"%s", include:%s}]`, `#up: [{do:"local",dir:"%s", include:%s}]`,
dir.Path, dir.Path,
includeLLB, includeLLB,
) )
@ -125,7 +125,7 @@ func (git gitInput) Compile() (*compiler.Value, error) {
} }
return compiler.Compile("", fmt.Sprintf( return compiler.Compile("", fmt.Sprintf(
`#compute: [{do:"fetch-git", remote:"%s", ref:"%s"}]`, `#up: [{do:"fetch-git", remote:"%s", ref:"%s"}]`,
git.Remote, git.Remote,
ref, ref,
)) ))

View File

@ -61,7 +61,7 @@ func (p *Pipeline) FS() fs.FS {
} }
func isComponent(v *compiler.Value) bool { func isComponent(v *compiler.Value) bool {
return v.Lookup("#compute").Exists() return v.Lookup("#up").Exists()
} }
func ops(code ...*compiler.Value) ([]*compiler.Value, error) { func ops(code ...*compiler.Value) ([]*compiler.Value, error) {
@ -70,7 +70,7 @@ func ops(code ...*compiler.Value) ([]*compiler.Value, error) {
for _, x := range code { for _, x := range code {
// 1. attachment array // 1. attachment array
if isComponent(x) { if isComponent(x) {
xops, err := x.Lookup("#compute").List() xops, err := x.Lookup("#up").List()
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -7,7 +7,7 @@ import (
// An artifact such as source code checkout, container image, binary archive... // An artifact such as source code checkout, container image, binary archive...
// May be passed as user input, or computed by a buildkit pipeline // May be passed as user input, or computed by a buildkit pipeline
#Artifact: { #Artifact: {
#compute: [...llb.#Op] #up: llb.#Pipeline
_ _
... ...
} }

View File

@ -1,7 +1,7 @@
// llb: compile LLB graphs executable by buildkit // llb: compile LLB graphs executable by buildkit
package llb package llb
// One operation in a script // One operation in a pipeline
#Op: #Export | #Op: #Export |
#FetchContainer | #FetchContainer |
#PushContainer | #PushContainer |
@ -15,6 +15,9 @@ package llb
#Mkdir | #Mkdir |
#DockerBuild #DockerBuild
// Pipeline is a series of operations
#Pipeline: [...llb.#Op]
// Export a value from fs state to cue // Export a value from fs state to cue
#Export: { #Export: {
do: "export" do: "export"