Improve archive package user experience (#927)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
def main():
|
||||
return "hello\n"
|
||||
Executable
+44
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
fn=spec-$(date +%N)
|
||||
env=python-$fn
|
||||
|
||||
# init
|
||||
fission spec init
|
||||
|
||||
# verify init
|
||||
[ -d specs ]
|
||||
[ -f specs/README ]
|
||||
[ -f specs/fission-deployment-config.yaml ]
|
||||
|
||||
fission env create --spec --name $env --image fission/python-env
|
||||
|
||||
log "create env spec"
|
||||
fission spec apply
|
||||
trap "fission spec destroy" EXIT
|
||||
|
||||
log "verify env created"
|
||||
fission env list | grep python
|
||||
|
||||
log "generate function spec"
|
||||
fission fn create --spec --name $fn --env $env --code hello.py
|
||||
|
||||
|
||||
[ -f specs/function-$fn.yaml ]
|
||||
grep ArchiveUploadSpec specs/*.yaml
|
||||
grep Package specs/*.yaml
|
||||
grep Function specs/*.yaml
|
||||
|
||||
log "Apply specs"
|
||||
fission spec apply
|
||||
trap "fission fn delete --name $fn" EXIT
|
||||
|
||||
log "verify function exists"
|
||||
fission fn list | grep $fn
|
||||
|
||||
sleep 3
|
||||
|
||||
log "Test the function"
|
||||
fission fn test --name $fn | grep -i hello
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT=$(dirname $0)/../../..
|
||||
|
||||
fn=spec-$(date +%N)
|
||||
env=python-$fn
|
||||
|
||||
pushd $ROOT/examples/python
|
||||
|
||||
fission spec init
|
||||
|
||||
log "Creating environment spec"
|
||||
fission env create --spec --name $env --image fission/python-env --builder fission/python-builder
|
||||
fission env list | grep python
|
||||
|
||||
log "Creating function spec"
|
||||
fission fn create --spec --name $fn --env $env --deploy "multifile/*" --entrypoint main.main
|
||||
|
||||
log "Applying specs"
|
||||
fission spec apply
|
||||
|
||||
log "Checking function's existance"
|
||||
fission fn list | grep $fn
|
||||
|
||||
log "Testing function"
|
||||
fission fn test --name $fn | grep -i hello
|
||||
|
||||
log "Destroying spec objects"
|
||||
fission spec destroy
|
||||
popd
|
||||
Reference in New Issue
Block a user