Skip to content

Cloud Function lifecycle hooks don't respect codebase filters #6002

Closed

Description

@sam-throne

[REQUIRED] Environment info

firebase-tools: 12.3.1

Platform: macOS

[REQUIRED] Test case

"functions": [
  {
    "predeploy": "echo predeploy codebaseA",
    "source": "codebaseA",
    "codebase": "codebasea"
  },
  {
    "predeploy": "echo predeploy codebaseA",
    "source": "codebaseB",
    "codebase": "codebaseb"
  },
]

[REQUIRED] Steps to reproduce

firebase deploy --only functions:codebasea

[REQUIRED] Expected behavior

Only "predeploy codebaseA" is printed

[REQUIRED] Actual behavior

predeploy codebaseA AND predeploy codebaseB are printed

I have a potential fix in #5989

Activity

  1. aalej commented on Jun 19, 2023

    @aalej
    Contributor

    Hi @sam-throne, thanks for reporting this and for submitting a PR. I was able to reproduce the issue you mentioned. Running firebase deploy --only functions:<codebase> runs the predeploy script for both codebases.

    I'll notify our engineers about this so that they can take a look, and I’ll be marking this as reproducible. One odd thing I noticed is that your codebases are named “codebaseA” and “codebaseB”. From what I know, codebase names can only contain lowercase letters.

  2. sam-throne commented on Jun 20, 2023

    @sam-throne
    Author

    Thanks @aalej I updated the example to lowercase

  3. self-assigned this
    on Jun 20, 2023
  4. blidd-google commented on Jun 20, 2023

    @blidd-google
    Contributor

    Hey @sam-throne, thanks for reporting this issue. I have implemented a simple fix in a PR here: #6011. Note that predeploy hooks still won't run for individually specified functions, so we will need to revisit this issue and restructure the deploy logic in the future.

  5. sam-throne commented on Jun 21, 2023

    @sam-throne
    Author

    Hi @blidd-google thanks for your time. Your PR appears to be a regression however. Predeploy hooks did previously run for individually specified functions, it's just that all of them ran.

    IMO if you release with the current behavior you will cause a lot of pain for people who have built workarounds for the current system. I encourage you to take a look at the PR I attached which has much better behavior

  6. blidd-google commented on Jun 22, 2023

    @blidd-google
    Contributor

    Hey @sam-throne, thanks for the followup and pointing this out — opened a PR against yours at #6023 and added some additional fixes to make sure we don't break any pre-existing behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions