From c8d853b7ab968882ae87c061ef186c8a41d5a844 Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 14:05:05 +0300 Subject: [PATCH 1/8] Update .travis.yml --- .travis.yml | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8130d029e..7750fd993 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,12 +12,11 @@ notifications: - "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository_slug}@%{branch} in PR <%{pull_request_url}|#%{pull_request_number}> by %{author} %{result} in %{duration}" stages: - name: build - if: type = pull_request - name: dev_deploy if: branch = develop AND type = push -- name: pre_release +- name: pre_release_deploy if: branch =~ /^release-.*$/ AND type = push -- name: release +- name: release_deploy if: branch = master and type = push jobs: @@ -29,36 +28,42 @@ jobs: - stage: dev_deploy before_install: - sudo apt-get install sshpass - script: + before_deploy: + - npm pack + - export VERSION=`npm view iofogcontroller version` + deploy: + skip_cleanup: true + provider: script + script: sshpass -p $DEV_MACHINE_PASSWORD scp -o StrictHostKeyChecking=no iofogcontroller-${VERSION}.tgz + $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP:/ + after_deploy: - sshpass -p $DEV_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP - "cd /FogController; NODE_ENV=production node src/main.js stop; git pull; npm - i; npm test; npm run postman_test; NODE_ENV=production node src/main.js start;" - - stage: pre_release + "iofog-controller stop; npm install iofogcontroller-${VERSION}.tgz; iofog-controller start;" + - stage: pre_release_deploy before_install: - sudo apt-get install sshpass - script: + before_deploy: + - npm version --no-git-tag-version prerelease -preid=prerelease -m "upgrade to %s for prerelease package" + deploy: + skip_cleanup: true + provider: npm + email: "${NPM_EMAIL_ADDRESS}" + api_key: "${NPM_AUTH_TOKEN}" + tag: dev + after_deploy: - sshpass -p $PREPROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $PREPROD_MACHINE_USERNAME@$PREPROD_MACHINE_IP - "cd /Controller; NODE_ENV=production node src/main.js stop; git checkout $TRAVIS_BRANCH; npm i; - npm test; npm run postman_test; NODE_ENV=production node src/main.js start;" - - stage: release + "iofog-controller stop; npm update -g iofogcontroller@dev; npm test; npm run postman_test; iofog-controller start;" + - stage: release_deploy before_install: - - sudo apt-get install sshpass - #- git clone "https://github.com/$TRAVIS_REPO_SLUG.git" "$TRAVIS_REPO_SLUG"; - #- cd "$TRAVIS_REPO_SLUG"; - #- git checkout -qf "$TRAVIS_COMMIT"; - #- git checkout master - #before_deploy: - #- git config --global user.name "${GH_USERNAME}"; - #- git config credential.helper "store --file=.git/credentials"; - #- echo "https://${GH_TOKEN}:@github.com" > .git/credentials; - #- npm run automatic-release + - sudo apt-get install sshpass + before_deploy: + - npm version patch -m "upgrade to %s for release" deploy: skip_cleanup: true provider: npm email: "${NPM_EMAIL_ADDRESS}" api_key: "${NPM_AUTH_TOKEN}" - on: - tags: false + tag: latest after_deploy: - sshpass -p $PROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $PROD_MACHINE_USERNAME@$PROD_MACHINE_IP "iofog-controller stop; npm update -g iofogcontroller; iofog-controller start" From 3d6c1206396018671b82efe910b319746c4b5eac Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 15:15:09 +0300 Subject: [PATCH 2/8] add test stage --- .travis.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7750fd993..8d387fc51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ notifications: template: - "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository_slug}@%{branch} in PR <%{pull_request_url}|#%{pull_request_number}> by %{author} %{result} in %{duration}" stages: -- name: build +- name: test - name: dev_deploy if: branch = develop AND type = push - name: pre_release_deploy @@ -21,10 +21,9 @@ stages: jobs: include: - - stage: build - script: - - npm test - - npm run postman_test + - stage: test + script: npm test + script: npm run postman_test - stage: dev_deploy before_install: - sudo apt-get install sshpass From 8c44d93c2408840fba4c6b2973b9314761dcee43 Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 15:20:33 +0300 Subject: [PATCH 3/8] Update .travis.yml --- .travis.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8d387fc51..3292cbc6e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ notifications: template: - "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository_slug}@%{branch} in PR <%{pull_request_url}|#%{pull_request_number}> by %{author} %{result} in %{duration}" stages: -- name: test +#- name: test - name: dev_deploy if: branch = develop AND type = push - name: pre_release_deploy @@ -21,9 +21,8 @@ stages: jobs: include: - - stage: test - script: npm test - script: npm run postman_test + - script: npm test + - script: npm run postman_test - stage: dev_deploy before_install: - sudo apt-get install sshpass From ea9d586874d8914da078066ad222fbe2a3f1c42e Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 15:24:10 +0300 Subject: [PATCH 4/8] Update .travis.yml --- .travis.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3292cbc6e..a9aca57ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ notifications: template: - "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository_slug}@%{branch} in PR <%{pull_request_url}|#%{pull_request_number}> by %{author} %{result} in %{duration}" stages: -#- name: test - name: dev_deploy if: branch = develop AND type = push - name: pre_release_deploy @@ -21,8 +20,10 @@ stages: jobs: include: - - script: npm test - - script: npm run postman_test + - script: + - npm test + - script: + - npm run postman_test - stage: dev_deploy before_install: - sudo apt-get install sshpass @@ -32,8 +33,9 @@ jobs: deploy: skip_cleanup: true provider: script - script: sshpass -p $DEV_MACHINE_PASSWORD scp -o StrictHostKeyChecking=no iofogcontroller-${VERSION}.tgz - $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP:/ + script: + - sshpass -p $DEV_MACHINE_PASSWORD scp -o StrictHostKeyChecking=no iofogcontroller-${VERSION}.tgz + $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP:/ after_deploy: - sshpass -p $DEV_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP "iofog-controller stop; npm install iofogcontroller-${VERSION}.tgz; iofog-controller start;" From 88279cf50eebfa5667ad2b6d2a306d5b7bb403f8 Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 16:29:42 +0300 Subject: [PATCH 5/8] test dev package solution --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a9aca57ff..a60c5bfe5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,10 +35,10 @@ jobs: provider: script script: - sshpass -p $DEV_MACHINE_PASSWORD scp -o StrictHostKeyChecking=no iofogcontroller-${VERSION}.tgz - $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP:/ + $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP:/iofogcontroller after_deploy: - sshpass -p $DEV_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP - "iofog-controller stop; npm install iofogcontroller-${VERSION}.tgz; iofog-controller start;" + "iofog-controller stop; npm install /iofogcontroller/iofogcontroller-${VERSION}.tgz; iofog-controller start;" - stage: pre_release_deploy before_install: - sudo apt-get install sshpass From 7fea65da148ab2167b5f14664c1d005c9ee2754b Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 17:28:49 +0300 Subject: [PATCH 6/8] Update .travis.yml --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index a60c5bfe5..7bc689083 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ notifications: template: - "Build <%{build_url}|#%{build_number}> (<%{compare_url}|%{commit}>) of %{repository_slug}@%{branch} in PR <%{pull_request_url}|#%{pull_request_number}> by %{author} %{result} in %{duration}" stages: +- name: test + if: branch =~ /^release-.*$/ OR branch IN (develop, master) - name: dev_deploy if: branch = develop AND type = push - name: pre_release_deploy @@ -20,9 +22,10 @@ stages: jobs: include: - - script: + - stage: test + script: - npm test - - script: + script: - npm run postman_test - stage: dev_deploy before_install: @@ -38,7 +41,7 @@ jobs: $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP:/iofogcontroller after_deploy: - sshpass -p $DEV_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $DEV_MACHINE_USERNAME@$DEV_MACHINE_IP - "iofog-controller stop; npm install /iofogcontroller/iofogcontroller-${VERSION}.tgz; iofog-controller start;" + "iofog-controller stop; npm i --unsafe-perm -g /iofogcontroller/iofogcontroller-${VERSION}.tgz; iofog-controller start" - stage: pre_release_deploy before_install: - sudo apt-get install sshpass @@ -52,7 +55,7 @@ jobs: tag: dev after_deploy: - sshpass -p $PREPROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $PREPROD_MACHINE_USERNAME@$PREPROD_MACHINE_IP - "iofog-controller stop; npm update -g iofogcontroller@dev; npm test; npm run postman_test; iofog-controller start;" + "iofog-controller stop; npm update --unsafe-perm -g iofogcontroller@dev; iofog-controller start" - stage: release_deploy before_install: - sudo apt-get install sshpass @@ -66,4 +69,4 @@ jobs: tag: latest after_deploy: - sshpass -p $PROD_MACHINE_PASSWORD ssh -o StrictHostKeyChecking=no $PROD_MACHINE_USERNAME@$PROD_MACHINE_IP - "iofog-controller stop; npm update -g iofogcontroller; iofog-controller start" + "iofog-controller stop; npm update --unsafe-perm -g iofogcontroller; iofog-controller start" From a0856c93a120676af21f2bf6e0bd57c406bf70b9 Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 17:34:39 +0300 Subject: [PATCH 7/8] test parallel test running --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7bc689083..41916ceb9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,8 +21,7 @@ stages: if: branch = master and type = push jobs: - include: - - stage: test + include: script: - npm test script: From d29ba654191ae025502786f139c8018e81cb8745 Mon Sep 17 00:00:00 2001 From: dbusel <10116634+dbusel@users.noreply.github.com> Date: Tue, 12 Feb 2019 17:40:24 +0300 Subject: [PATCH 8/8] Update .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 41916ceb9..eb78997ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,9 +22,9 @@ stages: jobs: include: - script: + - script: - npm test - script: + - script: - npm run postman_test - stage: dev_deploy before_install: