kestra-io / plugin-git

Apache License 2.0
3 stars 2 forks source link

`EachParallel` reports successful parallel commits but commits not visible in Git Repository #81

Open wrussell1999 opened 2 months ago

wrussell1999 commented 2 months ago

Expected Behavior

When using EachParallel to bulk commit multiple namespaces at once, all commits should appear in GitHub. If this is not possible due to the nature of committing multiple times to the same repository, it should fail or mentioned that it's not possible.

Looks like Git PushFlows is rewriting the history, rather than pushing a new commit on top. If that's the intention, we should clear that up in the documentation as that prevents parallel use of PushFlows. This commit was accessed from the Kestra logs: Screenshot 2024-06-20 at 17 18 26

Actual Behaviour

When using EachParallel to bulk commit multiple namespaces at once, it comes back as successful but not all of the commits are visible. Screenshot 2024-06-20 at 17 17 21

Only one of the commits was successful: Screenshot 2024-06-20 at 17 17 28

Steps To Reproduce

id: push_to_git
namespace: system

tasks:
  - id: fetch_namespaces
    type: io.kestra.plugin.core.http.Request
    uri: http://host.docker.internal:8082/api/v1/flows/distinct-namespaces

  - id: loop_namespaces
    type: io.kestra.plugin.core.flow.EachParallel
    value: "{{outputs.fetch_namespaces.body}}"
    tasks:
      - id: commit_and_push
        type: io.kestra.plugin.git.PushFlows
        username: wrussell1999
        password: "{{ secret('GITHUB_ACCESS_TOKEN') }}"
        url: https://github.com/wrussell1999/test
        branch: main
        sourceNamespace: "{{ taskrun.value }}"
        targetNamespace: "{{ taskrun.value }}"
        gitDirectory: "flows/{{ taskrun.value }}"
        commitMessage: "parallel: changes to kestra flows for {{ taskrun.value }}"

Environment Information

Example flow

No response

madisonb commented 1 month ago

This appears to also impact io.kestra.plugin.git.Push as well. Running a flow multiple times at the same time (modifying different files simultaneously) will only generate a single commit.

A simple retry loop with a git pull; git push solves this in other CICD style jobs on other platforms.