gravitational / force

A new programming language for cloud native workflows
https://force.gravitational.co
Apache License 2.0
31 stars 7 forks source link

Build targets #90

Open klizhentas opened 4 years ago

klizhentas commented 4 years ago

Description

Similar to makefile targets, add a high level abstraction - Build target. Build target works as a makefile target:


Target({
   Name: "myimage",
    // params.Version interpolates the version parameter
    Path: "quay.io/myimage/${params.Version}",
    Build: func(version string) {
    },
    Depends: Target("testimage", params.Version),

})```

Target is like a function that attempts to execute, but verifies the state of the path. If already present, `Build` is not invoked, otherwise tries to get to the state, when the target image is present.

There are a couple of useful builtin targets:

```go
Image({

    // params.Version interpolates the version parameter
    Path: "quay.io/myimage/${params.Version}",
    Dockerfile: ...
    Context: ...
})```

```go
S3({

    // params.Version interpolates the version parameter
    Path: "quay.io/myimage/${params.Version}",
    Dockerfile: ...
    Context: ...
})```

Targets could be invoked from `Process`