forked from bluebrown/kobold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
169 lines (144 loc) · 3.6 KB
/
Taskfile.yaml
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# NOTE:
# this file is intended to use via bin/task,
# after installing the dependencies with 'go mod download'
version: "3"
env:
CONTAINER_REGISTRY: docker.io
VERSION: dev
tasks:
default:
desc: Show the task list
cmds:
- bin/task --list-all
check:*:
desc: Run all checks
cmds:
- task: check:vet
- task: check:test
check:vet:
desc: Vet the source code
cmds:
- go vet ./...
check:test:
desc: Run test suit
cmds:
- go test ./...
build:*:
desc: Build all binaries
cmds:
- task: build:gitgo
- task: build:gitexec
build:
internal: true
cmds:
- go build -o bin/{{.OUTPUT}} -v -tags {{.BUILD_TAG}} -ldflags '-w -s -X main.version={{.VERSION}}' ./cmd/server/
requires:
vars:
- BUILD_TAG
- OUTPUT
build:gitgo:
desc: Build the server with gitgo
cmds:
- task: build
vars:
BUILD_TAG: gitgo
OUTPUT: kobold
build:gitexec:
desc: Build the server with gitexec
cmds:
- task: build
vars:
BUILD_TAG: gitexec
OUTPUT: kobold-gitexec
image:build:
desc: Build the images adn load the into the local daemon
cmds:
- docker buildx bake -f build/docker-bake.hcl --load {{.CLI_ARGS}}
image:publish:
desc: Build and publish the images
cmds:
- >
docker buildx bake -f build/docker-bake.hcl
--set *.attest=type=provenance,mode=min,type=sbom --push
{{.CLI_ARGS}}
e2e:up:
desc: Local end to end setup using gitea and kind
cmds:
- bash e2e/up.sh
e2e:down:
desc: Tear down the local e2e setup
cmds:
- bash e2e/down.sh
dist:*:
desc: Build all artifacts
deps:
- dist:clear
cmds:
- task: dist:image
- task: dist:manifests
- task: dist:schema
- task: dist:binaries
dist:dir:
internal: true
cmds:
- mkdir -p .dist
dist:clear:
internal: true
cmds:
- rm -rf .dist/*
dist:binaries:
desc: Build and archive the binaries
deps:
- build:*
cmds:
- tar -czf .dist/kobold.{{OS}}-{{ARCH}}.tgz bin/kobold
- tar -czf .dist/kobold-gitexec.{{OS}}-{{ARCH}}.tgz bin/kobold-gitexec
dist:image:
desc: Build the container image
deps:
- dist:dir
cmds:
- >
docker buildx bake -f build/docker-bake.hcl
--set *.attest=type=provenance,mode=min,type=sbom
--set gitgo.output=type=tar,dest=.dist/kobold.oci.tar
--set gitexec.output=type=tar,dest=.dist/kobold-gitexec.oci.tar
{{.CLI_ARGS}}
dist:manifests:
desc: Build the kubernetes manifests
deps:
- dist:dir
- bin:kustomize
cmds:
- bin/kustomize build manifests/dist/ -o .dist/kobold.manifests.yaml
dist:schema:
desc: Copy the config json schema to the dist dir
deps:
- dist:dir
cmds:
- cp assets/schema.json .dist/kobold.schema.json
docs:publish:
desc: Build and publish the docs to github pages
deps:
- bin:mdbook
cmds:
- bash docs/publish.sh
docs:serve:
desc: Serve the docs
deps:
- bin:mdbook
cmds:
- bin/mdbook serve docs/
bin:mdbook:
internal: true
status:
- test -x bin/mdbook
cmds:
- curl -fsSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -C bin -xzf -
bin:kustomize:
internal: true
dir: bin
status:
- test -x kustomize
cmds:
- curl -fsSL "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash