| # 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' |
| |
| tasks: |
| get-tokens: |
| desc: "Get Service Account tokens and save them to tokens directory" |
| silent: true |
| cmds: |
| - mkdir -p tokens |
| - rm -f tokens/token && kubectl -n nuvolaris exec -it nuvolaris-operator-0 -- cat /var/run/secrets/kubernetes.io/serviceaccount/token > tokens/token |
| - rm -f tokens/ca.crt && kubectl -n nuvolaris exec -it nuvolaris-operator-0 -- cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt > tokens/ca.crt |
| |
| setup-developer: |
| desc: "Setup developer environment" |
| silent: false |
| vars: |
| REGISTRY_PASS: |
| sh: ops util kubectl -- -n nuvolaris get cm/config -o jsonpath='{.metadata.annotations.registry_password}' |
| COUCHDB_PASS: |
| sh: ops util kubectl -- -n nuvolaris get whisk -o jsonpath='{.items[0].spec.couchdb.admin.password}' |
| KUB_SERVICE_PORT: |
| sh: "docker port nuvolaris-control-plane | grep 6443 | cut -d: -f2" |
| cmds: |
| - task: get-tokens |
| - | |
| if [ ! -f .env ]; |
| then cp .env.example .env |
| echo "Please edit .env file with your local CouchDB and Kubernetes credentials" |
| fi |
| - | |
| if [ ! -d .venv ]; |
| then uv venv |
| fi |
| - uv pip install -r pyproject.toml 2>/dev/null |
| - sed -i '' 's/^KUBERNETES_SERVICE_PORT=.*/KUBERNETES_SERVICE_PORT={{.KUB_SERVICE_PORT}}/' .env |
| - sed -i '' 's/^REGISTRY_PASS=.*/REGISTRY_PASS={{.REGISTRY_PASS}}/' .env |
| - sed -i '' 's/^COUCHDB_ADMIN_PASSWORD=.*/COUCHDB_ADMIN_PASSWORD={{.COUCHDB_PASS}}/' .env |
| - task: setup-secret |
| |
| setup-secret: |
| desc: "Create docker-registry secret for development using credentials from .env" |
| dotenv: ['.env'] |
| cmds: |
| - kubectl delete secret registry-pull-secret-dev -n nuvolaris 2>/dev/null || true |
| - kubectl create secret docker-registry registry-pull-secret-dev -n nuvolaris --docker-server=${REGISTRY_HOST} --docker-username=${REGISTRY_USER} --docker-password=${REGISTRY_PASS} |
| - echo "Secret 'registry-pull-secret-dev' created successfully in namespace 'nuvolaris'" |
| - ops env add REGISTRY_SECRET=registry-pull-secret-dev |
| - echo "Environment variable REGISTRY_SECRET set to 'registry-pull-secret-dev'" |
| - | |
| if ops env list | rg REGISTRY_SECRET > /dev/null 2>&1; then |
| echo "✓ Verified: REGISTRY_SECRET is configured" |
| ops env list | rg REGISTRY_SECRET |
| else |
| echo "⚠ Warning: REGISTRY_SECRET not found in ops env list" |
| fi |
| |
| run: |
| desc: | |
| Run the admin api locally, using configuration from .env file |
| cmds: |
| - uv run -m openserverless |