-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathHonefile
124 lines (96 loc) · 2.33 KB
/
Honefile
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
secrets = [
"DOCKER_USER=justinbarrick",
"DOCKER_PASS=",
"S3_BUCKET=codesink-cache",
"S3_ENDPOINT=sfo2.digitaloceanspaces.com",
"S3_ACCESS_KEY=",
"S3_SECRET_KEY=",
"GITHUB_TOKEN="
]
env = [
"VAULT_ADDR=https://vault.codesink.io/",
"VAULT_TOKEN",
"S3_ENABLED=false",
"ENGINE=docker"
]
kubernetes {
namespace = "prow-tests"
}
engine = "${env.ENGINE}"
vault {
address = "${env.VAULT_ADDR}"
token = "${env.VAULT_TOKEN}"
}
cache {
s3 {
access_key = "${secrets.S3_ACCESS_KEY}"
secret_key = "${secrets.S3_SECRET_KEY}"
endpoint = "${secrets.S3_ENDPOINT}"
bucket = "${secrets.S3_BUCKET}"
disabled = "${env.S3_ENABLED != "true"}"
}
}
repository {
token = "${secrets.GITHUB_TOKEN}"
}
template "default" {
image = "golang:1.12.5@sha256:5bc207d20bd9e97c57dc2ad013f2b02d982cc6e411d48bdc79d90bb601696650"
env = {
"GO111MODULE" = "on"
"GOCACHE" = "/build/.gocache"
"GOPATH" = "/build/.go"
"GOBIN" = "/build/bin/"
}
inputs = ["./pkg/**/*.go", "./cmd/fluxcloud.go", "go.mod", "go.sum"]
}
template "docker" {
deps = ["build"]
image = "justinbarrick/kaniko@sha256:c0e44b97f6221c43f571f7a9c57297f641027ff37f62e0d781a9fac80e080e6c"
env = {
"DOCKER_USER" = "${secrets.DOCKER_USER}",
"DOCKER_PASS" = "${secrets.DOCKER_PASS}",
}
inputs = ["Dockerfile", "./fluxcloud"]
shell = <<EOF
#!/bin/sh
set +x
if [ "$DOCKER_PASS" == "" ]; then
ARGS="--no-push"
fi
kaniko --dockerfile=Dockerfile --context=/build/ --destination=${secrets.DOCKER_USER}/fluxcloud:$TAG $ARGS
EOF
}
job "lint" {
shell = "test -z $(gofmt -l ./cmd ./pkg/)"
}
job "test" {
deps = ["lint"]
shell = "go test ./..."
}
job "build" {
deps = ["test"]
outputs = ["./fluxcloud"]
env = {
"CGO_ENABLED" = "0"
"GOOS" = "linux"
}
shell = "go build -ldflags '-w -extldflags -static' -o ./fluxcloud ./cmd/"
}
job "docker" {
template = "docker"
env = {
"TAG" = "${env.GIT_BRANCH}-${env.GIT_COMMIT_SHORT}"
}
}
job "docker-release" {
template = "docker"
env = {
"TAG" = "${env.GIT_TAG}"
}
condition = "GIT_BRANCH='master' and GIT_TAG!=''"
}
job "all" {
deps = ["build", "docker", "docker-release"]
shell = "echo all"
engine = "local"
}