blob: 69ba9aaced33e0a84488d959f13e4f189d00391b [file]
# 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'
dotenv:
- .env
vars:
BASETAG: 3.1.0-ops-incubating
TAG:
sh: git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD
GHUSER:
sh: echo "${GITHUB_USER:-francescotimperi}"
CONTROLLER_IMAGE: ghcr.io/{{.GHUSER}}/openwhisk2-controller
INVOKER_IMAGE: ghcr.io/{{.GHUSER}}/openwhisk2-invoker
SCHEDULER_IMAGE: ghcr.io/{{.GHUSER}}/openwhisk2-scheduler
STANDALONE_IMAGE: ghcr.io/{{.GHUSER}}/openwhisk2-standalone
COMMON_IMAGE: ghcr.io/{{.GHUSER}}/openwhisk2-common
ACT: "nothing"
S: ""
tasks:
default:
- task --list-all
setup:
silent: true
image-tag:
- git tag -d $(git tag)
- git tag -f {{.BASETAG}}.$(date +%y%m%d%H%M){{.S}}
- task show
show:
silent: true
cmds:
- echo "tag:" {{.TAG}}
- echo "common:" {{.COMMON_IMAGE}}:{{.TAG}}
- echo "controller:" ${MY_CONTROLLER_IMAGE:-{{.CONTROLLER_IMAGE}}}:{{.TAG}}
- echo "invoker:" ${MY_INVOKER_IMAGE:-{{.INVOKER_IMAGE}}}:{{.TAG}}
- echo "scheduler:" ${MY_SCHEDULER_IMAGE:-{{.INVOKER_IMAGE}}}:{{.TAG}}
- echo "standalone:" ${MY_STANDALONE_IMAGE:-{{.STANDALONE_IMAGE}}}:{{.TAG}}
compile:controller:
dir: openwhisk
cmds:
- ./gradlew :core:controller:distTar
status:
- test -f core/controller/build/distributions/controller.tar
compile:invoker:
dir: openwhisk
cmds:
- ./gradlew :core:invoker:distTar
status:
- test -f core/invoker/build/distributions/invoker.tar
compile:scheduler:
dir: openwhisk
cmds:
- ./gradlew :core:scheduler:distTar
status:
- test -f core/scheduler/build/distributions/scheduler.tar
compile:standalone:
dir: openwhisk
cmds:
- ./gradlew :core:standalone:build
- mkdir -p ../standalone/lib
- cp bin/openwhisk-standalone.jar ../standalone/lib/
status:
- test -f ../standalone/lib/openwhisk-standalone.jar
native:standalone-libs:
dir: openwhisk
cmds:
- ./gradlew core:standalone:copyRuntimeLibs
native:standalone-build:
deps:
- compile:standalone
- native:standalone-libs
dir: openwhisk/core/standalone
cmds:
- native-image
--initialize-at-run-time=io.netty
--no-fallback --report-unsupported-elements-at-runtime
--trace-object-instantiation=ch.qos.logback.classic.Logger
--enable-url-protocols=http,https
-cp build/classes/scala/main:build/resources/main:build/dependency-libs/*
-H:ConfigurationFileDirectories=/workspaces/openserverless-controller/standalone/graal-config
-o /workspaces/openserverless-controller/standalone/exe/openwhisk-standalone.exe
org.apache.openwhisk.standalone.StandaloneOpenWhisk
native:standalone-run:
dir: standalone/exe
cmds:
- ./openwhisk-standalone.exe -Dwhisk.standalone.host.name="0.0.0.0" -Dwhisk.standalone.host.internal="$(hostname -f)" --no-browser --disable-color-logging
native:standalone-config:
deps:
- compile:standalone
dir: openwhisk/core/standalone
cmds:
- java -agentlib:native-image-agent=config-output-dir=../../standalone/graal-config
-cp build/classes/scala/main:build/resources/main:build/dependency-libs/*
-Dwhisk.standalone.host.name="0.0.0.0"
-Dwhisk.standalone.host.internal="$(hostname -f)"
org.apache.openwhisk.standalone.StandaloneOpenWhisk
clean:
ignore_error: true
cmds:
- rm standalone/lib/openwhisk-standalone.jar
- rm openwhisk/core/invoker/build/distributions/invoker.tar
- rm openwhisk/core/controller/build/distributions/controller.tar
- rm openwhisk/core/scheduler/build/distributions/scheduler.tar
- docker buildx rm openserverless
compile:
- task: compile:controller
- task: compile:invoker
- task: compile:scheduler
- task: compile:standalone
docker-setup:
- docker run -it --rm --userns=host --privileged tonistiigi/binfmt --install all
- docker buildx create --name openserverless
- docker buildx use openserverless
docker-login: >
echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_USER --password-stdin
# this requires ACT IMG and DIR parameters to be passed
docker-build:
silent: true
cmds:
- |-
echo "***" {{.ACT}} for {{.IMG}} in {{.DIR}}
case "{{.ACT}}" in
(build)
docker build {{.DIR}} -t {{.IMG}} --build-arg OW_BASE_IMAGE={{.BASE}} --push
;;
(buildx)
docker buildx build --platform linux/amd64,linux/arm64 --build-arg OW_BASE_IMAGE={{.BASE}} -t {{.IMG}} {{.DIR}}
;;
(buildx-push)
docker buildx build --platform linux/amd64,linux/arm64 --build-arg OW_BASE_IMAGE={{.BASE}} -t {{.IMG}} {{.DIR}} --push
;;
(*) echo ACT must be "build|buildx|buildx-push"
esac
build:scala:
cmds:
- task: docker-build
vars:
DIR: openwhisk/common/scala
IMG: "{{.COMMON_IMAGE}}:{{.TAG}}"
ACT: '{{.ACT}}'
BASE: "{{.COMMON_IMAGE}}:latest" # not used
- docker tag {{.COMMON_IMAGE}}:{{.TAG}} scala:latest
build:controller:
deps:
- compile:controller
cmds:
- task: docker-build
vars:
DIR: openwhisk/core/controller
IMG: "${MY_CONTROLLER_IMAGE:-{{.CONTROLLER_IMAGE}}}:{{.TAG}}"
ACT: '{{.ACT}}'
BASE: "{{.COMMON_IMAGE}}:latest"
build:invoker:
deps:
- compile:invoker
cmds:
- task: docker-build
vars:
DIR: openwhisk/core/invoker
IMG: "${MY_INVOKER_IMAGE:-{{.INVOKER_IMAGE}}}:{{.TAG}}"
ACT: '{{.ACT}}'
BASE: "{{.COMMON_IMAGE}}:latest"
build:scheduler:
deps:
- compile:scheduler
cmds:
- task: docker-build
vars:
DIR: openwhisk/core/scheduler
IMG: "${MY_SCHEDULER_IMAGE:-{{.SCHEDULER_IMAGE}}}:{{.TAG}}"
ACT: '{{.ACT}}'
BASE: "{{.COMMON_IMAGE}}:latest"
build:standalone:
deps:
- compile:standalone
cmds:
- task: docker-build
vars:
DIR: standalone
IMG: "${MY_STANDALONE_IMAGE:-{{.STANDALONE_IMAGE}}}:{{.TAG}}"
ACT: '{{.ACT | or "build"}}'
BASE: "{{.COMMON_IMAGE}}:latest"
build-all:
cmds:
- task: build:scala
vars:
ACT: "build"
- task: build:controller
vars:
ACT: "build"
- task: build:invoker
vars:
ACT: "build"
- task: build:scheduler
vars:
ACT: "build"
- task: build:standalone
vars:
ACT: "build"
buildx-and-push:
- task: build:scala
vars:
ACT: "buildx-push"
- task: build:controller
vars:
ACT: "buildx-push"
- task: build:invoker
vars:
ACT: "buildx-push"
- task: build:scheduler
vars:
ACT: "buildx-push"
- task: build:standalone
vars:
ACT: "buildx-push"
distdocker:
dir: openwhisk
cmds:
- ./gradlew distDocker -PdockerRegistry={{.DOCKER_REGISTRY}} -PdockerImagePrefix=openwhisk2 -PdockerImageTag={{.TAG}} -PdockerMultiArchBuild=true