Retrieving jenkins admin password - invalid caracter in input stream
Hi, I'm having an issue retrieving the jenkins admin password with the latest stable jenkins chart:
printf $(kubectl get secret --namespace default sanguine-unicorn-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo Invalid character in input stream. printf: usage: printf [-v var] format [arguments]
minikube version: v0.16.0
kubectl Client Version: version.Info{Major:"1", Minor:"3", GitVersion:"v1.3.6", GitCommit:"ae4550cc9c89a593bcda6678df201db1b208133b", GitTreeState:"clean", BuildDate:"2016-08-26T18:13:23Z", GoVersion:"go1.6.2", Compiler:"gc", Platform:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.2", GitCommit:"08e099554f3c31f6e6f07b448ab3ed78d0520507", GitTreeState:"clean", BuildDate:"1970-01-01T00:00:00Z", GoVersion:"go1.7.1", Compiler:"gc", Platform:"linux/amd64"}
This should be a very simple fix for whoever tackles it - just pull the kubectl command out of the printf wrapper. Here is a perfect example.
kubectl get secret my-release-jenkins -o jsonpath="{.data.jenkins-admin-password}"
This command returns a result like: [65 66 67 68 69]
base64 --decode does not like that and throws Invalid character in input stream. (because of the [ and ] characters)
Here is a solution, albeit convoluted:
printf '%x' $( echo '[65 66 67 68 69]' | awk '{print substr($0, 2, length($0) - 2)}' ) \
| xxd -r -p
Here it is without the hardcoded numbers
printf '%x' $( kubectl get secret my-release-jenkins -o jsonpath="{.data.jenkins-admin-password}" | awk '{print substr($0, 2, length($0) - 2)}' ) \
| xxd -r -p