Firebase-tools: predeploy not executing with multiple sites in the project

Created on 10 Oct 2018  Â·  8Comments  Â·  Source: firebase/firebase-tools

Version info

5.0.0

Platform Information

Ubuntu 18.04 (Linux)

Steps to reproduce

The following firebase.json doesn't run the predeploy script

{
"hosting": [
    {
      "target": "app",
      "public": "app/build",
      "predeploy": ["npm --prefix app run build"],
      "ignore": ["firebase.json", "**/node_modules/**"],
      "rewrites": [
        {
          "source": "/**",
          "destination": "/index.html"
        }
      ]
    },
    {
      "target": "abc",
      "public": "abc/build"
    }
  ]
}

Expected behavior

Should run the predeploy script

Actual behavior

Predeploy script not executing, works on single site configuration

hosting bug

Most helpful comment

Yep, seems like a bug.

On Tue, Oct 9, 2018, 8:58 PM Anagani Sai Kiran <[email protected]
wrote:

Version info

5.0.0
Platform Information

Ubuntu 18.04 (Linux)
Steps to reproduce

The following firebase.json doesn't run the predeploy script

{"hosting": [
{
"target": "app",
"public": "app/build",
"predeploy": ["npm --prefix app run build"],
"ignore": ["firebase.json", "/node_modules/"],
"rewrites": [
{
"source": "/**",
"destination": "/index.html"
}
]
},
{
"target": "abc",
"public": "abc/build"
}
]
}

Expected behavior

Should run the predeploy script
Actual behavior

Predeploy script not executing, works on single site configuration

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/940, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_gRUesFwfpvL-KuLcrCwweU1j9v7ks5ujXBagaJpZM4XUiE3
.

All 8 comments

Yep, seems like a bug.

On Tue, Oct 9, 2018, 8:58 PM Anagani Sai Kiran <[email protected]
wrote:

Version info

5.0.0
Platform Information

Ubuntu 18.04 (Linux)
Steps to reproduce

The following firebase.json doesn't run the predeploy script

{"hosting": [
{
"target": "app",
"public": "app/build",
"predeploy": ["npm --prefix app run build"],
"ignore": ["firebase.json", "/node_modules/"],
"rewrites": [
{
"source": "/**",
"destination": "/index.html"
}
]
},
{
"target": "abc",
"public": "abc/build"
}
]
}

Expected behavior

Should run the predeploy script
Actual behavior

Predeploy script not executing, works on single site configuration

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/firebase/firebase-tools/issues/940, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AAAD_gRUesFwfpvL-KuLcrCwweU1j9v7ks5ujXBagaJpZM4XUiE3
.

Internal bug reference: 122552632

Leaving this open as it's an active bug.

🤞

So what I believe is happening is that we collect all of the pre-deploys for all commands, then each command collects (possibly a list of) pre-deploys. However when a Hosting deploy deals with multiple Sites it is not adjusting the "top level" pre-deploy field, thus a single Site deploy executes the pre-deploy hook but when there are multiple Sites it doesn't find any.

This should be pretty straightforward, I'll try it out and test it at some point next week.

I've run into the same issues when using multiple targets for firebase hosting.

Temporary added my predeploy scripts into npm scripts in package.json:

"scripts": {
    "predeploy:site": "gulp site",
    "predeploy:blog": "gulp blog",
    "deploy:site": "npm run predeploy:site && firebase deploy --only hosting:site",
    "deploy:blog": "npm run predeploy:blog && firebase deploy --only hosting:blog"
  },

And run either npm run deploy:site or npm run deploy:blog

Sorry I should have ping this thread and closed this a while back. I was waiting for my PR to actually be launched in a new version of the CLI (which is was with 879dd3283b97e8f28f2e333be653b24283018e13 on 2019-02-21).

@Memeriaj It seems that when you deployed that change you broke the feature.
Each site's predeploy script are being run regardless of the deploy target being specified.
We have two deploy targets "cms" and "web".
Both deploy targets have predeployment needs so they each specify a predeploy script.

I want to deploy using the following command which is documented by firebase-tools:
firebase deploy --only hosting:web

But when I run that command it will execute both cms' predeploy and web's predeploy before continuing to only deploy web.

Was this page helpful?
0 / 5 - 0 ratings