Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PushFlows ignores the result of PushCommand.call() with BitBucket #89

Open
lburja opened this issue Aug 16, 2024 · 6 comments
Open

PushFlows ignores the result of PushCommand.call() with BitBucket #89

lburja opened this issue Aug 16, 2024 · 6 comments
Assignees
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working

Comments

@lburja
Copy link

lburja commented Aug 16, 2024

Describe the issue

I have a situation where the PushFlows task finishes successfully, but I see no commits in the remote git repo (BitBucket).

Here is a screenshot from Kestra, where the log output claims that changes were pushed:
image

However, when I check the remote repository, no commits have been made in fact.

By looking in the source code, I see that the result of PushCommand.call() is ignored:
image

According to this StackOverflow question, not all push errors result in an exception being thrown, some of them are returned as push results : https://stackoverflow.com/questions/51140394/jgit-push-wont-fail-when-push-is-impossible
I believe that the push fails in some way, but there's no way to see the error in Kestra.

I would expect at the very least that any push result is logged. Even better, it would be returned as an output, and the task would throw an exception if any update was rejected.

Environment

  • Kestra Version: v0.18.2
  • Operating System (OS/Docker/Kubernetes): Kubernetes
  • Java Version (if you don't run kestra in Docker): n/a
@lburja lburja added the bug Something isn't working label Aug 16, 2024
@anna-geller
Copy link
Member

anna-geller commented Aug 19, 2024

Can you share the exact flow you were using? Also, can you say more about your setup? Is your Git VCS self-hosted and if so, can you confirm you can reach it from your kestra container? Do you see any server logs that can be helpful to reproduce this?

We should certainly fail the task if something fails to be pushed

cc @smunteankestra perhaps you can check the default BitBucket setup on develop to see if you can reproduce?

@anna-geller anna-geller changed the title io.kestra.plugin.git.PushFlows ignores result of PushCommand.call() PushFlows ignores the result of PushCommand.call() with BitBucket Aug 19, 2024
@lburja
Copy link
Author

lburja commented Aug 19, 2024

@anna-geller Yes, I can share the flow, it's pretty simple:

id: git-push-flows
namespace: git

pluginDefaults:
  - type: io.kestra.plugin.git.PushFlows
    values:
      url: https://dpl.cis.consilium.europa.eu/bitbucket/scm/gscdp/data-platform.git
      branch: master
      password: "....redacted...."
      username: "....redacted...."
      includeChildNamespaces: true 

tasks:
  - id: commit-and-push-git
    type: io.kestra.plugin.git.PushFlows
    gitDirectory: kestra/git-sync/flows/git
    sourceNamespace: git
    commitMessage: Latest flows in namespace git

We have indeed a self-hosted BitBucket. It's reachable from Kestra, since I can do SyncFlows successfully.

There are some rules for commits, for example unsigned commits are rejected. In this case, maybe the error is that the commit is unsigned. Or maybe something else.

The point of the bug report is that Kestra doesn't log any errors if the push is rejected. If I saw the reject message, I could fix it (e.g., disabling in BitBucket the requirement for signed commits for this particular repo).

@smunteankestra
Copy link

smunteankestra commented Aug 19, 2024

@anna-geller
I checked a simple commit to bitbucket - works
most likely it's something related to the bitbucket configuration

image

Flow

id: manuallypush
namespace: io.kestra.flows

tasks:
  - id: commit_and_push
    type: io.kestra.plugin.git.PushFlows
    username: "{{kv('user')}}"
    password: "{{ kv('password') }}"
    url: https://bitbucket.org/kestratest123/kestratest123.git
    branch: main
    sourceNamespace: debug
    targetNamespace: tutorial
    gitDirectory: flows
    commitMessage: "push all development flows to Git and create a PR"
    dryRun: false

@anna-geller anna-geller added the area/plugin Plugin-related issue or feature request label Aug 19, 2024
@anna-geller anna-geller transferred this issue from kestra-io/kestra Aug 19, 2024
@lburja
Copy link
Author

lburja commented Aug 19, 2024

@smunteankestra The point is that PushCommand::call() returns a value (Iterable<PushResult>), which might contain status OK, or status REJECTED_OTHER_REASON, or ....

image

But, Kestra ignores the result (see AbstractPushTask):

image

@lburja
Copy link
Author

lburja commented Aug 19, 2024

I've tested my hypothesis, and it's indeed this option that breaks the push:

image

If I disable the "Verify Commit Signature", then the Push finishes with success:

image

@anna-geller anna-geller removed their assignment Aug 19, 2024
@anna-geller
Copy link
Member

great, thx so much for thorough examination @smunteankestra 💯

so next steps: add error handling for when push doesn't work when commit signature verification is not enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/plugin Plugin-related issue or feature request bug Something isn't working
Projects
Status: Backlog
Development

No branches or pull requests

4 participants