-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathTaskfile.yml
More file actions
223 lines (197 loc) · 6.19 KB
/
Copy pathTaskfile.yml
File metadata and controls
223 lines (197 loc) · 6.19 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
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
version: 3
vars:
OPERATOR_IMG:
sh: awk -F= '/ARG OPERATOR_IMAGE_DEFAULT=/ { print $2 ; exit }' olaris-op/Dockerfile
OPERATOR_TAG:
sh: git -C olaris-op rev-parse --short HEAD
OPERATOR_SRC: "{{.OPERATOR_IMG}}:{{.OPERATOR_TAG}}"
STREAMER_TAG: "{{.OPERATOR_TAG}}"
STREAMER_SRC: "docker.io/apache/openserverless-streamer:{{.STREAMER_TAG}}"
ADMIN_API_TAG: "{{.OPERATOR_TAG}}"
ADMIN_API_SRC: "docker.io/apache/openserverless-admin-api:{{.ADMIN_API_TAG}}"
RUNTIMES_TAG: "{{.OPERATOR_TAG}}"
OPENSERVERLESS_TAG: "{{.OPERATOR_TAG}}"
CONTROLLER_SRC: "docker.io/apache/openserverless-wsk-invoker:{{.OPENSERVERLESS_TAG}}"
INVOKER_SRC: "docker.io/apache/openserverless-wsk-controller:{{.OPENSERVERLESS_TAG}}"
OPS_BRANCH: "{{.OPERATOR_TAG}}"
CMD: "check"
tasks:
default: task -l
clean:
desc: clean the intermediate artifacts
cmds:
- rm -vf ./ops ~/.ops/{{OS}}-{{ARCH}}/images/kind/*
- rm -vf ./ops
image-save:
desc: save an a SRC image in the TGT file
requires: { vars: [SRC]}
env:
TGT:
sh: |
B64="$(echo -n {{.SRC}} | /usr/bin/base64 -w0)"
echo ~/.ops/{{OS}}-{{ARCH}}/images/kind/$B64
cmds:
- echo Saving {{.SRC}} in "$TGT"
- mkdir -p "$(dirname $TGT)"
- docker save {{.SRC}} -o "$TGT"
status:
- ! test -e "$TGT"
cli:
desc: build the cli
dir: cli
cmds:
- go build -o ../ops cmd/ops/main.go
status:
- ! test -e ../ops
operator:
desc: build the operator
deps:
- cli
dir: olaris-op
cmds:
- echo Building {{.OPERATOR_SRC}}
- git tag -d $(git tag) && git tag {{.OPERATOR_TAG}}
- task b:build
- task: image-save
vars:
SRC: "{{.OPERATOR_SRC}}"
streamer:
desc: build the streamer
deps:
- cli
dir: streamer
cmds:
- echo Building {{.STREAMER_SRC}}
- git tag -d $(git tag) && git tag {{.STREAMER_TAG}}
- echo -e "NAMESPACE=apache\nREGISTRY=dockerhub\n" >.env
- task buildx
- task: image-save
vars:
SRC: "{{.STREAMER_SRC}}"
admin-api:
desc: build the admin-api
deps:
- cli
dir: admin-api
cmds:
- echo Building {{.ADMIN_API_SRC}}
- git tag -d $(git tag) && git tag {{.STREAMER_TAG}}
- echo -e "NAMESPACE=apache\nREGISTRY=dockerhub\n" >.env
- task buildx
- task: image-save
vars:
SRC: "{{.ADMIN_API_SRC}}"
openserverless:
desc: build openserverless
dir: build
env:
PATH: "{{.TASKFILE_DIR}}:$PATH"
OPS_ROOT: "{{.TASKFILE_DIR}}"
cmds:
- echo Building OpenServerless
- git tag -d $(git tag) && git tag {{.OPENSERVERLESS_TAG}}
- |
export PATH="{{.TASKFILE_DIR}}:$PATH"
export OPS_ROOT="{{.TASKFILE_DIR}}/olaris"
task build-all
- task: image-save
vars:
SRC: "{{.CONTROLLER_SRC}}"
- task: image-save
vars:
SRC: "{{.INVOKER_SRC}}"
runtimes:
desc: build current runtimes.json
dir: runtimes
cmds:
- git tag -d $(git tag) && git tag {{.RUNTIMES_TAG}}
- task build-common
- task build
- task render-runtimes
- cp runtimes.json ../olaris/runtimes.json
- task: runtimes-save
runtimes-save:
desc: save runtimes images
dir: runtimes
vars:
IMAGES:
sh: jq -r '.runtimes[][] | select(.default == true) | "\(.image.prefix)/\(.image.name):\(.image.tag)"' runtimes.json | grep -v php
cmds:
- for: { var: IMAGES, split: "\n", as: IMG }
task: image-save
vars:
SRC: "docker.io/{{.IMG}}"
TGT:
sh: echo ~/.ops/{{OS}}-{{ARCH}}/images/kind/$(echo docker.io/{{.IMG}} | /usr/bin/base64 -w0)
opsroot:
desc: build current opsroot.json
dir: olaris
cmds:
- test -e opsroot.orig || jq . <opsroot.json >opsroot.orig
- >
jq <opsroot.orig >opsroot.json '
.config.images.operator = "{{.OPERATOR_SRC}}" |
.config.images.streamer = "{{.STREAMER_SRC}}" |
.config.images.systemapi = "{{.ADMIN_API_SRC}}" |
.config.images.controller = "{{.CONTROLLER_SRC}}" |
.config.images.invoker = "{{.INVOKER_SRC}}"
'
- diff opsroot.orig opsroot.json || true
opslink:
desc: link ops
cmds:
- task: cli
- mkdir -p ~/.local/bin ~/.ops/{{.OPS_BRANCH}}
- ln -sf $(pwd)/ops ~/.local/bin/ops
- ln -sf $(pwd)/olaris ~/.ops/{{.OPS_BRANCH}}/olaris
build:
desc: build all
cmds:
- task: opslink
- task: openserverless
- task: operator
- task: runtimes
- task: streamer
- task: admin-api
- task: opsroot
test:
desc: create
dir: testing/tests
cmds:
- |
export PATH="{{.TASKFILE_DIR}}:$PATH"
export OPS_ROOT="{{.TASKFILE_DIR}}/olaris"
export OPS_BRANCH="{{.OPS_BRANCH}}"
which ops
ops -info
./all.sh kind
license:
silent: true
desc: check license headers
cmds:
- |
license-eye header {{.CMD}}
for i in */.licenserc.yaml
do
DIR=$(dirname $i)
echo "*** Checking license headers in $DIR"
cd $DIR
license-eye header {{.CMD}}
cd {{.TASKFILE_DIR}}
done