3

I am trying to install firebase firestore-bigquery-export extension through firebase CLI. But I can not find how I can install an extension in non-interactive way.

I need that because I have multiple environments and CI.

The console contains information about , but where I can find parameters name?

$ firebase ext:install firestore-bigquery-export -h
Usage: firebase ext:install [options] [extensionName]

install an official extension if [extensionName] or [extensionName@version] is provided; or run with `-i` to see all available extensions.

Options:
  --params <paramsFile>  name of params variables file with .env format.
  -h, --help             output usage information

Thank you for your help!

2 Answers2

5

As explained here in the doc (expand the "Bypass the interactive terminal prompts for parameter values during installation" section), you need to :

  1. Create a .env file (for example, params.env) that defines your parameter values. Save the file locally.
  • Declare each parameter by its param value found in the extension's extension.yaml file.
  • Include values for all the parameters.
  • Follow dotenv syntax.
  1. Run the extension-install command with the --params flag. For example, to install the Translate Text extension, run the following command: firebase ext:install firestore-translate-text --params=path/to/params.env --project=projectID-or-alias

To find the extension.yaml file for a given extension, you need to view its source code. To find a link to the source code for one the official Firebase extensions, you need to click "Learn more" on the extension's card on the Firebase Extensions product page or in the Firebase console.

Renaud Tarnec
  • 79,263
  • 10
  • 95
  • 121
  • Hi user1606854, did you have the time to look at the proposed solution? – Renaud Tarnec Aug 16 '20 at 18:30
  • Hi Renaud Tarnec. Yes, your solution works for me. Thank you very much! – user1606854 Aug 17 '20 at 02:52
  • 2
    But it still ask a question: firebase ext:install --params=big-query/install/invoices/invoices.env firestore-bigquery-export - BigQuery Data Editor (Access to edit all the contents of datasets) ? Would you like to continue? (Y/n) – user1606854 Aug 17 '20 at 03:06
  • 1
    being asked the `Do you wish to continue?` question as well. Any other flags to bypass that? – czphilip Nov 10 '20 at 11:48
  • 1
    If I install multiple instances of extension, how can I specify extension instance name in non-interactive way? Do I have to specify it in params.env file? – aponski Nov 16 '20 at 13:52
  • This might be working for you @RenaudTarnec but obviously not working with the big query extension. – amosel Jan 08 '22 at 16:53
3

In response to aponski's comment here re: installing multiple instances of extension...

And to add a little to the answer provided by Renaud Tarnec....

I found the following worked for me when trying to install multiple instances of the firestore-bigquery-export extension via the firebase cli non-interactively.

Notably I needed to add the --force flag (not mentioned in the doc unless I'm missing something) and pipe the extension id as this is not available in the extension.yaml file.

#!/bin/bash

PROJECT_ID=$1
DIR="$(cd "$(dirname "$0")" && pwd)"
echo $PROJECT_ID

echo "firestore-bigquery-exports-users" | \
  firebase ext:install firebase/firestore-bigquery-export \
  --params=$DIR/users.params.env \
  --project=$PROJECT_ID \
  --force

echo "firestore-bigquery-exports-events" | \
  firebase ext:install firebase/firestore-bigquery-export \
  --params=$DIR/events.params.env \
  --project=$PROJECT_ID \
  --force
mjwlist
  • 31
  • 2