deis / builder

Git server and application builder for Deis Workflow
https://deis.com
MIT License
40 stars 41 forks source link

Builder fails to start after upgrading to WF v2.10.0 #460

Closed mhulscher closed 7 years ago

mhulscher commented 7 years ago

I merged my old values.yaml and the new format for v2.10.0. This means I also base64 encoded my GCS serviceaccount key. Builder now fails to start with only the following message:

2017/01/09 13:43:09 Error creating storage driver (invalid character '\n' in string literal)

How can I debug this further?

bacongobbler commented 7 years ago

how did you base64 encode your GCS service account key? From the looks of it the key was escaped with newline characters before being encoded, which need to be removed before being added to the key_json field. base64 has a -w 0 flag that strips newline characters from the output.

Here's how I do it for reference:

$ cat ~/.gce/deis.json
{
  "type": "service_account",
  "project_id": "REDACTED",
  "private_key_id": "REDACTED",
  "private_key": "-----BEGIN PRIVATE KEY-----\nREDACTED\n-----END PRIVATE KEY-----\n",
  "client_email": "REDACTED",
  "client_id": "REDACTED",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://accounts.google.com/o/oauth2/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": "REDACTED"
}
$ GCS_SERVICEACCOUNT_KEY=$(cat ~/.gce/deis.json | base64 -w 0)

And dumped $GCS_SERVICEACCOUNT_KEY into the key_json value.

mhulscher commented 7 years ago

This has been fixed, thanks for helping. I saved to disk and executed cat $file | jq -Mc . | base64 -w 0 and pasted the result in the configuration file. Turns I erred up my GCR key as well, leaving me unable to pull new images. Unfortunately the registry-token-refresher was absolutely silent on the issue, producing no logs :( I am pretty sure I messed up my JSON keys somehow before I base64 encoded them.