Skip to content

alpha update runs make targets when there are conflicts #4989

@vitorfloriano

Description

@vitorfloriano

What broke? What's expected?

Currently, when running kubebuilder alpha update --force, if the merge ends with conflicts, the make targets are still run, but all fail with errors due to the presence of conflict markers in the code:

level=info msg="Preparing Merge branch with name tmp-merge-06-08-25-12-44 and performing merge"
level=warning msg="Merge completed with conflicts. Conflict markers will be committed."
level=info msg="Running make manifests:\n$ make manifests"
Makefile:75: *** missing separator.  Stop.
level=warning msg="make manifests failed: error running \"make\": exit status 2"
level=info msg="Running make generate:\n$ make generate"
Makefile:75: *** missing separator.  Stop.
level=warning msg="make generate failed: error running \"make\": exit status 2"
level=info msg="Running make fmt:\n$ make fmt"
Makefile:75: *** missing separator.  Stop.
level=warning msg="make fmt failed: error running \"make\": exit status 2"
level=info msg="Running make vet:\n$ make vet"
Makefile:75: *** missing separator.  Stop.
level=warning msg="make vet failed: error running \"make\": exit status 2"
level=info msg="Running make lint-fix:\n$ make lint-fix"
Makefile:75: *** missing separator.  Stop.
level=warning msg="make lint-fix failed: error running \"make\": exit status 2"

This is expected when running the make targets after the conflicts, but can negatively affect CI results.

It can also confuse users about the success of the operation.

A better approach could be to NOT run the make targets if there are conflicts and only WARN the user to do it after resolving them.

Reproducing this issue

Run kubebuilder alpha update --force in projects with distant current and target versions.

KubeBuilder (CLI) Version

v4.7.1

PROJECT version

v4.5.2

Plugin versions

Other versions

No response

Extra Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions