You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openserverless.apache.org by ms...@apache.org on 2025/08/16 09:13:16 UTC
(openserverless-task) 02/03: other bug fixes
This is an automated email from the ASF dual-hosted git repository.
msciabarra pushed a commit to branch fix-spaces-in-windows
in repository https://gitbox.apache.org/repos/asf/openserverless-task.git
commit 52f6b34a2f4085bd50aa9362de5636d6dc625ccb
Author: Michele Sciabarra <mi...@nuvolaris.io>
AuthorDate: Sat Aug 16 10:02:35 2025 +0200
other bug fixes
---
prereq.yml | 2 +-
setup/kubernetes/opsfile.yml | 70 +++++++++++++++++++++---------------
setup/nuvolaris/opsfile.yml | 20 ++++++++---
setup/nuvolaris/streamer/opsfile.yml | 28 ++++++++++-----
setup/opsfile.yml | 2 +-
5 files changed, 79 insertions(+), 43 deletions(-)
diff --git a/prereq.yml b/prereq.yml
index 181afa5..172ef88 100644
--- a/prereq.yml
+++ b/prereq.yml
@@ -96,7 +96,7 @@ tasks:
kubectl:
desc: download kubectl
vars:
- VERSION: 1.30.3
+ VERSION: 1.33.1
cmds:
- task: download
vars:
diff --git a/setup/kubernetes/opsfile.yml b/setup/kubernetes/opsfile.yml
index de61cde..2de3099 100644
--- a/setup/kubernetes/opsfile.yml
+++ b/setup/kubernetes/opsfile.yml
@@ -25,8 +25,8 @@ vars:
env:
KUBECONFIG:
sh: |-
- if test -e "$OPS_TMP/kubeconfig"
- then echo "$OPS_TMP/kubeconfig"
+ if test -e "$OPS_TMP{{if eq .OS "windows"}}\{{else}}/{{end}}kubeconfig"
+ then echo "$OPS_TMP{{if eq .OS "windows"}}\{{else}}/{{end}}kubeconfig"
else echo ~/.kube/config
fi
@@ -111,7 +111,7 @@ tasks:
echo "=== Nodes"
kubectl -n nuvolaris get no
echo "=== kubectl version"
- kubectl version --short 2>/dev/null
+ kubectl version
crd:
#desc get crd
@@ -119,34 +119,42 @@ tasks:
cmds:
- kubectl get wsk/controller -n nuvolaris -o yaml
+
wait:
#desc: wait for an object to reach a condition
silent: true
+ status:
+ - test "{{.COND}}" != "true"
+ env:
+ BAR:
+ sh: printf "%*s" {{.RETRY}} "" | tr ' ' '#'
cmds:
- test -n "{{.OBJECT}}" || die "use OBJECT=<to-wait-for>"
- |
N=0
RES=false
while [[ $N -lt {{.RETRY}} ]]
- do echo "$((N++)) waiting for {{.OBJECT}}"
- if kubectl -n nuvolaris get {{.OBJECT}} 2>/dev/null
+ do printf "\rwaiting for {{.OBJECT}} available: [${BAR:0:$((N++))}]"
+ if kubectl -n nuvolaris get "{{.OBJECT}}" >/dev/null 2>&1
then RES=true ; break
fi
sleep {{.TIMEOUT}}
done
+ printf "\n"
$RES
- |
N=0
RES=false
while [[ $N -lt {{.RETRY}} ]]
do
- echo "$((N++)) waiting for {{.OBJECT}} ready"
- if kubectl -n nuvolaris wait --for=condition=Ready {{.OBJECT}} --timeout={{.TIMEOUT}} 2>/dev/null
+ printf "\rwaiting for {{.OBJECT}} ready: [${BAR:0:$((N++))}]"
+ if kubectl -n nuvolaris wait --for=condition=Ready "{{.OBJECT}}" --timeout={{.TIMEOUT}} >/dev/null 2>&1
then RES=true ; break
fi
done
+ printf "\n"
$RES
-
+
context:
desc: select the context to use
silent: true
@@ -215,6 +223,7 @@ tasks:
- task: wait
vars:
OBJECT: pod/nuvolaris-operator-0
+ COND: trues
whiskcrd:
silent: true
@@ -239,38 +248,43 @@ tasks:
- ops setup kubernetes whiskcrd
#- cat _whisk.yaml
- |
-
kubectl apply -f _whisk.yaml
- task: wait
vars:
OBJECT: pod/couchdb-0
+ COND: true
- task: wait
vars:
OBJECT: pod/controller-0
+ COND: true
+
services:
silent: true
- #desc: wait for active services
+ desc: wait for active services
cmds:
- echo "Check for active services...."
- - |
- if test "$OPERATOR_COMPONENT_REDIS" == "true"
- then $OPS setup kubernetes wait OBJECT=po/redis-0
- fi
- - |
- if test "$OPERATOR_COMPONENT_MONGODB" == "true"
- then $OPS setup kubernetes wait OBJECT=po/nuvolaris-mongodb-0
- fi
- - |
- if test "$OPERATOR_COMPONENT_MINIO" == "true"
- then POD="$(kubectl -n nuvolaris get po -l app=minio -o jsonpath='{.items[0].metadata.name}')"
- $OPS setup kubernetes wait OBJECT=pod/$POD
- fi
- - |
- if test "$OPERATOR_COMPONENT_POSTGRES" == "true"
- then
- $OPS setup kubernetes wait OBJECT=pod/nuvolaris-postgres-1-0
- fi
+ - task: wait
+ vars:
+ OBJECT: po/redis-0
+ COND:
+ sh: echo "$OPERATOR_COMPONENT_REDIS"
+ - task: wait
+ vars:
+ OBJECT: po/nuvolaris-mongodb-0
+ COND:
+ sh: echo "$OPERATOR_COMPONENT_MONGODB"
+ - task: wait
+ vars:
+ OBJECT:
+ sh: echo "pod/$(kubectl -n nuvolaris get po -l app=minio -o jsonpath='{.items[0].metadata.name}')"
+ COND:
+ sh: echo "$OPERATOR_COMPONENT_MINIO"
+ - task: wait
+ vars:
+ OBJECT: pod/nuvolaris-postgres-1-0
+ COND:
+ sh: echo "$OPERATOR_COMPONENT_POSTGRES"
create:
silent: true
diff --git a/setup/nuvolaris/opsfile.yml b/setup/nuvolaris/opsfile.yml
index a018d1f..b26d2bc 100644
--- a/setup/nuvolaris/opsfile.yml
+++ b/setup/nuvolaris/opsfile.yml
@@ -32,7 +32,7 @@ env:
KUBECONFIG:
sh: |
if test -e $OPS_TMP/kubeconfig
- then echo $OPS_TMP/kubeconfig
+ then echo $OPS_TMP/kubeconfig
else echo ~/.kube/config
fi
@@ -41,6 +41,9 @@ tasks:
wait:
#desc: wait for apihost available
silent: true
+ env:
+ BAR:
+ sh: printf "%*s" {{.RETRY}} "" | tr ' ' '#'
cmds:
- |
N=0
@@ -51,14 +54,18 @@ tasks:
if [[ "$APIHOST" != "" ]] && [[ "$HOST" != "//pending" ]]
then break
fi
- echo "$((N++))... waiting for APIHOST ready"
+ printf "\rwaiting for APIHOST ready: [${BAR:0:$((N++))}]"
sleep 5
done
+ printf "\n"
echo $APIHOST
wait-cm:
desc: wait for an annotation in nuvolaris cm/config
silent: true
+ env:
+ BAR:
+ sh: printf "%*s" {{.RETRY}} "" | tr ' ' '#'
cmds:
- test -n "{{.JSONPATH}}" || die "use JSONPATH=<cm/config-jsonpath-lookup>"
- |
@@ -69,17 +76,21 @@ tasks:
ANNOT_VALUE="$(kubectl -n nuvolaris get cm/config -o jsonpath='{{.JSONPATH}}')"
if [[ -z "$ANNOT_VALUE" ]]
then
- echo "$((N++)) Waiting for annotations {{.JSONPATH}} to be set"
+ printf "\rwaiting for completing system initialization: [${BAR:0:$((N++))}]"
sleep 5
else
RES=true; break
fi
done
+ printf "\n"
$RES
wait-cm-value:
desc: wait for an annotation in nuvolaris cm/config to be set and have a specific value
silent: true
+ env:
+ BAR:
+ sh: printf "%*s" {{.RETRY}} "" | tr ' ' '#'
cmds:
- test -n "{{.JSONPATH}}" || die "use JSONPATH=<cm/config-jsonpath-lookup>"
- test -n "{{.EXPECTED_VALUE}}" || die "use EXPECTED_VALUE=<value>"
@@ -94,12 +105,13 @@ tasks:
ANNOT_VALUE="$(kubectl -n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.system_action_status}')"
if [[ -z "$ANNOT_VALUE" ]]
then
- echo "$((N++)) Waiting for annotations {{.JSONPATH}} to be set"
+ printf "\rwaiting for completing system initialization: [${BAR:0:$((N++))}]"
sleep 5
else
test "$ANNOT_VALUE" = "{{.EXPECTED_VALUE}}" && RES=true || RES=false
break
fi
+ printf "\n"
done
$RES
diff --git a/setup/nuvolaris/streamer/opsfile.yml b/setup/nuvolaris/streamer/opsfile.yml
index 3379445..a1152ea 100644
--- a/setup/nuvolaris/streamer/opsfile.yml
+++ b/setup/nuvolaris/streamer/opsfile.yml
@@ -16,7 +16,7 @@
# under the License.
version: '3'
-vars:
+vars:
VAR: ""
MSG: ""
VAL: ""
@@ -27,9 +27,13 @@ vars:
env:
KUBECONFIG:
- sh: |
- if test -e "$OPS_TMP/kubeconfig"
- then echo "$OPS_TMP/kubeconfig"
+ sh: |-
+ #if test -e "${OPS_TMP//\\//}/kubeconfig"
+ #then echo "${OPS_TMP//\\//}/kubeconfig"
+ #else echo ~/.kube/config
+ #fi
+ if test -e ~/.ops/tmp/kubeconfig
+ then echo ~/.ops/tmp/kubeconfig
else echo ~/.kube/config
fi
@@ -42,23 +46,29 @@ env:
HOST=$(ops util kubectl -- -n nuvolaris get ingress/apihost -o jsonpath='{.spec.rules[0].host}')
if [ $OPERATOR_COMPONENT_INVOKER = true ];
then echo "$HOST"
- else echo "http://controller:3233"
- fi
+ else echo "http://controller:3233"
+ fi
INGRESS_TYPE:
sh: ops util ingress-type
tasks:
+
+ boh:
+ desc: echo a message
+ silent: true
+ cmds:
+ - echo "$host.Name"
deploy:
- silent: true
+ silent: false
ignore_error: false
desc: deploy the streamer
cmds:
- test -e ${INGRESS_TYPE}-template.yaml || die "No avalable template for ingress type ${INGRESS_TYPE}."
- test -n "$IMAGES_STREAMER" || die "IMAGES_STREAMER is not set. Please set it to the desired image version."
- envsubst -i streamer-template.yaml -o _streamer.yaml > /dev/null 2>&1
- - envsubst -i ${INGRESS_TYPE}-template.yaml -o _ingress.yaml > /dev/null 2>&1
+ - envsubst -i "${INGRESS_TYPE}-template.yaml" -o _ingress.yaml > /dev/null 2>&1
- kubectl -n nuvolaris apply -f _streamer.yaml
#- cat _ingress.yaml
- kubectl -n nuvolaris apply -f _ingress.yaml
@@ -86,6 +96,6 @@ tasks:
env:
CURRENT_STREAMER_VERSION:
sh: |
- echo $(kubectl -n nuvolaris get pod/nuvolaris-streamer-api-0 -ojsonpath='{.spec.containers[0].image}')
+ echo "$(kubectl -n nuvolaris get pod/nuvolaris-streamer-api-0 -ojsonpath='{.spec.containers[0].image}')"
diff --git a/setup/opsfile.yml b/setup/opsfile.yml
index 16985b5..44a1512 100644
--- a/setup/opsfile.yml
+++ b/setup/opsfile.yml
@@ -92,7 +92,7 @@ tasks:
then
if curl -sL http://miniops.me >/dev/null 2>/dev/null
then
- if curl -sL http://miniops.me/api/info 2>/dev/null | jq -r .description | rg OpenWhisk >/dev/null 2>/dev/null
+ if curl -sL http://miniops.me/api/info 2>/dev/null | jq -r .description 2>/dev/null | rg OpenWhisk >/dev/null 2>/dev/null
then
echo "*** Apache OpenServerless mini is already installed."
echo "*** Login with: ops ide login devel http://miniops.me"