-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: David Kwon <[email protected]>
- Loading branch information
Showing
8 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
pkg/library/home/testdata/persistent-home/creates-home-vm-initcontainer-already-defined.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: "Creates persistent home volume when initcontainer is already defined in the input workspace components" | ||
|
||
input: | ||
devworkspaceId: "test-workspaceid" | ||
config: | ||
workspace: | ||
persistUserHome: | ||
enabled: true | ||
workspace: | ||
components: | ||
- name: testing-container-1 | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: my-defined-volume | ||
volume: {} | ||
- name: init-persistent-home | ||
container: | ||
image: testing-image-1 | ||
command: | ||
- echo helloworld | ||
commands: | ||
- id: init-persistent-home | ||
apply: | ||
component: init-persistent-home | ||
events: | ||
prestart: | ||
- init-persistent-home | ||
|
||
output: | ||
workspace: | ||
components: | ||
- name: testing-container-1 | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: persistent-home | ||
path: /home/user/ | ||
- name: my-defined-volume | ||
volume: {} | ||
- name: init-persistent-home | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: persistent-home | ||
path: /home/user/ | ||
command: | ||
- echo helloworld | ||
- name: persistent-home | ||
volume: {} | ||
commands: | ||
- id: init-persistent-home | ||
apply: | ||
component: init-persistent-home | ||
events: | ||
prestart: | ||
- init-persistent-home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
pkg/library/home/testdata/persistent-home/creates-initcontainer-from-first-component.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: "Creates init container from the first component when persistUserHome is enabled" | ||
|
||
input: | ||
devworkspaceId: "test-workspaceid" | ||
config: | ||
workspace: | ||
persistUserHome: | ||
enabled: true | ||
workspace: | ||
components: | ||
- name: testing-container-1 | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: testing-container-2 | ||
container: | ||
image: testing-image-2 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: my-defined-volume | ||
volume: {} | ||
|
||
output: | ||
workspace: | ||
components: | ||
- name: testing-container-1 | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: persistent-home | ||
path: /home/user/ | ||
- name: testing-container-2 | ||
container: | ||
image: testing-image-2 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: persistent-home | ||
path: /home/user/ | ||
- name: my-defined-volume | ||
volume: {} | ||
- name: init-persistent-home | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: persistent-home | ||
path: /home/user/ | ||
command: | ||
- /bin/sh | ||
- -c | ||
args: | ||
- | | ||
(echo "Checking for stow command" | ||
STOW_COMPLETE=/home/user/.stow_completed | ||
if command -v stow &> /dev/null; then | ||
if [ ! -f $STOW_COMPLETE ]; then | ||
echo "Running stow command" | ||
stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /home/user/.stow.log 2>&1 | ||
cp -n /home/tooling/.viminfo /home/user/.viminfo | ||
cp -n /home/tooling/.bashrc /home/user/.bashrc | ||
cp -n /home/tooling/.bash_profile /home/user/.bash_profile | ||
touch $STOW_COMPLETE | ||
else | ||
echo "Stow command already run. If you wish to re-run it, delete $STOW_COMPLETE from the persistent volume and restart the workspace." | ||
fi | ||
else | ||
echo "Stow command not found" | ||
fi) || true | ||
- name: persistent-home | ||
volume: {} | ||
commands: | ||
- id: init-persistent-home | ||
apply: | ||
component: init-persistent-home | ||
events: | ||
prestart: | ||
- init-persistent-home |
68 changes: 68 additions & 0 deletions
68
pkg/library/home/testdata/persistent-home/creates-initcontainer-when-enabled.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: "Creates init container when persistUserHome is enabled" | ||
|
||
input: | ||
devworkspaceId: "test-workspaceid" | ||
config: | ||
workspace: | ||
persistUserHome: | ||
enabled: true | ||
workspace: | ||
components: | ||
- name: testing-container-1 | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: my-defined-volume | ||
volume: {} | ||
|
||
output: | ||
workspace: | ||
components: | ||
- name: testing-container-1 | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: my-defined-volume | ||
path: /my-defined-volume-path | ||
- name: persistent-home | ||
path: /home/user/ | ||
- name: my-defined-volume | ||
volume: {} | ||
- name: init-persistent-home | ||
container: | ||
image: testing-image-1 | ||
volumeMounts: | ||
- name: persistent-home | ||
path: /home/user/ | ||
command: | ||
- /bin/sh | ||
- -c | ||
args: | ||
- | | ||
(echo "Checking for stow command" | ||
STOW_COMPLETE=/home/user/.stow_completed | ||
if command -v stow &> /dev/null; then | ||
if [ ! -f $STOW_COMPLETE ]; then | ||
echo "Running stow command" | ||
stow . -t /home/user/ -d /home/tooling/ --no-folding -v 2 > /home/user/.stow.log 2>&1 | ||
cp -n /home/tooling/.viminfo /home/user/.viminfo | ||
cp -n /home/tooling/.bashrc /home/user/.bashrc | ||
cp -n /home/tooling/.bash_profile /home/user/.bash_profile | ||
touch $STOW_COMPLETE | ||
else | ||
echo "Stow command already run. If you wish to re-run it, delete $STOW_COMPLETE from the persistent volume and restart the workspace." | ||
fi | ||
else | ||
echo "Stow command not found" | ||
fi) || true | ||
- name: persistent-home | ||
volume: {} | ||
commands: | ||
- id: init-persistent-home | ||
apply: | ||
component: init-persistent-home | ||
events: | ||
prestart: | ||
- init-persistent-home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
pkg/library/home/testdata/persistent-home/noop-if-no-components.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: "No op if there are no components" | ||
|
||
input: | ||
devworkspaceId: "test-workspaceid" | ||
config: | ||
workspace: | ||
persistUserHome: | ||
enabled: true | ||
workspace: | ||
components: [] | ||
|
||
output: | ||
workspace: | ||
components: [] |