0

Here's the context of what I'm trying to do. I would like have a Drone step to run database migrations against a Google Cloud SQL Postgres instance. I need to use Cloud SQL Proxy in order to access the database. Cloud SQL Proxy requires you provide a credential file to the proxy.

The problem I'm having is that when I try to echo or printf the environment variable to a file (as suggested here) the JSON comes out malformed.

Note: I've tried adding the JSON via Drone GUI and Drone CLI.

1 Answer 1

1

The best solution I found to this problem is to simply base64 encode the JSON before putting it into Drone.

Decode the base64 when you need it in your step.

Example commands:

Encode: base64 data.txt > data.b64

Decode: echo $CREDS_B64 | base64 --decode > sql-deploy-creds.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.