statamic / spock

Automatically perform git commits, pushes, and other cli actions when Statamic content changes
95 stars 16 forks source link

Lots of issues - Not pushing most of the times #35

Open madsem opened 5 years ago

madsem commented 5 years ago

I'm trying to get Spock to work all day today, but no luck. It just doesn't really push most of the time and throws lots of errors in the log file.

Basically it doesn't even push new collection entries, it logs errors about index.lock files that it thinks exist, but that aren't there when I check the /.git/ dir.

I am ignoring Asset events, as all assets are on S3, and before Spock was also throwing errors about not finding the asset files, this is my spock.yaml:

environments:
  - production
git_push: true
git_username: Spock
git_email: spock@somewebsite.online
ignore_events:
  - Statamic\Events\Data\AssetUploaded
  - Statamic\Events\Data\AssetMoved
  - Statamic\Events\Data\AssetDeleted
  - Statamic\Events\Data\AssetFolderSaved
  - Statamic\Events\Data\AssetFolderDeleted

There were some successful pushes, but it's unreliable at best, for a while now I wasn't able to get it to push anything, always logs like the ones below.

These logs are from adding a single new entry:


LEVEL   CONTEXT DATE    CONTENT
 error  production  2019-02-23 15:19:20 Spock command exited unsuccessfully:
Command: git -c "user.name=Spock" -c "user.email=spock@somewebsite.online" commit -m "Term saved by madsem"
Output: 
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
    site/content/collections/reviews/2019-02-23.tonalenergy-tuner-and-metronome.md
    site/content/taxonomies/apps/music-audio.yaml
    site/storage/addons/AppStoreApi/com.sonosaurus.tonalenergytuner.json

It took 2.03 seconds to enumerate untracked files. 'status -uno'
may speed it up, but you have to be careful not to forget to add
new files yourself (see 'git help status').
nothing added to commit but untracked files present

Error: No error
 error  production  2019-02-23 15:19:20 Spock command exited unsuccessfully:
Command: git -c "user.name=Spock" -c "user.email=spock@somewebsite.online" commit -m "Entry saved by madsem"
Output: 
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
    site/content/collections/reviews/2019-02-23.tonalenergy-tuner-and-metronome.md
    site/content/taxonomies/apps/music-audio.yaml
    site/storage/addons/AppStoreApi/com.sonosaurus.tonalenergytuner.json

nothing added to commit but untracked files present

Error: No error
 error  production  2019-02-23 15:19:18 Spock command exited unsuccessfully:
Command: git -c "user.name=Spock" -c "user.email=spock@somewebsite.online" commit -m "Taxonomy saved by madsem"
Output: No output
Error: 
fatal: Unable to create '/home/forge/somewebsite.online/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
 error  production  2019-02-23 15:19:17 Spock command exited unsuccessfully:
Command: git add /home/forge/somewebsite.online/site/content/collections/reviews/tonalenergy-tuner-and-metronome.md
Output: No output
Error: 
fatal: Unable to create '/home/forge/somewebsite.online/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
 error  production  2019-02-23 15:19:17 Spock command exited unsuccessfully:
Command: git add /home/forge/somewebsite.online/site/content/collections/reviews/2019-02-23.tonalenergy-tuner-and-metronome.md
Output: No output
Error: 
fatal: Unable to create '/home/forge/somewebsite.online/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
 error  production  2019-02-23 15:19:16 Spock command exited unsuccessfully:
Command: git add /home/forge/somewebsite.online/site/content/taxonomies/apps/music-audio.yaml
Output: No output
Error: 
fatal: Unable to create '/home/forge/somewebsite.online/.git/index.lock': File exists.

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.

Server: Ubuntu 18 / Nginx (Default Laravel Forge Setup) Latest Statamic: 2.11.9 Spock 2.2.1 Repo Type: Private

madsem commented 5 years ago

dir listing:

forge@somewebsite-online:~/somewebsite.online$ ls -al /home/forge/somewebsite.online/
total 48
drwxrwxr-x  7 forge forge 4096 Feb 23 14:50 .
drwxr-xr-x  7 forge forge 4096 Feb 23 14:08 ..
-rw-r--r--  1 forge forge  459 Feb 23 07:40 .env
drwxrwxr-x  8 forge forge 4096 Feb 23 15:20 .git
-rw-rw-r--  1 forge forge  239 Feb 23 14:50 .gitignore
-rw-rw-r--  1 forge forge   18 Feb 23 07:36 README.md
drwxrwxr-x  5 forge forge 4096 Feb 23 07:42 local
-rw-rw-r--  1 forge forge  871 Feb 23 07:36 phpunit.xml
-rw-rw-r--  1 forge forge 2034 Feb 23 07:36 please
drwxrwxr-x  3 forge forge 4096 Feb 23 08:51 public
drwxrwxr-x 11 forge forge 4096 Feb 23 07:36 site
forge@somewebsite-online:~/somewebsite.online$ ls -al /home/forge/somewebsite.online/.git
total 1200
drwxrwxr-x  8 forge forge    4096 Feb 23 15:20 .
drwxrwxr-x  7 forge forge    4096 Feb 23 14:50 ..
-rw-rw-r--  1 forge forge      22 Feb 23 15:19 COMMIT_EDITMSG
-rw-rw-r--  1 forge forge      95 Feb 23 15:10 FETCH_HEAD
-rw-rw-r--  1 forge forge      23 Feb 23 07:36 HEAD
-rw-rw-r--  1 forge forge      41 Feb 23 15:10 ORIG_HEAD
drwxrwxr-x  2 forge forge    4096 Feb 23 07:36 branches
-rw-rw-r--  1 forge forge     262 Feb 23 07:36 config
-rw-rw-r--  1 forge forge      73 Feb 23 07:36 description
drwxrwxr-x  2 forge forge    4096 Feb 23 07:36 hooks
-rw-rw-r--  1 forge forge 1166129 Feb 23 15:19 index
drwxrwxr-x  2 forge forge    4096 Feb 23 07:36 info
drwxrwxr-x  3 forge forge    4096 Feb 23 07:36 logs
drwxrwxr-x 88 forge forge    4096 Feb 23 15:05 objects
-rw-rw-r--  1 forge forge     114 Feb 23 07:36 packed-refs
drwxrwxr-x  5 forge forge    4096 Feb 23 07:36 refs
madsem commented 5 years ago

PS:

The addon that creates the json files, also fires a data event, so it should theoretically be picked up by Spock?

event(new FileUploaded('site/storage/addons/' . $this->getAddonClassName() . '/' . $androidBundleId . '.json'));
jesseleite commented 5 years ago

Hey @madsem, sorry about the delay. Yes, the data event fired by your addon should theoretically picked up by Spock. This being back in February though, are you still having trouble with git pushing?

elliottregan commented 5 years ago

@jesseleite I'm also seeing an issue with items being saved to Storage not getting staged. I'm using the BigKahuna addon, which uses $this->storage->putJSON() to save some data to a json file in site/storage/addons/BigKahuna.

Might be related: https://github.com/Eworm/big-kahuna/issues/27