Push to remote: don't trigger when the branch was just updated by "Pull from remote" (OD-2553)
Davide Beatrici opened 4 months ago

This is the current workflow:

  • User pushes on OneDev -> OneDev immediately force-pushes to GitHub
  • User pushes on GitHub -> Webhook is triggered on OneDev -> OneDev pulls everything (all branches) from GitHub

Unfortunately in the second case OneDev still pushes to GitHub afterwards. This results in loss of commits when a user on GitHub makes more than one in a row.

Is there a way to set it up so that the "Push to remote" job is not triggered if the branch was last updated by the "Pull from remote" one?

  • Robin Shen commented 4 months ago

    This can be addressed in 13.0.0:

    1. Create a special user with permission to manage the project, and then generate an access token for the user
    2. Create a job secret for the access token in the project
    3. Configure the pull repository step to use the job secret for property access token for target project
    4. Configure the branch update trigger to exclude this special user by specifying applicable users as any except user(<user name>)
  • Robin Shen changed state to 'Closed' 4 months ago
    Previous Value Current Value
    Open
    Closed
  • Davide Beatrici commented 4 months ago

    Thank you very much!

    I already had a special user, I simply had to add the exception to the branch trigger:

    anyone except user(admin)
    
issue 1/1
Type
Question
Priority
Normal
Assignee
Labels
No labels
Issue Votes (0)
Watchers (2)
Reference
OD-2553
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover