-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskfileDev.yml
More file actions
78 lines (73 loc) · 3.33 KB
/
TaskfileDev.yml
File metadata and controls
78 lines (73 loc) · 3.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# 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