diff --git a/README.md b/README.md index 05b3037..9f363d7 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,10 @@ The following settings must be passed as environment variables as shown in the e | `CHARTMUSEUM_USER` | Username for chartmuseum | `secret` | **Yes** | | `CHARTMUSEUM_PASSWORD` | Password for chartmuseum | `secret` | **Yes** | | `SKIP_SECURE` | Allowing to push using insecure connection | `env` | No | +| `SSL_CERTIFICATE_PATH` | Allowing to use custom SSL certificate | `env` | No | +| `SSL_CERTIFICATE_CA_PATH` | Allowing to use custom SSL certificate bundle | `env` | No | +| `SSL_CERTIFICATE_KEY_PATH` | Allowing to provide custom SSL key | `env` | No | +| `DEBUG` | add `--debug` flag to ChartMuseum push command | `env` | No | | `FORCE` | Force chart upload (in case version exist in chartmuseum, upload will fail without `FORCE`). Defaults is `False` if not provided. | `env` | No | | `SOURCE_DIR` | The local directory you wish to upload. If your chart is in nested folder, `SOURCE_DIR` should be the path from root to the last folder before the one that stores the chart. For example, if your chart is in `./charts/app`, the `SOURCE_DIR` is `./charts/`. Defaults to the root of your repository (`.`) if not provided. | `env` | No | | `CHART_FOLDER` | Folder with charts in repo. This should be the name of the folder where the chart is in. For example, if your chart is in `./charts/app`, the `CHART_FOLDER` is `app` | `env` | **Yes** | diff --git a/entrypoint.sh b/entrypoint.sh index edbf5ce..35868bd 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -39,6 +39,31 @@ elif [ "$SKIP_SECURE" == "1" ] || [ "$SKIP_SECURE" == "True" ] || [ "$SKIP_SECUR SKIP_SECURE="--insecure" fi +if [ -z "$SSL_CERTIFICATE_PATH" ]; then + SSL_CERTIFICATE_PATH="" +elif [ "$SSL_CERTIFICATE_PATH" != "" ]; then + SSL_CERTIFICATE_PATH="--cert-file ../../${SSL_CERTIFICATE_PATH}" +fi + +if [ -z "$SSL_CERTIFICATE_CA_PATH" ]; then + SSL_CERTIFICATE_CA_PATH="" +elif [ "$SSL_CERTIFICATE_CA_PATH" != "" ]; then + SSL_CERTIFICATE_CA_PATH="--ca-file ../../${SSL_CERTIFICATE_CA_PATH}" +fi + +if [ -z "$SSL_CERTIFICATE_KEY_PATH" ]; then + SSL_CERTIFICATE_KEY_PATH="" +elif [ "$SSL_CERTIFICATE_KEY_PATH" != "" ]; then + SSL_CERTIFICATE_KEY_PATH="--key-file ../../${SSL_CERTIFICATE_KEY_PATH}" +fi + +if [ -z "$DEBUG" ]; then + DEBUG_FLAG="" +elif [ "$DEBUG" == "1" ] || [ "$DEBUG" == "True" ] || [ "$DEBUG" == "TRUE" ]; then + DEBUG_FLAG="--debug" +fi + + cd ${SOURCE_DIR}/${CHART_FOLDER} @@ -54,4 +79,4 @@ helm dependency update . helm package . -helm cm-push ${CHART_FOLDER}-* ${CHARTMUSEUM_URL} -u ${CHARTMUSEUM_USER} -p ${CHARTMUSEUM_PASSWORD} ${FORCE} ${SKIP_SECURE} +helm cm-push ${CHART_FOLDER}-* ${CHARTMUSEUM_URL} -u ${CHARTMUSEUM_USER} -p ${CHARTMUSEUM_PASSWORD} ${FORCE} ${SKIP_SECURE} ${SSL_CERTIFICATE_PATH} ${SSL_CERTIFICATE_CA_PATH} ${SSL_CERTIFICATE_KEY_PATH} ${DEBUG_FLAG}