diff --git a/README.md b/README.md index 4c3e357..050bfb8 100644 --- a/README.md +++ b/README.md @@ -144,4 +144,16 @@ env: ENVSUBST: true KUBE_ROLLOUT: true IMAGE_TAG: 1.21.6 -``` \ No newline at end of file +``` + +
+ +# Change Log + +## v1.1.0 + +- Add otpion to KUBE_ROLLOUT follow the rollout status in Action page +- Fix metacharacter replacement in ENVSUBST + +## v1.0.0 +- Project started \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index f430c59..dd02347 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -52,7 +52,7 @@ if [ "$ENVSUBST" = true ]; then for ENV_VAR in $(env |cut -f 1 -d =); do VAR_KEY=$ENV_VAR - VAR_VALUE=$(eval echo \$$ENV_VAR | sed 's/\//\\\//g') + VAR_VALUE=$(eval echo \$$ENV_VAR | sed -e 's/\//\\&/g;s/\&/\\&/g;') sed -i "s/\$$VAR_KEY/$VAR_VALUE/g" $KUBE_YAML done @@ -65,10 +65,16 @@ KUBE_APPLY=$(kubectl apply -f $KUBE_YAML) echo $KUBE_APPLY #Verify and execute rollout -if [ "$KUBE_ROLLOUT" = true ] && [ "$(echo $KUBE_APPLY |sed 's/.* //')" = unchanged ]; then +if [ "$KUBE_ROLLOUT" == true ] && [ "$(echo $KUBE_APPLY |sed 's/.* //')" == "unchanged" ]; then echo "" echo "Applying rollout:" kubectl rollout restart --filename $KUBE_YAML + echo "" + echo "Checking rollout status:" + kubectl rollout status --filename $KUBE_YAML +elif [ "$KUBE_ROLLOUT" = true ] && ([ "$(echo $KUBE_APPLY |sed 's/.* //')" == "configured" ] || [ "$(echo $KUBE_APPLY |sed 's/.* //')" == "created" ]); then + echo "" + echo "Checking rollout status:" kubectl rollout status --filename $KUBE_YAML fi