From 86b176263ed5e6d7056c9909d8b46be044a87d0d Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Mon, 2 Nov 2020 00:20:52 +0200 Subject: [PATCH] fixing-travis --- .travis.yml | 13 ++++++--- package.json | 1 - packages/shipit-cli/tests/integration.test.js | 6 ++--- .../tests/sandbox/shipitfile.babel.js | 4 +-- .../shipit-deploy/tests/integration.test.js | 6 +++-- .../tests/sandbox/shipitfile.babel.js | 4 +-- packages/ssh-pool/tests/integration.test.js | 8 +++--- ssh/id_rsa | 27 ------------------- ssh/id_rsa.pub | 1 - 9 files changed, 25 insertions(+), 45 deletions(-) delete mode 100644 ssh/id_rsa delete mode 100644 ssh/id_rsa.pub diff --git a/.travis.yml b/.travis.yml index 1b5dd01..0fb0d48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: @@ -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 diff --git a/package.json b/package.json index c1b25c2..82f52a6 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/shipit-cli/tests/integration.test.js b/packages/shipit-cli/tests/integration.test.js index 5489ffc..c9e16ad 100644 --- a/packages/shipit-cli/tests/integration.test.js +++ b/packages/shipit-cli/tests/integration.test.js @@ -21,8 +21,8 @@ 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) @@ -30,6 +30,6 @@ describe('shipit-cli', () => { 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) }) diff --git a/packages/shipit-cli/tests/sandbox/shipitfile.babel.js b/packages/shipit-cli/tests/sandbox/shipitfile.babel.js index 81787bb..8748433 100755 --- a/packages/shipit-cli/tests/sandbox/shipitfile.babel.js +++ b/packages/shipit-cli/tests/sandbox/shipitfile.babel.js @@ -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', }, }) diff --git a/packages/shipit-deploy/tests/integration.test.js b/packages/shipit-deploy/tests/integration.test.js index d54b376..9767daa 100644 --- a/packages/shipit-deploy/tests/integration.test.js +++ b/packages/shipit-deploy/tests/integration.test.js @@ -25,7 +25,8 @@ 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( @@ -33,7 +34,8 @@ describe('shipit-cli', () => { ) const currentRelease = lsCurrent - .split('\n')[3] + .split('\n') + .filter(s => s.match(/^@localhost/))[0] .match(/releases\/(\d{14})/)[1] expect(latestRelease).toBe(currentRelease) diff --git a/packages/shipit-deploy/tests/sandbox/shipitfile.babel.js b/packages/shipit-deploy/tests/sandbox/shipitfile.babel.js index 9e61087..56d5a9a 100644 --- a/packages/shipit-deploy/tests/sandbox/shipitfile.babel.js +++ b/packages/shipit-deploy/tests/sandbox/shipitfile.babel.js @@ -6,7 +6,7 @@ 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', @@ -14,7 +14,7 @@ export default shipit => { shallowClone: true, }, test: { - servers: 'deploy@test.shipitjs.com', + servers: 'travis@localhost', }, }) diff --git a/packages/ssh-pool/tests/integration.test.js b/packages/ssh-pool/tests/integration.test.js index 2c82c9f..e90824f 100644 --- a/packages/ssh-pool/tests/integration.test.js +++ b/packages/ssh-pool/tests/integration.test.js @@ -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') diff --git a/ssh/id_rsa b/ssh/id_rsa deleted file mode 100644 index b68ebc8..0000000 --- a/ssh/id_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAvhm/0j4Hzm0wMZKRri3Nd+fmApLThXuy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-85SNNlsV71SYQulachHQZEY75s5yB+PxK91NEYFoEjvVr0gFJpDeciFJruFPXiHO -TiL3LBhChaR4V5ixJk5U1/Nrn79VzyjE9cYNx0cvABtIH+8/e+icLrTVU0h8KHPL -zDf0yZ6KiyeEqnFjbUar2bZbAoGBAK3XDlAPv7QT4EJOUcPDCQTcvJ/i3Kj6xKUc -+EiURaLkTJ9ymxmuB+DGcIQDzevsvRayJ0n8lOV/E+E2+afKQTQgqUW6tBol4T7H -sKzJAnKYiaq7jiZIEFIvZ5PLfl/3K15xaWbL/E15ssNGXAeOvG80Y69lK88utZW4 -vL5vaF7ZAoGAfoH1IMgYmZOK5M6/nSNtfEciPrEMBwEsQGXOhtdVf6Ul6OmScEU8 -BAOcwiWjUr1iS3Y9eYce6t4F3ZZf9zSuA5eaXuRkeJaOwFMwklNuezNGY1Y6ZVgH -Syw/+CXag6aWwa+43qVFON1t5G5GXKvnI+W0FyTKleOENe3LSzAvrW4= ------END RSA PRIVATE KEY----- diff --git a/ssh/id_rsa.pub b/ssh/id_rsa.pub deleted file mode 100644 index f33f130..0000000 --- a/ssh/id_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+Gb/SPgfObTAxkpGuLc135+YCktOFe7KuJH4KqIQ42Rc02C3sHq6zLrkSEA+kHKjny82th4iQEB3Nau23mPVuVCJh9liEpwYesGGNsrxY0Gce4bkV6kPTi1lpoeOXMn0nXNrIq1TUCJmOXykqadTufomjqwaGBhw+KVQGY98HScWW+vS5zjFStaDYWXSHdbDUmU2Gcx8sr/A6NpIcuA3DrKKLHIbVMkByuXM0nWkdcUTEAfDuPacFyDANQI0uACcxYU3wUHqJs3oIW3s0Ja04u54CpTsWmHC6sGoKpxEf6DI4Xbdm2aK6mzLMKiNOeJnQ+kxasNaBn1oCoD7UFt/J shipit-test