Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
language: node_js

sudo: true

node_js:
- 8
- 10

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.28.4
- ssh-keygen -t rsa -N "" -f ${TRAVIS_HOME}/.ssh/id_rsa
- cat ${TRAVIS_HOME}/.ssh/id_rsa.pub | tee -a ${TRAVIS_HOME}/.ssh/authorized_keys
- curl -o- -L https://yarnpkg.com/install.sh | bash -s
- export PATH="$HOME/.yarn/bin:$PATH"
- yarn

script:
- chmod 700 ssh && chmod 644 ssh/id_rsa.pub && chmod 600 ssh/id_rsa
- yarn ci

notifications:
Expand All @@ -22,4 +26,7 @@ cache:
- 'node_modules'

addons:
ssh_known_hosts: test.shipitjs.com
ssh_known_hosts:
- 127.0.0.1
- 0.0.0.0
- localhost
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"license": "MIT",
"private": true,
"scripts": {
"postinstall": "chmod 400 ./ssh/id_rsa ./ssh/id_rsa.pub",
"build": "lerna run build",
"ci": "yarn build && yarn lint && yarn test --ci --coverage && codecov",
"dev": "lerna run build --parallel -- --watch",
Expand Down
6 changes: 3 additions & 3 deletions packages/shipit-cli/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ describe('shipit-cli', () => {
stdout = stdout.trim();

expect(stdout).toMatch(/Running 'remoteUser' task.../)
expect(stdout).toMatch(/Running "echo \$USER" on host "test.shipitjs.com"./)
expect(stdout).toMatch(/@test.shipitjs.com deploy/)
expect(stdout).toMatch(/Running "echo \$USER" on host "localhost"./)
expect(stdout).toMatch(/@localhost travis/)
expect(stdout).toMatch(/Finished 'remoteUser' after/)
}, 10000)

it('should work with "~"', async () => {
const { stdout } = await exec(
`${babelNode} ${shipitCli} --shipitfile ${shipitFile} test cwdSsh`,
)
expect(stdout).toMatch(/@test.shipitjs.com \/home\/deploy\/\.ssh/)
expect(stdout).toMatch(/@localhost \/home\/travis\/\.ssh/)
}, 10000)
})
4 changes: 2 additions & 2 deletions packages/shipit-cli/tests/sandbox/shipitfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
export default shipit => {
shipit.initConfig({
default: {
key: './ssh/id_rsa',
key: '/home/travis/.ssh/id_rsa',
},
test: {
servers: 'deploy@test.shipitjs.com',
servers: 'travis@localhost',
},
})

Expand Down
6 changes: 4 additions & 2 deletions packages/shipit-deploy/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@ describe('shipit-cli', () => {

const latestRelease = lsReleases
.split('\n')
.reverse()[2]
.filter(s => s.match(/^@localhost/))
.reverse()[0]
.match(/\d{14}/)[0]

const { stdout: lsCurrent } = await exec(
`${babelNode} ${shipitCli} --shipitfile ${shipitFile} test ls-current`,
)

const currentRelease = lsCurrent
.split('\n')[3]
.split('\n')
.filter(s => s.match(/^@localhost/))[0]
.match(/releases\/(\d{14})/)[1]

expect(latestRelease).toBe(currentRelease)
Expand Down
4 changes: 2 additions & 2 deletions packages/shipit-deploy/tests/sandbox/shipitfile.babel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export default shipit => {

shipit.initConfig({
default: {
key: './ssh/id_rsa',
key: '/home/travis/.ssh/id_rsa',
workspace: '/tmp/shipit-workspace',
deployTo: '/tmp/shipit',
repositoryUrl: 'https://github.com/shipitjs/shipit.git',
ignores: ['.git', 'node_modules'],
shallowClone: true,
},
test: {
servers: 'deploy@test.shipitjs.com',
servers: 'travis@localhost',
},
})

Expand Down
8 changes: 4 additions & 4 deletions packages/ssh-pool/tests/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ describe('ssh-pool', () => {
let pool

beforeEach(() => {
pool = new sshPool.ConnectionPool(['deploy@test.shipitjs.com'], {
key: resolve(__dirname, '../../../ssh/id_rsa'),
pool = new sshPool.ConnectionPool(['travis@localhost'], {
key: resolve(__dirname, '/home/travis/.ssh/id_rsa'),
})
})

it('should run a command remotely', async () => {
const [{ stdout }] = await pool.run('hostname')
expect(stdout).toBe('shipit-test\n')
expect(stdout).toMatch(/travis-job-/)
}, 10000)

it('should escape command properly', async () => {
const [{ stdout: first }] = await pool.run('echo $USER')
expect(first).toBe('deploy\n')
expect(first).toBe('travis\n')

const [{ stdout: second }] = await pool.run("echo '$USER'")
expect(second).toBe('$USER\n')
Expand Down
27 changes: 0 additions & 27 deletions ssh/id_rsa

This file was deleted.

1 change: 0 additions & 1 deletion ssh/id_rsa.pub

This file was deleted.