Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can we import google-services.json at build time ?

vkj January 8, 2019

My Android project uses Firebase services which requires a google-services.json to be configured. This json file from Google as a practise is not supposed to be checked into Git. I have also not checked in my json file.

Is it possible to have a Pipeline build file for such a project?

Is it possible to import, use and add into the build and then discard the json file. 

Any pointers will be helpful.  

2 answers

1 accepted

0 votes
Answer accepted
Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 13, 2019

Hi Vineet,

You could put the contents of the file into a variable and then write the contents of that variable to the appropriate file at the beginning of your build script. It's best to base64-encode the contents to make sure they survive the trip through the UI.

For example: 

  1. In your local environment:
    base64 < google-services.json
  2. Copy the output of that command into a variable named (for example) "GOOGLE_SERVICES_JSON"
  3. At the beginning of your build script:
    echo $GOOGLE_SERVICES_JSON | base64 --decode > google-services.json
0 votes
vkj January 15, 2019

Thank you for reverting back

And yes this works for me. 

But I had to write the json file into /opt/atlassian/pipelines/agent/build/app/ for it build correctly.

Is this location cleaned out after the build is done or the files remain in the folder?

Regards,

Vineet

Steven Vaccarella
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 15, 2019

Your build runs in a private, isolated container. Any files you create anywhere on the local filesystem will never be accessible to any other build. Shortly after your build finishes the container will be garbage collected (ie. deleted) along with any files you created.

vkj January 15, 2019

Perfect

Thank you

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events