firebase-tools: All multi-site predeploy hooks trigger on single site deployment

Environment info

firebase-tools: 6.4.0

Platform: macOS

Test case

For example, following firebase.json runs every hosting targets predeploy hooks even if called with a single hosting deploy target firebase deploy --only hosting:store. After predeploy hooks are run, only the deploy target site is actually deployed.

{
  "hosting": [ 
      {
        "target": "admin",
        "public": "admin/build",
        "predeploy": "./predeploy.sh"
      },
      {
        "target": "store",
        "public": "store/build",
        "predeploy": "./predeploy.sh"
      }
  ]
}

Steps to reproduce

Running firebase deploy --only hosting:deploy-target runs predeploy hooks for all hosting targets in multi-site hosting firebase.json

Expected behavior

Deploying hosting with deploy target should run only the predeploy hooks of the deploy target

Actual behavior

Deploying hosting with deploy target runs all hosting targets predeploy hooks. Still, only the deploy target hosting site is actually deployed

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

Still an issue in 7.4.0

I’m reopening this and assigning to @Memeriaj to take a look.

I’m seeing this as well, but for postdeploy hooks. Given a firebase.json like this:

{
  "hosting": [
    {
      "target": "production",
      "public": "public",
      "postdeploy": "echo \"Just deployed My Project to production environment.\""
    },
    {
      "target": "staging",
      "public": "public",
      "postdeploy": "echo \"Just deployed My Project to staging environment.\""
    }
  ]
}

When i run firebase deploy --only hosting:production, I would expect to see only the message “Just deployed My Project to production environment.”, but I’m actually getting both messages.

I’m using firebase-tools@7.0.2

This is still an issue in version 12.5.2