Skip to content

Commit

Permalink
dagger: fmt and setup some cache
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Apr 3, 2022
1 parent 3601635 commit 36b6bce
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 51 deletions.
130 changes: 79 additions & 51 deletions ci.cue
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,89 @@ package buildkittekton

import (
"dagger.io/dagger"
"dagger.io/dagger/core"

"universe.dagger.io/go"
"universe.dagger.io/docker"
"universe.dagger.io/bash"
"universe.dagger.io/alpine"
"universe.dagger.io/alpine"
)

dagger.#Plan & {
client: {
filesystem: {
"./": read: {
contents: dagger.#FS
}
}
network: "unix:///var/run/docker.sock": connect: dagger.#Socket
}
client: {
filesystem: {
"./": read: {
contents: dagger.#FS
}
}
network: "unix:///var/run/docker.sock": connect: dagger.#Socket
}

actions: {
_goimage: go.#Image & {
version: "1.18.0" // 1.17.8 # FIXME(vdemeester) do a matrix/param here
packages: {git: {}}
}

// Cache
_goBuildCache: core.#CacheDir & {
id: "go-build-cache"
}
_goBuildCacheMount: "goBuildCache": {
dest: *"/root/.cache/go-build" | string
contents: _goBuildCache
}
_goModCache: core.#CacheDir & {
id: "go-mod-cache"
}
_goModCacheMount: "goModCache": {
dest: *"/go/pkg/mod" | string
contents: _goModCache
}

actions: {
_goimage: go.#Image & {
version: "1.18.0" // 1.17.8 # FIXME(vdemeester) do a matrix/param here
packages: { git: {} }
}
"tkn-local": go.#Build & {
source: client.filesystem."./".read.contents
package: "./cmd/tkn-local"
container: go.#Container & {
input: _goimage.output
}
}
image: docker.#Dockerfile & {
// This is the context.
source: client.filesystem."./".read.contents
dockerfile: path: "Dockerfile.docker"
}
test: {
_image: alpine.#Build & {
packages: {
bash: {}
moreutils: {}
make: {}
git: {}
"docker-cli": {}
}
}
docker: bash.#Run & {
input: _image.output
workdir: "/bash/scripts"
script: {
directory: client.filesystem."./".read.contents
filename: "hack/test.sh"
}
mounts: docker: {
dest: "/var/run/docker.sock"
contents: client.network."unix:///var/run/docker.sock".connect
}
}
}
}
}
"tkn-local": go.#Build & {
source: client.filesystem."./".read.contents
package: "./cmd/tkn-local"
container: go.#Container & {
input: _goimage.output
mounts: _goBuildCacheMount & _goModCacheMount
}
}
"build-tekton": go.#Build & {
source: client.filesystem."./".read.contents
package: "./cmd/buildkit-tekton"
container: go.#Container & {
input: _goimage.output
mounts: _goBuildCacheMount & _goModCacheMount
}
}
image: docker.#Dockerfile & {
// This is the context.
source: client.filesystem."./".read.contents
dockerfile: path: "Dockerfile.docker"
}
test: {
_image: alpine.#Build & {
packages: {
bash: {}
moreutils: {}
make: {}
git: {}
"docker-cli": {}
}
}
docker: bash.#Run & {
input: _image.output
workdir: "/bash/scripts"
script: {
directory: client.filesystem."./".read.contents
filename: "hack/test.sh"
}
mounts: docker: {
dest: "/var/run/docker.sock"
contents: client.network."unix:///var/run/docker.sock".connect
}
}
}
}
}
1 change: 1 addition & 0 deletions cmd/tkn-local/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func Command() *cobra.Command {
pruneCommand(),
runCommand(),
)

return cmd
}

Expand Down

0 comments on commit 36b6bce

Please sign in to comment.