Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Commit

Permalink
feat(shipit-deploy): Added config so you can rsync including the fold…
Browse files Browse the repository at this point in the history
…er (#246)
  • Loading branch information
SiebeVE authored and gregberge committed Aug 28, 2019
1 parent ba1d8c2 commit 64481f8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
11 changes: 11 additions & 0 deletions packages/shipit-deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ module.exports = shipit => {
deleteOnRollback: false,
key: '/path/to/key',
shallowClone: true,
deploy: {
remoteCopy: {
copyAsDir: false, // Should we copy as the dir (true) or the content of the dir (false)
},
},
},
staging: {
servers: '[email protected]',
Expand Down Expand Up @@ -176,6 +181,12 @@ Type: `String`

Parameter to pass to `cp` to copy the previous release. Non NTFS filesystems support `-r`. Default: `-a`

### deploy.remoteCopy.copyAsDir

Type: `Boolean` _Optional_

If `true` - We will copy the folder instead of the content of the folder. Default: `false`.

## Variables

Several variables are attached during the deploy and the rollback process:
Expand Down
6 changes: 5 additions & 1 deletion packages/shipit-deploy/src/tasks/deploy/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ const updateTask = shipit => {

shipit.log('Copy project to remote servers.')

await shipit.remoteCopy(`${uploadDirPath}/`, shipit.releasePath, options)
let srcDirectory = `${uploadDirPath}/`;
if(options.copyAsDir){
srcDirectory = srcDirectory.slice(0, -1);
}
await shipit.remoteCopy(srcDirectory, shipit.releasePath, options)
shipit.log(chalk.green('Finished copy.'))
}

Expand Down
15 changes: 15 additions & 0 deletions packages/shipit-deploy/src/tasks/deploy/update.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,21 @@ describe('deploy:update task', () => {
)
})
})

it('should accept rsync options', async () => {
const sh = createShipitInstance({
deploy: { remoteCopy: { rsync: '--foo', copyAsDir: true } },
})
stubShipit(sh)

await start(sh, 'deploy:update')

expect(sh.remoteCopy).toBeCalledWith(
'/tmp/workspace',
'/remote/deploy/releases/YYYYMMDDHHmmss',
{ rsync: '--foo', copyAsDir: true },
)
})
})

describe('#setPreviousRevision', () => {
Expand Down

0 comments on commit 64481f8

Please sign in to comment.