diff --git a/CHANGES b/CHANGES index f351a0d..cb16e5a 100644 --- a/CHANGES +++ b/CHANGES @@ -2,3 +2,7 @@ - archived old readme and dev environment files (moved in attic) - build from sources compiling the cli (updated the README.md) + +# sciabarracom 3 May 2026 +- `Taskfile.yml` for building the operator +- `test.sh` for a smoke test \ No newline at end of file diff --git a/README.md b/README.md index da673cb..34b1ac0 100644 --- a/README.md +++ b/README.md @@ -8,39 +8,47 @@ Welcome to [Apache OpenServerless](https://openserverless.apache.org), an incu - If you want to **discuss** with us, join our mailing list sending an email to `dev-subscribe@openserverless.apache.org` - If you want to **locally install** open serverless from sources test or development, read on. -# Build from sources +# Build and test from sources ## Prerequisites - you need an Unix environment, either OSX, Linux or Windows WSL. -- you need docker availabe on the path +- you need docker on the path - you need go available on the path +- you need task (https://taskfile.dev) available in the path ## Procedure -Clone all the modules and submodules recursively: +### 1. Get the sources -1. `git clone https://github.com/apache/openserverless --recurse-submodules` +Clone all the modules and submodules recursively -2. build ops running `./build.sh` +`git clone https://github.com/apache/openserverless --recurse-submodules` -3. check ops works executing `./ops -info` +### 2. Build -verify that OPS_ROOT is equals to $PWD/olaris, so you can use the tasks from sources +First clean everything -then execute `./ops -t` +`task clean` -you should see somethin like this (files and version may vary) +then build: -``` -ensuring prerequisite coreutils 0.0.27 -ensuring prerequisite bun 1.2.5 -ensuring prerequisite kubectl 1.33.1 -``` +`task build` -4. install openserverless in docker with +This will +- build the cli +- build the operator image +TODO: build the runtimes + +3. Smoke test + +Execute a basic smoke test + +`bash smoke.sh` + +4. More tests + +TODO: execute locally the full test suite under ./testing -`./ops setup mini` -If everything works you end up with a running openserverless in docker diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..9b35192 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,89 @@ +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}}" + + OPERATOR_TGT: + sh: | + B64="$(echo {{.OPERATOR_SRC}} | /usr/bin/base64 -w0 )" + echo ~/.ops/{{OS}}-{{ARCH}}/images/kind/$B64 + +tasks: + + default: task -l + + clean: + desc: clean the intermediate artifacts + cmds: + - rm -vf ./ops ~/.ops/{{OS}}-{{ARCH}}/images/kind/* + + build: + desc: build all + cmds: + - task: cli + - task: operator + - task: opsroot + + + image-save: + desc: save an a SRC image in the TGT file + requires: { vars: [SRC, TGT]} + cmds: + - docker save {{.SRC}} -o {{.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 + - echo Saving {{.OPERATOR_TGT}} + - task: image-save + vars: + SRC: "{{.OPERATOR_SRC}}" + TGT: "{{.OPERATOR_TGT}}" + status: + - ! test -e "{{.OPERATOR_TGT}}" + + + opsroot: + desc: build current opsroot.json + dir: olaris + cmds: + - test -e opsroot.orig || jq . opsroot.orig + - > + jq opsroot.json ' + .config.images = {} | + .config.images.operator = "{{.OPERATOR_SRC}}" + ' + - diff opsroot.orig opsroot.json || true + + runtimes: + desc: build current runtimes.json + dir: olaris + cmds: + - test -e runtimes.orig || jq . runtimes.orig + - > + jq runtimes.json ' + .runtimes = {} | + .blackboxes = {} + ' + - diff runtimes.orig runtimes.json || true diff --git a/build.sh b/build.sh deleted file mode 100644 index 20ad74d..0000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -cd cli -go build -o ../ops cmd/ops/main.go -cd .. \ No newline at end of file diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..ba7127c --- /dev/null +++ b/test.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -euo pipefail + +echo Checking prerequisites +test -e ./ops +which docker + +echo Cleaning everything +docker rm -f nuvolaris-control-plane + +echo Creating Kind Cluster +./ops setup docker create + +echo Checking Images +./ops util fr kind-list | grep apache/openserverless + +echo Deploying the operator + +./ops setup kubernetes permission +./ops setup kubernetes pre-deploy +./ops setup kubernetes operator + +echo Wait until the operator is up-and-running +./ops setup kubernetes wait OBJECT=po/nuvolaris-operator-0 COND=true