my step,reading base 64 encoded json
#!/bin/bash -eo pipefail
echo
$SERVICE_ACCOUNT | base64 -di
HOW TO define new variable at that step?
dec= $SERVICE_ACCOUNT | base64 -di
did not work for me
my step,reading base 64 encoded json
#!/bin/bash -eo pipefail
echo
$SERVICE_ACCOUNT | base64 -di
HOW TO define new variable at that step?
dec= $SERVICE_ACCOUNT | base64 -di
did not work for me
Maybe like this?
DEC=$(echo $SERVICE_ACCOUNT | base64 -d)
example (this is the base64 on a Mac; your mileage may vary):
% SERVICE_ACCOUNT_KEY="YXNkZmFzZGZhc2RmYXNkZmFhZmtsZHNuZmRzYWZsIGFhc2ZkbiBhc2RmZmQK"
% FOO=$(echo $SERVICE_ACCOUNT_KEY | base64 -d)
% echo $FOO
asdfasdfasdfasdfaafkldsnfdsafl aasfdn asdffd
You may also need to export the var as well as setting it, depending on if you need to use it as a substring.
Or you could save the base64 decoded value to a file if that works for your use case, and use an env var to store the path to the file vs. the value of the base64 decoded service account.
Side note: you may be able to just store the value in a CircleCI context without base64 encoding it first. Or, best, use OIDC instead of a service account key if at all possible for your use case.
Yes,it works,I am on Ubuntu,more less the same.