shipitjs / shipit-deploy

Set of deployment tasks for Shipit based on git and rsync commands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ignores` being...ignored

bigsweater opened this issue · comments

Having a little trouble getting Shipit to actually ignore files in the ignores array.

package.json

...
  "devDependencies": {
    ...
    "shipit-cli": "^2.0.0",
    "shipit-deploy": "^2.4.0",
    "shipit-shared": "^4.4.2"
    ...
  },
...

shipitfile:

module.exports = function (shipit) {
	require('shipit-deploy')(shipit);
	require('shipit-shared')(shipit);

	shipit.initConfig({
		default: {
			workspace: '[project]',
			repositoryUrl: '[repourl]',
			ignores: ['.git', 'node_modules', 'vendor', '**/router.php', '.sass-cache'],
			keepReleases: 5,
			key: '[keyfile]',
			deleteOnRollback: false,
			shallowClone: false,

			shared: {
				overwrite: true,
				dirs: [ 'dist/downloads' ]
			}
		},
		dev: {
			servers: '[user@server]',
			branch: 'dev',
			key: '[keyfile]',
			deployTo: '[deploydir]'
		},
		production: {
			servers: '[user@server]',
			branch: 'master',
			key: '[keyfile]',
			deployTo: '[deploydir]'
		}
	});

	shipit.on('fetched', function () {
		console.log('Fetched', shipit.config.workspace);
		shipit.start('build');
	});

	shipit.blTask('build', function () {
		return shipit.local('cd ' + shipit.config.workspace + '; npm install; bower install; grunt static css');
	});

	shipit.on('updated', function () {
		shipit.remote('cd ' + shipit.releasePath + ' && composer install');
	});
};

Note: I'm using shipit-shared to link to a directory containing large binaries. But those tasks don't run until after update, so it shouldn't be interfering with rsync.

I've also tried deleting ignores and instead doing rsync: ['--exclude .git', '--exclude node_modules', '--exclude vendor', '--exclude router.php', '--exclude .sass-cache'], but those files and directories still end up on the server.

I'm not sure if you're running into the same thing I just dealt with, but you'll note that the ignores config doesn't handle changes between versions. The rsync process is preceded by a full copy of the previous release to a new directory. It then rsyncs, ignoring files in your ignores directive - but if those files are already there, they won't be deleted.

The other issue is that your rsync directive should be a string (I think), not an array. And it should be under deploy>remoteCopy>rsync, like so:

    default: {
      deploy: {
        remoteCopy: {
          rsync: '--del --exclude .git --exclude vendor'
       }
     }
   }

You're exactly right. I just manually deleted the offending files from the server and deployed, and it worked.


I did rsync as an array because that's what it looks like in the sample config file in the Shipit docs (which references shipit-deploy), but the sauce says otherwise.

More confusing: that additional deploy object--it doesn't appear to be documented, unless I just missed something. The only mention of it that I've found is in issue 119 on shipit.

Happy to submit some PRs to clarify documentation.


Anyway: thanks for your help! I had the task wrong: I thought rsync only copied from my local workspace, not the previous release. Now I see the cp command. This clarifies things for me quite a bit.