A lot of times you may want a "scratch" container to run some scripts or experiment with different commands but without affecting your local machine or consuming its resources. If you have a Kubernetes cluster, you can use following commands to do so quickly:
kwt workspace create -i mydir=. -c './mydir/script.sh' --rm
# or kwt w c ... for short
Above command used --input
(-i
) to upload local current directory.
Alterntaively if you want empty container with a shell:
kwt workspace create
# ...snip... obtain workspace name
kwt workspace enter -w <some-name>
# or
kwt workspace create --enter
In some cases you may want to run additional scripts in an existing workspaces:
kwt workspace ls
kwt workspace run -w <some-name> -i kwt=.:gopath/src/github.com/carvel-dev/kwt -c './gopath/src/github.com/carvel-dev/kwt/ci/unit-tests.sh'
Once done, delete your workspace
kwt workspace delete -w <some-name>
# Upload current directory to /tmp/build/x/kwt
kwt w s -i kwt=.
# Upload current directory to /tmp/build/x/kwt/gopath/src/github.com/carvel-dev/kwt
kwt w s -i kwt=.:gopath/src/github.com/carvel-dev/kwt
# Upload current directory to remote abs path /tmp/kwt
kwt w s -i kwt=.:/tmp/kwt
# Download /tmp/build/x/kwt to current directory
kwt w s -o kwt=.
# Download gopath/src/github.com/carvel-dev/kwt to current directory
kwt w s -o kwt=.:gopath/src/github.com/carvel-dev/kwt
# Download /tmp/build/x/kwt to /tmp/kwt
kwt w s -o kwt=/tmp/kwt