blob: c0be83192e345919760131a147f51062a9d9dc75 [file]
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}}"
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}}"
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}}"
'
- diff opsroot.orig opsroot.json || true
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
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)
build:
desc: build all
cmds:
- task: cli
- task: operator
- task: runtimes
- task: streamer
- task: admin-api
- task: opsroot
- task: runtimes
setup:
desc: setup
cmds:
- |
export PATH="$PWD:$PATH"
ops setup mini