nautobot / nautobot-app-golden-config

Golden Configuration App for Nautobot.
https://docs.nautobot.com/projects/golden-config/en/latest/
Other
100 stars 57 forks source link

GitHub pushes fail but errors aren't logged in Job Results when branch is protected #500

Open matt852 opened 1 year ago

matt852 commented 1 year ago

Environment

Steps to Reproduce

  1. Create a GitHub repo for config backups and/or intended configs
  2. In GitHub, create a branch protection rule, and select option "Require a pull request before merging"
  3. Set up this repo in Nautobot for GC to use it for backup and intended configs
  4. Attempt a backup/intended config Job.

Expected Behavior

The job to fail, and an error thrown similar to what is shown in the CLI output when attempting to manually push to a protected branch. Example output below:

nautobot@nautobot-celery-default-6d54664886-vrbhc:~/git/github-configurations$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 265 bytes | 265.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: error: Changes must be made through a pull request.
To https://github.com/REPO/nautobot-gc-configurations.git
 ! [remote rejected] main -> main (protected branch hook declined)
error: failed to push some refs to 'https://github.com/REPO/nautobot-gc-configurations.git'

Observed Behavior

The job succeeded with no errors shown, even in the debug logs.

jeffkala commented 1 year ago

Curious if this same exact issue happens with repos outside the golden config scope? For the most part we reuse some of the core functionalities here so curious if this is something that should be addressed in core instead.