Improve archive package user experience (#927)

This commit is contained in:
Vishal
2018-11-29 23:00:38 +08:00
committed by Ta-Ching Chen
parent 7cedf8d580
commit 19b52938c3
10 changed files with 235 additions and 110 deletions
+2
View File
@@ -0,0 +1,2 @@
def main():
return "hello\n"
+44
View File
@@ -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
+32
View File
@@ -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