pantheon-systems / quicksilver-pushback

Push any commits made on the Pantheon dashboard back to the original GitHub repository.
MIT License
14 stars 13 forks source link

Source Repo's .gitignore Not Restored #23

Closed jessedyck closed 1 year ago

jessedyck commented 2 years ago

I've noticed that the branches that pushback creates contains changes to .gitignore; the contents above the cut line is missing. Pushback appears to not be properly restoring my repository's .gitignore and is instead sending back the version on Pantheon.

image

I see that is supposed to be happening here: https://github.com/pantheon-systems/quicksilver-pushback/blob/main/lean-repo-utils.php#L203

But it's hitting a permission error:

Warning: file_put_contents(/code/.gitignore): Failed to open stream: Permission denied in /code/web/private/scripts/quicksilver/quicksilver-pushback/lean-repo-utils.php on line 203

I suspect this is because it's trying to write to /code while my enviroment is in git mode.

I tried this on brand new test site created with Build Tools and ran into the same issue, which I had switched from SFTP to Git mode so I could test applying changes.

Relevant workflow log:

[notice] ------ Operation: Push changes back to GitHub if needed finished in 10s (dev) ------
Enter push-back. Repository root is /code.
::::::::::::::::: Build Metadata :::::::::::::::::
array (
  'url' => 'https://gitlab.com/jesse.dyck/jesse-wp-buildtools-5.git',
  'ref' => 'master',
  'sha' => 'c119e3e66b7f52a153804b956053dd6a59f24765',
  'comment' => 'Update CI badge in README',
  'commit-date' => '2022-11-03 17:27:53 -0500',
  'build-date' => '2022-11-03 22:37:21 +0000',
)

::::::::::::::::: Info :::::::::::::::::
We are going to check out master from https://gitlab.com/jesse.dyck/jesse-wp-buildtools-5.git, branch from c119e3e66b7f52a153804b956053dd6a59f24765 and cherry-pick 9ed22ba7225a97c336595b57ae5ffde36be687a3 onto it
Cloning into '/tmp/pushback-workdir/scratchRepository'...
git rev-parse HEAD
Comment is 'testing pushback' and author is 'Jesse Dyck <>' and date is '1667515275'
Creating a new branch, '9ed22master', because the master branch cannot be pushed to directly.
git checkout -B 9ed22master c119e3e66b7f52a153804b956053dd6a59f24765
Switched to a new branch '9ed22master'

Warning: file_put_contents(/code/.gitignore): Failed to open stream: Permission denied in /code/web/private/scripts/quicksilver/quicksilver-pushback/lean-repo-utils.php on line 203
...
jspellman814 commented 1 year ago

@jessedyck Thank you for this very detailed report. I created a ticket (BUGS-5609) to track this internally.

kporras07 commented 1 year ago

Hi @jessedyck this should be working now in the latest pushback version. Please give it a try and feel free to reopen if you find otherwise