nautobot-app-golden-config icon indicating copy to clipboard operation
nautobot-app-golden-config copied to clipboard

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

Open matt852 opened this issue 1 year ago • 1 comments

Environment

  • Python version: 3.10
  • Nautobot version: 1.5.18
  • nautobot-golden-config version: 1.4.1

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.

matt852 avatar May 22 '23 15:05 matt852