Skip to content

Unwanted updates due to diverged branch #2801

@iurly

Description

@iurly

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

If branches diverge, the first target is marked as CHANGED and this causes dependent targets be executed.

Expected Behavior

I expect diverged branches NOT to subtly mark the target as CHANGED; unless there are actual changes, dependent targets should be skipped.

Steps To Reproduce

For a repro, I created a repo for managing a container image (say a Dockerfile) which is then tagged by a version.txt file.
I wrote a pipeline to automatically update the dependencies and if anything has changed, automatically bump my image's version tag (version.txt).
For that I have 3 sources:

  • latest_busybox_tag which is the dependency itself
  • this_tag which is the current version in version.txt
  • next_tag which is the next version (if necessary) through `semverinc: 'patch``

Then I have two targets:

  • update_busybox_version which will update the Dockerfile with the newest version
  • bump_version which dependson:"update_busybox_version:or"

What happens is that if the dependency is updated manually (i.e. IF the following happens):
a) there is already a branch (e.g. due to a previous PR) for such pipeline, i.e. updatecli_<main_branch>_<pipelineid>, and
b) the <main_branch> has evolved
c) there is no new version of the dependency available

Then updatecli will internally mark latest_busybox_tag as CHANGED, and therefore execute bump_version with a new, unwanted version tag.

This run shows the following output:

update_busybox_version
----------------------
WARNING: branch "refs/heads/updatecli_main_image_contents" diverged from "refs/heads/main", resetting it to "refs/heads/main"
✔ - all contents from 'file' and 'files' combined already up to date

⚠ While nothing change in the current pipeline run, according to the git history, some commits must be pushed
^^^^^^^^^^^

Notice how this does not get reflected in the summary as update_busybox_version shows as SUCCESS:

	Target:
		⚠ [bump_version] Bump image version to 0.0.3
		✔ [update_busybox_version] Update busybox version

In my repro this results in the PR being updated (through force-push) with an unneeded bump, but in the production environment this results in the PR being automatically closed and a new one being opened, for reasons which I have not yet been able to identify (and which is probably a separate issue).

Environment

- OS:
- updatecli:

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions