user1606854
user1606854

Reputation: 33

How to install firebase extension in not-interactive way

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!

Upvotes: 3

Views: 1335

Answers (3)

Davie
Davie

Reputation: 161

As of June 2024 - you need to use the Extensions Manifest to install your extensions via the CLI using .env files for each instance.

see https://firebase.google.com/docs/extensions/manifest

Upvotes: 0

mjwlist
mjwlist

Reputation: 31

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

Upvotes: 3

Renaud Tarnec
Renaud Tarnec

Reputation: 83048

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.

Upvotes: 5

Related Questions