Supporting slides
Preparation
Install the DevWorkspace Operator
It can be installed as a standalone operator or it gets installed with the Web Terminal or OpenShift Dev Spaces. The following instructions have been tested with DevWorkspace Operator v0.19.
Deploy the editors definitions
The following commands create the DevWorkspacesTemplates that define the IDEs: vim, vscode and intellij.
$ kubectl apply -f ./editors-contributions/
Iteratively setup a cloud dev environment
Containerized dev tools and source code
kubectl apply -f ./dw1.yaml && \
kubectl wait --for=condition=Ready dw/dw --timeout=300s && \
export POD=`kubectl get pod -l "controller.devfile.io/devworkspace_name=dw" -o jsonpath={.items[].metadata.name}`
printf "\nBuild in the remote dev environment:\n\n\tkubectl exec -ti ${POD} -- bash -c \'cd \${PROJECT_SOURCE} && mvn clean install\'\n\n"
Add the IDE: VS Code
kubectl apply -f ./dw2.yaml && \
kubectl wait --for=condition=Ready dw/dw --timeout=300s && \
export IDE=`kubectl get dw dw -o jsonpath={.status.mainUrl}` && \
printf "\nOpen VS Code in your browser with the following link:\n\n\t${IDE}\n\n"
And now vim...
kubectl patch dw dw \
--type merge \
-p '{ "spec": { "contributions": [ {"name": "editor", "kubernetes": { "name": "vim" } } ] } }' && \
sleep 2 && \
kubectl wait --for=condition=Ready dw/dw --timeout=300s && \
export IDE=`kubectl get dw dw -o jsonpath={.status.mainUrl}` && \
printf "\nOpen VIM in your browser with the following link:\n\n\t${IDE}\n\n"
And intelliJ...
kubectl patch dw dw \
--type merge \
-p '{ "spec": { "contributions": [ {"name": "editor", "kubernetes": { "name": "intellij" } } ] } }' && \
sleep 2 && \
kubectl wait --for=condition=Ready dw/dw --timeout=300s && \
export IDE=`kubectl get dw dw -o jsonpath={.status.mainUrl}` && \
printf "\nOpen IntelliJ in your browser with the following link:\n\n\t${IDE}\n\n"
Add pre-configured commands to build and test the application
kubectl apply -f ./dw3.yaml && ./scripts/dw-restart.sh
Add a postgres container to run e2e tests
kubectl apply -f ./dw4.yaml
Cloud dev environment configuration
kubeconfig
$ ./auto-mount/kubeconfig.sh
bashrc
and PS1
$ kubectl apply -f ./auto-mount/bashrc.yaml
gitconfig
export GITHUB_LOGIN="<gh-login>"
export GITHUB_TOKEN="<gh-token>"
export GIT_USER_EMAIL="<email>"
export GIT_USER_NAME="<name>"
$ ./auto-mount/gitconfig.sh
~/.m2
Persist TODO
Change the dev tools image
Build the container image with the devtools
$ IMAGE="quay.io/mloriedo/universal-developer-image:ubi8-dw-demo"
$ docker build -t "${IMAGE}" -f Dockerfile.dev .
$ docker push "${IMAGE}"
Cleanup
NAMESPACE=dw-demo
kubectl delete dw dw
kubectl delete cm git-config dotfiles-config
kubectl delete secret git-credentials kube-config
kubectl delete dwt vs-code intellij vim