Skip to content

Pre/postdeploy command job: namespace mismatch (project.name vs project.namespace) and undefined method 'include?' for false crash #693

Description

@Yuyz0112

Summary

Two related defects in K8::Stateless::Command (used for pre/postdeploy commands):

  1. Namespace mismatch. Command#namespace returns project.name, while the job template (resources/k8/stateless/command.yaml) and the rest of the deploy pipeline use project.namespace. When a project's namespace differs from its name (the project form allows this), delete_if_exists! / statuses query a namespace that may not exist, while the job itself is applied into project.namespace.

  2. Crash instead of error. statuses rescues any kubectl error and returns false; done? then calls _statuses.include?(...), which raises:

Deployment failed: undefined method `include?' for false

masking the real error (in our case, the kubectl lookup failing because of defect 1).

Repro

  1. Create a project where namespace != name and set a predeploy_command.
  2. Deploy → deployment fails with the undefined method 'include?' for false message.

Suggested fix

  • Command#namespaceproject.namespace (consistent with the template).
  • statuses rescue → return [] (and let the timeout surface) or re-raise a typed error so done? can report the underlying kubectl failure.

Happy to send a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions