Repository navigation
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
67 lines (57 loc) · 1.56 KB
/
Copy pathTaskfile.yaml
File metadata and controls
67 lines (57 loc) · 1.56 KB
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
version: "3"
vars:
IMAGE: "ghcr.io/chapar-rest/mock-server"
NAMESPACE: "mock-server"
tasks:
# Default task: test + lint.
default:
cmds:
- task: test
- task: lint
# Run Go tests.
test:
cmds:
- go test ./...
# Lint Go code.
lint:
cmds:
- golangci-lint run
# go mod tidy + go mod vendor
tidy:
cmds:
- go mod tidy
- go mod vendor
# Re-generate all generated artifacts.
generate:
cmds:
- rm -rf ./internal/gen
- mkdir ./internal/gen
- go generate ./...
# Start the server for local development. REST: http://localhost:8080/api/v1,
# gRPC: grpcurl -plaintext localhost:8080 list
dev:
env:
MOCK_ENV: "local"
MOCK_LOG_LEVEL: "debug"
PORT: "8080"
cmds:
- go run ./cmd/server
# The source label links the GHCR package to the public repo, so the
# package is public too and the cluster pulls it without a secret.
build:images:
vars:
SHORT_HASH:
sh: git rev-parse --short HEAD
cmds:
- VERSION="v1.0.0-{{.SHORT_HASH}}" KO_DOCKER_REPO="{{.IMAGE}}" ko build --bare --tags "v1.0.0-{{.SHORT_HASH}}" --image-label org.opencontainers.image.source=https://github.com/chapar-rest/mock-server ./cmd/server
deploy:k8s:
vars:
SHORT_HASH:
sh: git rev-parse --short HEAD
cmds:
- kubectl -n {{.NAMESPACE}} set image deployment/mock-server mock-server={{.IMAGE}}:v1.0.0-{{.SHORT_HASH}}
# Build and push the image, then roll out the server.
publish:
cmds:
- task: build:images
- task: deploy:k8s