From 07a4c33033dd2ede0d9e6d22a9b01a344357af6f Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Wed, 25 Jul 2018 16:10:24 +0700 Subject: [PATCH 1/9] Docker tagging options + Docker release tagging --- .travis.yml | 19 +++++++++++++++---- docker_push.sh | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55482cea4b..975aad1536 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ before_install: skip jobs: include: + - stage: Lint os: linux sudo: false @@ -15,6 +16,7 @@ jobs: submodules: false script: - go run build/ci.go lint + - stage: Build and test os: linux dist: trusty @@ -38,7 +40,8 @@ jobs: - while sleep 540; do echo "[ still running ]"; done & - go run build/ci.go test -coverage - kill %1 - - stage: Build and push tomochain/tomochain and tomochain/bootnode containers + + - stage: Build and push Docker image services: - docker before_install: @@ -46,16 +49,24 @@ jobs: - docker run tomochain/tomochain deploy: provider: script - script: bash docker_push.sh + script: bash docker_push.sh $TRAVIS_BUILD_ID on: - branch: master - - stage: Trigger rebuild of tomochain/infra-tomochain image + branch: master AND tag = false + deploy: + provider: script + script: bash docker_push.sh $TRAVIS_TAG + on: + branch: master AND tag = true + + - stage: Trigger rebuild of infrastructure image sudo: false script: bash docker_rebuild.sh stages: - name: Lint - name: Build and test + - name: Github release + if: type != pull_request AND branch = master AND tag = true - name: Build and push Docker image if: type != pull_request AND branch = master - name: Trigger rebuild of infrastructure image diff --git a/docker_push.sh b/docker_push.sh index 6008259b92..fadcc1f709 100644 --- a/docker_push.sh +++ b/docker_push.sh @@ -2,6 +2,6 @@ echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin docker tag tomochain/tomochain tomochain/tomochain:latest -docker tag tomochain/tomochain tomochain/tomochain:$TRAVIS_BUILD_ID +docker tag tomochain/tomochain tomochain/tomochain:$1 docker push tomochain/tomochain:latest -docker push tomochain/tomochain:$TRAVIS_BUILD_ID +docker push tomochain/tomochain:$1 From 95c68ffa997a4e1b291ecf352614a34536864ca2 Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Wed, 25 Jul 2018 16:48:58 +0700 Subject: [PATCH 2/9] Refactor docker push script --- .travis.yml | 20 ++++++++++++++++++-- docker_push.sh | 2 -- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 975aad1536..cc2ead5249 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,18 @@ jobs: - go run build/ci.go test -coverage - kill %1 + - stage: Github release + deploy: + provider: releases + api_key: "GITHUB OAUTH TOKEN" + file: + - "build/bin/*" + # name: + # body: (formating not preserved) + # prerelease: true + # draft: true + skip_cleanup: true + - stage: Build and push Docker image services: - docker @@ -49,12 +61,16 @@ jobs: - docker run tomochain/tomochain deploy: provider: script - script: bash docker_push.sh $TRAVIS_BUILD_ID + script: + - bash docker_push.sh latest + - bash docker_push.sh $TRAVIS_BUILD_ID on: branch: master AND tag = false deploy: provider: script - script: bash docker_push.sh $TRAVIS_TAG + script: + - bash docker_push.sh latest + - bash docker_push.sh $TRAVIS_TAG on: branch: master AND tag = true diff --git a/docker_push.sh b/docker_push.sh index fadcc1f709..bc708c2730 100644 --- a/docker_push.sh +++ b/docker_push.sh @@ -1,7 +1,5 @@ #!/bin/bash echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin -docker tag tomochain/tomochain tomochain/tomochain:latest docker tag tomochain/tomochain tomochain/tomochain:$1 -docker push tomochain/tomochain:latest docker push tomochain/tomochain:$1 From 99920424c9d283676108a5cbb21cd228a89a7a3c Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Wed, 25 Jul 2018 17:05:24 +0700 Subject: [PATCH 3/9] Fix typo in travis.yml Tag condition is plural --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc2ead5249..b8ce3f09bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,14 +65,14 @@ jobs: - bash docker_push.sh latest - bash docker_push.sh $TRAVIS_BUILD_ID on: - branch: master AND tag = false + branch: master AND tags = false deploy: provider: script script: - bash docker_push.sh latest - bash docker_push.sh $TRAVIS_TAG on: - branch: master AND tag = true + branch: master AND tags = true - stage: Trigger rebuild of infrastructure image sudo: false From cb6cb53bfcdae02cacabcd95982ca03ca75d60e7 Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Wed, 25 Jul 2018 17:13:59 +0700 Subject: [PATCH 4/9] Fix wrong conditions --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b8ce3f09bb..ff55abe02d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -65,14 +65,16 @@ jobs: - bash docker_push.sh latest - bash docker_push.sh $TRAVIS_BUILD_ID on: - branch: master AND tags = false + branch: master + condition: tags = false deploy: provider: script script: - bash docker_push.sh latest - bash docker_push.sh $TRAVIS_TAG on: - branch: master AND tags = true + branch: master + condition: tags = true - stage: Trigger rebuild of infrastructure image sudo: false From 26afc88c9c6d657c356282df193caa1a8d4307be Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Wed, 25 Jul 2018 17:30:54 +0700 Subject: [PATCH 5/9] Add Github token and fix conditions --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index ff55abe02d..e12616cb0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,14 +44,17 @@ jobs: - stage: Github release deploy: provider: releases - api_key: "GITHUB OAUTH TOKEN" - file: - - "build/bin/*" + api_key: $GITHUB_TOKEN # name: # body: (formating not preserved) # prerelease: true # draft: true + file: + - "build/bin/tomo" skip_cleanup: true + on: + branch: master + tags: true - stage: Build and push Docker image services: @@ -66,7 +69,7 @@ jobs: - bash docker_push.sh $TRAVIS_BUILD_ID on: branch: master - condition: tags = false + tags: false deploy: provider: script script: @@ -74,7 +77,7 @@ jobs: - bash docker_push.sh $TRAVIS_TAG on: branch: master - condition: tags = true + tags: true - stage: Trigger rebuild of infrastructure image sudo: false From f1a84d921fa31e6f069476c60d687d4a0da8f2ff Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Thu, 26 Jul 2018 11:02:05 +0700 Subject: [PATCH 6/9] Update .travis.yml Rename the released binary --- .travis.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e12616cb0b..cf2070f76a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,6 @@ sudo: required language: go go_import_path: github.com/ethereum/go-ethereum services: skip -before_install: skip jobs: include: @@ -42,15 +41,14 @@ jobs: - kill %1 - stage: Github release + script: + - make tomo + - mv build/bin/tomo build/bin/tomo-linux-amd64 deploy: provider: releases api_key: $GITHUB_TOKEN - # name: - # body: (formating not preserved) - # prerelease: true - # draft: true file: - - "build/bin/tomo" + - "build/bin/tomo-linux-amd64" skip_cleanup: true on: branch: master @@ -62,6 +60,8 @@ jobs: before_install: - docker build -t tomochain/tomochain . - docker run tomochain/tomochain + install: skip + script: skip deploy: provider: script script: @@ -81,6 +81,7 @@ jobs: - stage: Trigger rebuild of infrastructure image sudo: false + install: skip script: bash docker_rebuild.sh stages: From 68b027e1b3ce552f9037943fa8836844490e9a2c Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Thu, 26 Jul 2018 11:18:00 +0700 Subject: [PATCH 7/9] Update .travis.yml Rename stages --- .travis.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf2070f76a..aa565965ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,7 +54,7 @@ jobs: branch: master tags: true - - stage: Build and push Docker image + - stage: Build and push tomochain/tomochain image services: - docker before_install: @@ -79,7 +79,7 @@ jobs: branch: master tags: true - - stage: Trigger rebuild of infrastructure image + - stage: Trigger rebuild of tomochain/infra-tomochain image sudo: false install: skip script: bash docker_rebuild.sh @@ -89,9 +89,9 @@ stages: - name: Build and test - name: Github release if: type != pull_request AND branch = master AND tag = true - - name: Build and push Docker image + - name: Build and push tomochain/tomochain image if: type != pull_request AND branch = master - - name: Trigger rebuild of infrastructure image + - name: Trigger rebuild of tomochain/infra-tomochain image if: type != pull_request AND branch = master notifications: From fa9fad23feb95d1394e17b593b605fd77ea28cb7 Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Thu, 26 Jul 2018 18:45:54 +0700 Subject: [PATCH 8/9] Update .travis.yml Add missing check for same repo origin when deploying --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa565965ec..b66f68466e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -88,11 +88,11 @@ stages: - name: Lint - name: Build and test - name: Github release - if: type != pull_request AND branch = master AND tag = true + if: type != pull_request AND branch = master AND tag = true AND repo = tomochain/tomochain - name: Build and push tomochain/tomochain image - if: type != pull_request AND branch = master + if: type != pull_request AND branch = master AND repo = tomochain/tomochain - name: Trigger rebuild of tomochain/infra-tomochain image - if: type != pull_request AND branch = master + if: type != pull_request AND branch = master AND repo = tomochain/tomochain notifications: slack: From 5db0e81b200a669e7cbae6d68d368715b70a42db Mon Sep 17 00:00:00 2001 From: etienne-napoleone Date: Fri, 27 Jul 2018 10:57:21 +0700 Subject: [PATCH 9/9] Fix duplicated deploy key --- .travis.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index b66f68466e..cbbc5a6a67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -63,21 +63,20 @@ jobs: install: skip script: skip deploy: - provider: script - script: - - bash docker_push.sh latest - - bash docker_push.sh $TRAVIS_BUILD_ID - on: - branch: master - tags: false - deploy: - provider: script - script: - - bash docker_push.sh latest - - bash docker_push.sh $TRAVIS_TAG - on: - branch: master - tags: true + - provider: script + script: + - bash docker_push.sh latest + - bash docker_push.sh $TRAVIS_BUILD_ID + on: + branch: master + tags: false + - provider: script + script: + - bash docker_push.sh latest + - bash docker_push.sh $TRAVIS_TAG + on: + branch: master + tags: true - stage: Trigger rebuild of tomochain/infra-tomochain image sudo: false