0

how to capture testing_uri from CLI output as described in this documentation for firebase app distribution. Is testing_uri exposed as environment variable or should i just parse the output with some custom regex and grab the uri

this is the output that i get for CLI command firebase appdistribution:distribute

removing specific uris for privacy but this is the output format doesn't have a variable like testing_uri

i want to grab the uri after "Share this release with testers who have access:"

View this release in the Firebase console: https://console.firebase.google.com/project.....
Share this release with testers who have access: https://appdistribution.firebase.google.com/testerapps/.....
Download the release binary (link expires in 1 hour): uri....

2 Answers 2

0

The testing_uri is not exposed as an environment variable for the firebase app distribution. Like you mentioned, you will need to parse the output with regex to obtain the desired uri. I can help with a bash script that will execute the firebase appdistribution:distribute and export the TESTING_URI to an environment variable.

#!/bin/bash

# Run the Firebase App Distribution command
output=$(firebase appdistribution:distribute <your-app-path> --app <your-app-id> --token <your-token>)

# Use regex to find the testing URI in the output
uri=$(echo "$output" | grep -oE "https://appdistribution\.firebase\.google\.com/testerapps/[a-zA-Z0-9]+")

# Check if the URI pattern as described above was matched
if [ -n "$uri" ]; then
    echo "Testing URI found: $uri"
    # Export the URI as an environment variable
    export TESTING_URI="$uri"
    echo "TESTING_URI is now set as an environment variable"
else
    echo "Testing URI not found in the output"
fi

Save the bash script above with a name of your choice ending in .sh. You can name it get_firebase_testing_uri.sh.

Make the script executable with the command below:

chmod +x get_firebase_testing_uri.sh

Run the bash script with the command below:

./get_firebase_testing_uri.sh

Obtain the exported environment variable with echo as shown below:

echo $TESTING_URI

I hope this works!

Sign up to request clarification or add additional context in comments.

Comments

0

Firebase CLI takes -j, --json option to format output in JSON rather than text.

Other options and commands can be listed with firebase --help.

1 Comment

No, Firebase appdistribution:distribute command does not natively output the result in JSON format.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.