init.sh 986 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. if [[ ! -f .devcontainer/dev.env ]]
  3. then
  4. cat << EOF
  5. env file 'dev.env' does not exist in .devcontainer, please create it and add the the correct values for your cluster.
  6. OC_PLUGIN_NAME=my-plugin
  7. OC_URL=https://api.example.com:6443
  8. OC_USER=kubeadmin
  9. OC_PASS=<password>
  10. EOF
  11. exit 2
  12. else
  13. echo 'found 'dev.env' in .devcontainer'
  14. fi
  15. # if one of the variables are missing, abort the build.
  16. success=1
  17. ! grep -q OC_PLUGIN_NAME= ".devcontainer/dev.env" && success=0
  18. ! grep -q OC_URL= ".devcontainer/dev.env" && success=0
  19. ! grep -q OC_USER= ".devcontainer/dev.env" && success=0
  20. ! grep -q OC_PASS= ".devcontainer/dev.env" && success=0
  21. if ((success)); then
  22. echo 'dev.env is formatted correctly, proceeding.'
  23. else
  24. cat << EOF
  25. dev.env is not formatted correctly, please add the the correct values for your cluster.
  26. OC_PLUGIN_NAME=my-plugin
  27. OC_URL=https://api.example.com:6443
  28. OC_USER=kubeadmin
  29. OC_PASS=<password>
  30. EOF
  31. exit 2
  32. fi