Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore setup GitHub Actions if hosting also selected (#3742) #3838

Conversation

os1ma
Copy link
Contributor

@os1ma os1ma commented Oct 16, 2021

Description

Fix #3742 that firebase init exit in 404 Error when both Hosting and GitHub Actions are selected. The reason for this error is that when both "hosting" and "hosting:github" are selected, the function used internally which not support twice executions called twice.

Actually, "hosting:github" is included in "hosting", so there is no need to execute the process twice. So I have changed it to ignore "hosting:github" when both are selected.

Scenarios Tested

As a fixed scenario, choose both "hosting" and "hosting:github" as shown below and answered all settings with default or YES.

$ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /home/oshima/work/src/firebase-lab

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. 
 ◯ Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision default instance
 ◉ Firestore: Configure security rules and indexes files for Firestore
 ◉ Functions: Configure a Cloud Functions directory and its files
❯◉ Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
 ◉ Hosting: Set up GitHub Action deploys
 ◉ Storage: Configure a security rules file for Cloud Storage
 ◉ Emulators: Set up local emulators for Firebase products
(Move up and down to reveal more choices)

I also tested that the command was not corrupted in the following three scenarios.

First, choose "hosting", but not "hosting:github", as below.

$ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /home/oshima/work/src/firebase-lab

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. 
 ◯ Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision default instance
 ◉ Firestore: Configure security rules and indexes files for Firestore
 ◉ Functions: Configure a Cloud Functions directory and its files
❯◉ Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
 ◯ Hosting: Set up GitHub Action deploys
 ◉ Storage: Configure a security rules file for Cloud Storage
 ◉ Emulators: Set up local emulators for Firebase products
(Move up and down to reveal more choices)

Choose "hosting:github", but not "hosting", as below.

$ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /home/oshima/work/src/firebase-lab

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. 
 ◯ Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision default instance
 ◉ Firestore: Configure security rules and indexes files for Firestore
 ◉ Functions: Configure a Cloud Functions directory and its files
❯◯ Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
 ◉ Hosting: Set up GitHub Action deploys
 ◉ Storage: Configure a security rules file for Cloud Storage
 ◉ Emulators: Set up local emulators for Firebase products
(Move up and down to reveal more choices)

Choose neither "hosting:github" nor "hosting", as below.

$ firebase init

     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  /home/oshima/work/src/firebase-lab

? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. 
 ◯ Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision default instance
 ◉ Firestore: Configure security rules and indexes files for Firestore
 ◉ Functions: Configure a Cloud Functions directory and its files
❯◯ Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
 ◯ Hosting: Set up GitHub Action deploys
 ◉ Storage: Configure a security rules file for Cloud Storage
 ◉ Emulators: Set up local emulators for Firebase products
(Move up and down to reveal more choices)

Sample Commands

N/A

@google-cla google-cla bot added the cla: yes Manual indication that this has passed CLA. label Oct 16, 2021
@os1ma
Copy link
Contributor Author

os1ma commented Oct 28, 2021

Hi @inlined, I’m assuming you are a member of the Firebase CLI team, so I’m reaching out to you.

I sent this small pull request to fix #3742 the other day, but it seems to be stuck in workflow approval. It’s a small issue with a workaround, so it’s not urgent, but I’d be happy if you take a look at it at your convenience. If I need to take any additional action, such as changing the way it is implemented, I will be happy to do so!

@inlined
Copy link
Member

inlined commented Oct 29, 2021

@bkendall Is the expert here. He'll be able to evaluate this PR.

@os1ma
Copy link
Contributor Author

os1ma commented Oct 30, 2021

Thanks for the reply! I'm looking forward to the expert evaluating!

Copy link
Contributor

@bkendall bkendall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me.

Could you add a line to CHANGELOG.md:

- Fixes issue where `init` would crash with multiple Hosting items selected (#3742).

Thanks!

@os1ma
Copy link
Contributor Author

os1ma commented Nov 2, 2021

Hi @bkendall, thanks for the review!
I added that one line to the CHANGELOG.md!

@bkendall bkendall merged commit c8e99d2 into firebase:master Nov 2, 2021
devpeerapong pushed a commit to devpeerapong/firebase-tools that referenced this pull request Dec 14, 2021
…irebase#3838)

* Ignore setup GitHub Actions if hosting also selected

* Add a line to CHANGELOG.md

Co-authored-by: Bryan Kendall <bkend@google.com>
kroikie pushed a commit that referenced this pull request Mar 4, 2022
* Ignore setup GitHub Actions if hosting also selected

* Add a line to CHANGELOG.md

Co-authored-by: Bryan Kendall <bkend@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Manual indication that this has passed CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

firebase init exit in 404 Error when both Hosting and GitHub Actions are selected
3 participants