From 92486427d9d53be80da797ded3d48bc19ede2622 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Tue, 28 May 2019 08:53:31 -0400 Subject: [PATCH 01/19] Add script to publish deb packages to bintray --- .gitignore | 2 + .travis.yml | 6 +- release/publish_deb_to_bintray.sh | 108 ++++++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) create mode 100755 release/publish_deb_to_bintray.sh diff --git a/.gitignore b/.gitignore index e9cd914..fd75581 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ coverage* .idea/* snap.login + +.DS_Store \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 17b3dc8..57c5ffb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,9 +30,11 @@ after_success: deploy: - provider: script skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash + script: >- + curl -sL https://git.io/goreleaser | bash && + ./release/publish_deb_to_bintray.sh verbose: true on: tags: true condition: "$TRAVIS_OS_NAME = linux" - master: true + master: true \ No newline at end of file diff --git a/release/publish_deb_to_bintray.sh b/release/publish_deb_to_bintray.sh new file mode 100755 index 0000000..f09e895 --- /dev/null +++ b/release/publish_deb_to_bintray.sh @@ -0,0 +1,108 @@ +#!/bin/sh + +set -e + +REPO="dunner-deb" +PACKAGE="dunner" +DISTRIBUTIONS="stable" +COMPONENTS="main" + +if [ -z "$USER" ]; then + echo "USER is not set" + exit 1 +fi + +if [ -z "$API_KEY" ]; then + echo "API_KEY is not set" + exit 1 +fi + +setVersion () { + VERSION=$(curl --silent "https://api.github.com/repos/leopardslab/dunner/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); +} + +setUploadDirPath () { + UPLOADDIRPATH="pool/d/$PACKAGE" +} + +downloadArtifacts() { + echo "Dowloading artifacts" + FILES=$(curl -s https://api.github.com/repos/leopardslab/dunner/releases/latest \ +| grep "browser_download_url.*deb" \ +| cut -d : -f 3 \ +| sed -e 's/^/https:/' \ +| tr -d '"' ); + echo $FILES + for i in $FILES; do + RESPONSE_CODE=$(curl -O $i) + if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + echo "Unable to download $i HTTP response code: $RESPONSE_CODE" + fi + done; + echo "Finished downloading" +} + +bintrayUpload () { + for i in $FILES; do + FILENAME=${i##*/} + ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) + if [ $ARCH == "386" ]; then + ARCH="i386" + fi + + URL="https://api.bintray.com/content/leopardslab/$REPO/$PACKAGE/$VERSION/$UPLOADDIRPATH/$FILENAME;deb_distribution=$DISTRIBUTIONS;deb_component=$COMPONENTS;deb_architecture=$ARCH?publish=1&override=1" + echo "Uploading $URL" + + CURL_COMMAND="curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null" + RESPONSE_CODE=$(CURL_COMMAND); + if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + echo "Unable to upload, HTTP response code: $RESPONSE_CODE" + exit 1 + fi + echo "HTTP response code: $RESPONSE_CODE" + done; +} + +bintraySetDownloads () { + for i in $FILES; do + FILENAME=${i##*/} + ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) + if [ $ARCH == "386" ]; then + ARCH="i386" + fi + URL="https://api.bintray.com/file_metadata/leopardslab/$REPO/$UPLOADDIRPATH/$FILENAME" + + echo "Putting $FILENAME in $PACKAGE's download list" + RESPONSE_CODE=$(curl -X PUT -d "{ \"list_in_downloads\": true }" -H "Content-Type: application/json" -u$USER:$API_KEY $URL -s -w "%{http_code}" -o /dev/null); + + if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + echo "Unable to put in download list, HTTP response code: $RESPONSE_CODE" + exit 1 + fi + echo "HTTP response code: $RESPONSE_CODE" + done +} + +snooze () { + echo "\nSleeping for 30 seconds. Have a coffee..." + sleep 30s; + echo "Done sleeping\n" +} + +printMeta () { + echo "Publishing: $PACKAGE" + echo "Version to be uploaded: $VERSION" +} + +cleanArtifacts () { + rm -f "$(pwd)/*.deb" +} + +cleanArtifacts +downloadArtifacts +setVersion +printMeta +setUploadDirPath +bintrayUpload +snooze +bintraySetDownloads From 27ac96ee460bdd2c7680162cb0725ed6172aebc6 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 09:56:48 +0530 Subject: [PATCH 02/19] check version of rpmbuild --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 57c5ffb..b3fe3c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,9 @@ addons: - rpm - snapd before_install: +- rpmbuild --version +- sudo apt-get update -qq +- rpmbuild --version - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in snap.login.enc -out snap.login -d - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 From 20bb24bcc0243be9396f041a1fc60391c06cd0b4 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 10:05:36 +0530 Subject: [PATCH 03/19] update version of rpmbuild --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b3fe3c3..fbca7b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ addons: - snapd before_install: - rpmbuild --version -- sudo apt-get update -qq +- sudo apt-get install -qq rpmbuild - rpmbuild --version - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in snap.login.enc -out snap.login -d From 1285a0800847d8d8837f6947a2a7b51bfc0d8c25 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 10:10:45 +0530 Subject: [PATCH 04/19] update version of rpmbuild --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fbca7b2..22edd8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ addons: - snapd before_install: - rpmbuild --version -- sudo apt-get install -qq rpmbuild +- sudo apt-get install -qq rpm - rpmbuild --version - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in snap.login.enc -out snap.login -d From 11f3ad280046d5c4ac325b0fb8ecaf1d1626315c Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 10:19:55 +0530 Subject: [PATCH 05/19] update rpm --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 22edd8e..035034c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ addons: - snapd before_install: - rpmbuild --version +- sudo apt-get update -qq - sudo apt-get install -qq rpm - rpmbuild --version - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv From 65ce74c69005047b3e761b53ec6a2fc22f7947b9 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 11:54:43 +0530 Subject: [PATCH 06/19] Format | Update rpm --- .goreleaser.yml | 6 ++---- .travis.yml | 13 +++++++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 6cc6e0a..8337f71 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -12,6 +12,7 @@ builds: - amd64 - arm - arm64 + archives: - replacements: 386: i386 @@ -48,10 +49,7 @@ nfpm: formats: - deb - rpm - dependencies: - - git - recommends: - - rpm + snapcraft: name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' summary: A Docker based task runner tool diff --git a/.travis.yml b/.travis.yml index 035034c..9eb339b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,36 +1,45 @@ language: go + go: - 1.11.x - master + env: global: - DEP_VERSION="0.5.0" - PATH=/snap/bin:$PATH + services: - docker addons: apt: + update: true packages: - rpm - snapd + before_install: - rpmbuild --version -- sudo apt-get update -qq -- sudo apt-get install -qq rpm +- sudo apt-get update +- sudo apt-get install -y rpm - rpmbuild --version - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in snap.login.enc -out snap.login -d - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep - chmod +x $GOPATH/bin/dep + install: - make setup - sudo snap install snapcraft --classic + script: - make ci + after_success: - bash <(curl -s https://codecov.io/bash) - test -n "$TRAVIS_TAG" && snapcraft login --with snap.login + deploy: - provider: script skip_cleanup: true From ad609653fd3b55e503ae4c6f67ff7428c14f5a1b Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 12:35:59 +0530 Subject: [PATCH 07/19] Add script to publish rpm packages --- .travis.yml | 22 +++++- release/publish_deb_to_bintray.sh | 9 ++- release/publish_rpm_to_bintray.sh | 107 ++++++++++++++++++++++++++++++ 3 files changed, 130 insertions(+), 8 deletions(-) create mode 100755 release/publish_rpm_to_bintray.sh diff --git a/.travis.yml b/.travis.yml index 9eb339b..c863eaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,9 +43,25 @@ after_success: deploy: - provider: script skip_cleanup: true - script: >- - curl -sL https://git.io/goreleaser | bash && - ./release/publish_deb_to_bintray.sh + script: curl -sL https://git.io/goreleaser + verbose: true + on: + tags: true + condition: "$TRAVIS_OS_NAME = linux" + master: true + +- provider: script + skip_cleanup: true + script: ./release/publish_deb_to_bintray.sh + verbose: true + on: + tags: true + condition: "$TRAVIS_OS_NAME = linux" + master: true + +- provider: script + skip_cleanup: true + script: ./release/publish_rpm_to_bintray.sh verbose: true on: tags: true diff --git a/release/publish_deb_to_bintray.sh b/release/publish_deb_to_bintray.sh index f09e895..cc2f80d 100755 --- a/release/publish_deb_to_bintray.sh +++ b/release/publish_deb_to_bintray.sh @@ -25,8 +25,8 @@ setUploadDirPath () { UPLOADDIRPATH="pool/d/$PACKAGE" } -downloadArtifacts() { - echo "Dowloading artifacts" +downloadDebianArtifacts() { + echo "Dowloading debian artifacts" FILES=$(curl -s https://api.github.com/repos/leopardslab/dunner/releases/latest \ | grep "browser_download_url.*deb" \ | cut -d : -f 3 \ @@ -53,8 +53,7 @@ bintrayUpload () { URL="https://api.bintray.com/content/leopardslab/$REPO/$PACKAGE/$VERSION/$UPLOADDIRPATH/$FILENAME;deb_distribution=$DISTRIBUTIONS;deb_component=$COMPONENTS;deb_architecture=$ARCH?publish=1&override=1" echo "Uploading $URL" - CURL_COMMAND="curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null" - RESPONSE_CODE=$(CURL_COMMAND); + RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null); if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then echo "Unable to upload, HTTP response code: $RESPONSE_CODE" exit 1 @@ -99,7 +98,7 @@ cleanArtifacts () { } cleanArtifacts -downloadArtifacts +downloadDebianArtifacts setVersion printMeta setUploadDirPath diff --git a/release/publish_rpm_to_bintray.sh b/release/publish_rpm_to_bintray.sh new file mode 100755 index 0000000..004c89b --- /dev/null +++ b/release/publish_rpm_to_bintray.sh @@ -0,0 +1,107 @@ +#!/bin/sh + +set -e + +REPO="dunner-rpm" +PACKAGE="dunner" +DISTRIBUTIONS="stable" +COMPONENTS="main" + +if [ -z "$USER" ]; then + echo "USER is not set" + exit 1 +fi + +if [ -z "$API_KEY" ]; then + echo "API_KEY is not set" + exit 1 +fi + +setVersion () { + VERSION=$(curl --silent "https://api.github.com/repos/leopardslab/dunner/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'); +} + +setUploadDirPath () { + UPLOADDIRPATH="$PACKAGE/$VERSION" +} + +downloadRpmArtifacts() { + echo "Dowloading rpm artifacts" + FILES=$(curl -s https://api.github.com/repos/leopardslab/dunner/releases/latest \ +| grep "browser_download_url.*rpm" \ +| cut -d : -f 3 \ +| sed -e 's/^/https:/' \ +| tr -d '"' ); + echo $FILES + for i in $FILES; do + RESPONSE_CODE=$(curl -O $i) + if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + echo "Unable to download $i HTTP response code: $RESPONSE_CODE" + fi + done; + echo "Finished downloading" +} + +bintrayUpload () { + for i in $FILES; do + FILENAME=${i##*/} + ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) + if [ $ARCH == "386" ]; then + ARCH="i386" + fi + + URL="https://api.bintray.com/content/leopardslab/$REPO/$PACKAGE/$VERSION/$UPLOADDIRPATH/$FILENAME?publish=1&override=1" + echo "Uploading $URL" + + RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null); + if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + echo "Unable to upload, HTTP response code: $RESPONSE_CODE" + exit 1 + fi + echo "HTTP response code: $RESPONSE_CODE" + done; +} + +bintraySetDownloads () { + for i in $FILES; do + FILENAME=${i##*/} + ARCH=$(echo ${FILENAME##*_} | cut -d '.' -f 1) + if [ $ARCH == "386" ]; then + ARCH="i386" + fi + URL="https://api.bintray.com/file_metadata/leopardslab/$REPO/$UPLOADDIRPATH/$FILENAME" + + echo "Putting $FILENAME in $PACKAGE's download list" + RESPONSE_CODE=$(curl -X PUT -d "{ \"list_in_downloads\": true }" -H "Content-Type: application/json" -u$USER:$API_KEY $URL -s -w "%{http_code}" -o /dev/null); + + if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + echo "Unable to put in download list, HTTP response code: $RESPONSE_CODE" + exit 1 + fi + echo "HTTP response code: $RESPONSE_CODE" + done +} + +snooze () { + echo "\nSleeping for 30 seconds. Have a coffee..." + sleep 30s; + echo "Done sleeping\n" +} + +printMeta () { + echo "Publishing: $PACKAGE" + echo "Version to be uploaded: $VERSION" +} + +cleanArtifacts () { + rm -f "$(pwd)/*.rpm" +} + +cleanArtifacts +downloadRpmArtifacts +setVersion +printMeta +setUploadDirPath +bintrayUpload +snooze +bintraySetDownloads From 31cc5eb3a2706353beafb45d53d3db3653d110cd Mon Sep 17 00:00:00 2001 From: apoorvam Date: Wed, 29 May 2019 14:45:08 +0530 Subject: [PATCH 08/19] Add maintainer name. else it gives a warning in apt --- .goreleaser.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.goreleaser.yml b/.goreleaser.yml index 8337f71..d3d6413 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -45,6 +45,7 @@ nfpm: name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' homepage: https://github.com/leopardslab/Dunner description: A Docker based task runner tool + maintainer: Milindu Sanoj Kumarage license: MIT formats: - deb From a22a1de3a11a34b520660c2fb2761bb9b0ec311c Mon Sep 17 00:00:00 2001 From: apoorvam Date: Mon, 10 Jun 2019 19:01:27 +0530 Subject: [PATCH 09/19] Make rpm release to bintry using Dunner --- .travis.yml | 2 +- release/.dunner.yaml | 10 ++++++++++ release/images/Dockerfile | 7 +++++++ release/publish_rpm_to_bintray.sh | 14 ++++++++------ 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 release/.dunner.yaml create mode 100644 release/images/Dockerfile diff --git a/.travis.yml b/.travis.yml index c863eaa..0547b15 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ deploy: - provider: script skip_cleanup: true - script: ./release/publish_rpm_to_bintray.sh + script: cd release && $GOPATH/bin/dunner do release_rpm verbose: true on: tags: true diff --git a/release/.dunner.yaml b/release/.dunner.yaml new file mode 100644 index 0000000..2d5d42c --- /dev/null +++ b/release/.dunner.yaml @@ -0,0 +1,10 @@ +release_rpm: + - image: apoorvam6/ubuntu-rpm:0.0.2 + commands: + - ["curl", "-O", "https://raw.githubusercontent.com/leopardslab/dunner/master/release/publish_rpm_to_bintray.sh"] + - ["chmod", "a+x", "./publish_rpm_to_bintray.sh"] + - ["rpmbuild", "--version"] + - ["./publish_rpm_to_bintray.sh"] + envs: + - USER=`$BITBUCKET_USER` + - API_KEY=`$BITBUCKET_API_KEY` diff --git a/release/images/Dockerfile b/release/images/Dockerfile new file mode 100644 index 0000000..6eb0146 --- /dev/null +++ b/release/images/Dockerfile @@ -0,0 +1,7 @@ +FROM ubuntu:latest + +WORKDIR /app + +RUN apt-get update && apt-get install -y \ + rpm \ + curl diff --git a/release/publish_rpm_to_bintray.sh b/release/publish_rpm_to_bintray.sh index 004c89b..787a330 100755 --- a/release/publish_rpm_to_bintray.sh +++ b/release/publish_rpm_to_bintray.sh @@ -4,8 +4,6 @@ set -e REPO="dunner-rpm" PACKAGE="dunner" -DISTRIBUTIONS="stable" -COMPONENTS="main" if [ -z "$USER" ]; then echo "USER is not set" @@ -32,11 +30,14 @@ downloadRpmArtifacts() { | cut -d : -f 3 \ | sed -e 's/^/https:/' \ | tr -d '"' ); - echo $FILES + echo "$FILES" for i in $FILES; do - RESPONSE_CODE=$(curl -O $i) - if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + RESPONSE_CODE=$(curl -O -w "%{response_code}" "$i") + echo "$RESPONSE_CODE" + code=$(echo "$RESPONSE_CODE" | head -c2) + if [[ $code != "20" && $code != "30" ]]; then echo "Unable to download $i HTTP response code: $RESPONSE_CODE" + exit 1 fi done; echo "Finished downloading" @@ -54,7 +55,7 @@ bintrayUpload () { echo "Uploading $URL" RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null); - if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + if [[ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]]; then echo "Unable to upload, HTTP response code: $RESPONSE_CODE" exit 1 fi @@ -105,3 +106,4 @@ setUploadDirPath bintrayUpload snooze bintraySetDownloads + From 8669b092d0d6634198872bd167ed2858124446ef Mon Sep 17 00:00:00 2001 From: apoorvam Date: Mon, 10 Jun 2019 19:04:19 +0530 Subject: [PATCH 10/19] Enable docker in travis build --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0547b15..efbf2e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,9 @@ go: - 1.11.x - master +services: + - docker + env: global: - DEP_VERSION="0.5.0" From 12d6c1ce70bc8d646c231376c44b31f097f55ee6 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Fri, 14 Jun 2019 12:56:57 +0530 Subject: [PATCH 11/19] Set maintainer to community --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index d3d6413..a58493e 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -45,7 +45,7 @@ nfpm: name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' homepage: https://github.com/leopardslab/Dunner description: A Docker based task runner tool - maintainer: Milindu Sanoj Kumarage + maintainer: LeopardsLab Community license: MIT formats: - deb From 6c9db0af044fc2cbf19e7b835b75e17d07cc94f9 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Fri, 14 Jun 2019 13:01:11 +0530 Subject: [PATCH 12/19] Run goreleaser script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index efbf2e8..d109aaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ after_success: deploy: - provider: script skip_cleanup: true - script: curl -sL https://git.io/goreleaser + script: curl -sL https://git.io/goreleaser | bash verbose: true on: tags: true From 0b1e4721b66711cb221648689db7ad6d4e4cf751 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Sat, 15 Jun 2019 12:52:23 +0530 Subject: [PATCH 13/19] Make release via dunner and rpm generation in docker --- .travis.yml | 19 +------------------ release/.dunner.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index d109aaf..09b7a53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,27 +44,10 @@ after_success: - test -n "$TRAVIS_TAG" && snapcraft login --with snap.login deploy: -- provider: script - skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash - verbose: true - on: - tags: true - condition: "$TRAVIS_OS_NAME = linux" - master: true - -- provider: script - skip_cleanup: true - script: ./release/publish_deb_to_bintray.sh - verbose: true - on: - tags: true - condition: "$TRAVIS_OS_NAME = linux" - master: true - provider: script skip_cleanup: true - script: cd release && $GOPATH/bin/dunner do release_rpm + script: $GOPATH/bin/dunner do release_dunner -t release/.dunner.yaml verbose: true on: tags: true diff --git a/release/.dunner.yaml b/release/.dunner.yaml index 2d5d42c..b43c3db 100644 --- a/release/.dunner.yaml +++ b/release/.dunner.yaml @@ -1,10 +1,10 @@ -release_rpm: +release_dunner: - image: apoorvam6/ubuntu-rpm:0.0.2 commands: - - ["curl", "-O", "https://raw.githubusercontent.com/leopardslab/dunner/master/release/publish_rpm_to_bintray.sh"] - - ["chmod", "a+x", "./publish_rpm_to_bintray.sh"] - ["rpmbuild", "--version"] - - ["./publish_rpm_to_bintray.sh"] + - ["curl", "-sL", "https://git.io/goreleaser | bash"] + - ["./release/publish_rpm_to_bintray.sh"] + - ["./release/publish_deb_to_bintray.sh"] envs: - USER=`$BITBUCKET_USER` - - API_KEY=`$BITBUCKET_API_KEY` + - API_KEY=`$BITBUCKET_API_KEY` \ No newline at end of file From e3446b2679d1fdc8266fe1f726b17a5c90ca726b Mon Sep 17 00:00:00 2001 From: apoorvam Date: Sun, 16 Jun 2019 01:38:51 +0530 Subject: [PATCH 14/19] Set mount dir as current directory for dunner release --- release/.dunner.yaml | 4 +++- release/publish_deb_to_bintray.sh | 10 ++++++---- release/publish_rpm_to_bintray.sh | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/release/.dunner.yaml b/release/.dunner.yaml index b43c3db..47e9b5e 100644 --- a/release/.dunner.yaml +++ b/release/.dunner.yaml @@ -7,4 +7,6 @@ release_dunner: - ["./release/publish_deb_to_bintray.sh"] envs: - USER=`$BITBUCKET_USER` - - API_KEY=`$BITBUCKET_API_KEY` \ No newline at end of file + - API_KEY=`$BITBUCKET_API_KEY` + mounts: + - ".:/app" \ No newline at end of file diff --git a/release/publish_deb_to_bintray.sh b/release/publish_deb_to_bintray.sh index cc2f80d..42877d6 100755 --- a/release/publish_deb_to_bintray.sh +++ b/release/publish_deb_to_bintray.sh @@ -34,8 +34,9 @@ downloadDebianArtifacts() { | tr -d '"' ); echo $FILES for i in $FILES; do - RESPONSE_CODE=$(curl -O $i) - if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + RESPONSE_CODE=$(curl -O -w "%{response_code}" "$i") + code=$(echo "$RESPONSE_CODE" | head -c2) + if [ $code != "20" ] && [ $code != "30" ]; then echo "Unable to download $i HTTP response code: $RESPONSE_CODE" fi done; @@ -53,8 +54,9 @@ bintrayUpload () { URL="https://api.bintray.com/content/leopardslab/$REPO/$PACKAGE/$VERSION/$UPLOADDIRPATH/$FILENAME;deb_distribution=$DISTRIBUTIONS;deb_component=$COMPONENTS;deb_architecture=$ARCH?publish=1&override=1" echo "Uploading $URL" - RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{http_code}" -o /dev/null); - if [ "$(echo $RESPONSE_CODE | head -c2)" != "20" ]; then + RESPONSE_CODE=$(curl -T $FILENAME -u$USER:$API_KEY $URL -I -s -w "%{response_code}" -o /dev/null); + code=$(echo "$RESPONSE_CODE" | head -c2) + if [ $code != "20" ] && [ $code != "30" ]; then echo "Unable to upload, HTTP response code: $RESPONSE_CODE" exit 1 fi diff --git a/release/publish_rpm_to_bintray.sh b/release/publish_rpm_to_bintray.sh index 787a330..afc928e 100755 --- a/release/publish_rpm_to_bintray.sh +++ b/release/publish_rpm_to_bintray.sh @@ -35,7 +35,7 @@ downloadRpmArtifacts() { RESPONSE_CODE=$(curl -O -w "%{response_code}" "$i") echo "$RESPONSE_CODE" code=$(echo "$RESPONSE_CODE" | head -c2) - if [[ $code != "20" && $code != "30" ]]; then + if [ $code != "20" ] && [ $code != "30" ]; then echo "Unable to download $i HTTP response code: $RESPONSE_CODE" exit 1 fi From 321e1422edaecaa72cdbc2d7bb223f8f63a7acf3 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Mon, 17 Jun 2019 10:41:43 +0530 Subject: [PATCH 15/19] Use separate goreleaser file for snap release --- .goreleaser.yml | 13 ++++--------- .snap_goreleaser.yml | 11 +++++++++++ .travis.yml | 9 +++++++++ release/.dunner.yaml | 6 +++--- 4 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 .snap_goreleaser.yml diff --git a/.goreleaser.yml b/.goreleaser.yml index a58493e..820bce6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -31,6 +31,10 @@ changelog: snapshot: name_template: "{{.ProjectName}}_{{.Tag}}" +release: + draft: true + name_template: "{{.ProjectName}} v{{.Version}}" + brew: github: owner: leopardslab @@ -51,12 +55,3 @@ nfpm: - deb - rpm -snapcraft: - name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - summary: A Docker based task runner tool - description: | - Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. | - You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname` - grade: stable - confinement: classic - publish: true diff --git a/.snap_goreleaser.yml b/.snap_goreleaser.yml new file mode 100644 index 0000000..a047a98 --- /dev/null +++ b/.snap_goreleaser.yml @@ -0,0 +1,11 @@ +project_name: dunner + +snapcraft: + name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + summary: A Docker based task runner tool + description: | + Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. | + You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname` + grade: stable + confinement: classic + publish: true diff --git a/.travis.yml b/.travis.yml index 09b7a53..a8eaadb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,15 @@ after_success: deploy: +- provider: script + skip_cleanup: true + script: curl -sL https://git.io/goreleaser | bash -s -- --config=.snap_goreleaser.yml --rm-dist + verbose: true + on: + tags: true + condition: "$TRAVIS_OS_NAME = linux" + master: true + - provider: script skip_cleanup: true script: $GOPATH/bin/dunner do release_dunner -t release/.dunner.yaml diff --git a/release/.dunner.yaml b/release/.dunner.yaml index 47e9b5e..25caf6b 100644 --- a/release/.dunner.yaml +++ b/release/.dunner.yaml @@ -2,11 +2,11 @@ release_dunner: - image: apoorvam6/ubuntu-rpm:0.0.2 commands: - ["rpmbuild", "--version"] - - ["curl", "-sL", "https://git.io/goreleaser | bash"] + - ["curl", "-sL", "https://git.io/goreleaser", "|", "bash", "-s", "--", "--rm-dist"] - ["./release/publish_rpm_to_bintray.sh"] - ["./release/publish_deb_to_bintray.sh"] envs: - - USER=`$BITBUCKET_USER` - - API_KEY=`$BITBUCKET_API_KEY` + - USER=`$BINTRAY_USER` + - API_KEY=`$BINTRAY_API_KEY` mounts: - ".:/app" \ No newline at end of file From 56b5544fcd3fd638a21cb60c432dcc234e8b6ae9 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Tue, 18 Jun 2019 15:58:33 +0530 Subject: [PATCH 16/19] Remove from draft mode since publish uses github release for packages --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 820bce6..82313ea 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -32,7 +32,7 @@ snapshot: name_template: "{{.ProjectName}}_{{.Tag}}" release: - draft: true + draft: false name_template: "{{.ProjectName}} v{{.Version}}" brew: From d6a885e9b3e8248339cdfb3e769bb1cdc1777aea Mon Sep 17 00:00:00 2001 From: apoorvam Date: Fri, 28 Jun 2019 15:07:39 +0530 Subject: [PATCH 17/19] Update snap release and remove snapcraft.yaml since release is managed by goreleaser --- .snap_goreleaser.yml | 8 +++++++- snapcraft.yaml | 24 ------------------------ 2 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 snapcraft.yaml diff --git a/.snap_goreleaser.yml b/.snap_goreleaser.yml index a047a98..0d88f4e 100644 --- a/.snap_goreleaser.yml +++ b/.snap_goreleaser.yml @@ -7,5 +7,11 @@ snapcraft: Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. | You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname` grade: stable - confinement: classic + confinement: strict + base: core18 publish: true + apps: + dunner: + command: bin/dunner + plugs: + - ["home"] diff --git a/snapcraft.yaml b/snapcraft.yaml deleted file mode 100644 index ec68653..0000000 --- a/snapcraft.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: dunner -version: git -summary: A Docker based task runner tool -description: | - Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. | - You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname` -grade: stable -confinement: strict -base: core18 - -parts: - dunner: - plugin: go - go-importpath: github.com/leopardslab/dunner - source: . - source-type: git - build-packages: - - gcc - -apps: - dunner: - command: bin/dunner - plugs: - - personal-files From 66f43dab7718fe6ffffcd684516792a368f4b301 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Thu, 4 Jul 2019 13:00:56 +0530 Subject: [PATCH 18/19] Undo release of dunner via dunner as goreleaser is working fine with rpm package --- .goreleaser.yml | 17 +++++++++++++++-- .snap_goreleaser.yml | 17 ----------------- .travis.yml | 14 ++++++++++++-- release/.dunner.yaml | 12 ------------ release/images/Dockerfile | 7 ------- 5 files changed, 27 insertions(+), 40 deletions(-) delete mode 100644 .snap_goreleaser.yml delete mode 100644 release/.dunner.yaml delete mode 100644 release/images/Dockerfile diff --git a/.goreleaser.yml b/.goreleaser.yml index 82313ea..9a96230 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -35,8 +35,8 @@ release: draft: false name_template: "{{.ProjectName}} v{{.Version}}" -brew: - github: +brews: +- github: owner: leopardslab name: homebrew-dunner folder: Formula @@ -55,3 +55,16 @@ nfpm: - deb - rpm +snapcrafts: +- name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + summary: A Docker based task runner tool + description: | + Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. | + You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname` + grade: stable + confinement: strict + base: core18 + publish: true + apps: + dunner: + plugs: ["home"] diff --git a/.snap_goreleaser.yml b/.snap_goreleaser.yml deleted file mode 100644 index 0d88f4e..0000000 --- a/.snap_goreleaser.yml +++ /dev/null @@ -1,17 +0,0 @@ -project_name: dunner - -snapcraft: - name_template: '{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' - summary: A Docker based task runner tool - description: | - Dunner is a task runner tool like Grunt but used Docker images like CircleCI do. | - You can define tasks and steps of the tasks in your `.dunner.yaml` file and then run these steps with `Dunner do taskname` - grade: stable - confinement: strict - base: core18 - publish: true - apps: - dunner: - command: bin/dunner - plugs: - - ["home"] diff --git a/.travis.yml b/.travis.yml index 89066be..bd9c11a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,7 +47,7 @@ deploy: - provider: script skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash -s -- --config=.snap_goreleaser.yml --rm-dist + script: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist verbose: true on: tags: true @@ -57,7 +57,17 @@ deploy: - provider: script skip_cleanup: true - script: $GOPATH/bin/dunner do release_dunner -t release/.dunner.yaml + script: bash release/publish_rpm_to_bintray.sh + verbose: true + on: + tags: true + condition: "$TRAVIS_OS_NAME = linux" + branch: master + go: 1.11.x + +- provider: script + skip_cleanup: true + script: bash release/publish_deb_to_bintray.sh verbose: true on: tags: true diff --git a/release/.dunner.yaml b/release/.dunner.yaml deleted file mode 100644 index 25caf6b..0000000 --- a/release/.dunner.yaml +++ /dev/null @@ -1,12 +0,0 @@ -release_dunner: - - image: apoorvam6/ubuntu-rpm:0.0.2 - commands: - - ["rpmbuild", "--version"] - - ["curl", "-sL", "https://git.io/goreleaser", "|", "bash", "-s", "--", "--rm-dist"] - - ["./release/publish_rpm_to_bintray.sh"] - - ["./release/publish_deb_to_bintray.sh"] - envs: - - USER=`$BINTRAY_USER` - - API_KEY=`$BINTRAY_API_KEY` - mounts: - - ".:/app" \ No newline at end of file diff --git a/release/images/Dockerfile b/release/images/Dockerfile deleted file mode 100644 index 6eb0146..0000000 --- a/release/images/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM ubuntu:latest - -WORKDIR /app - -RUN apt-get update && apt-get install -y \ - rpm \ - curl From 78c77ff0d91a9b01f6cac99b89e17162ac60d0d0 Mon Sep 17 00:00:00 2001 From: apoorvam Date: Thu, 4 Jul 2019 13:03:15 +0530 Subject: [PATCH 19/19] remove unwanted commands from travis script --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd9c11a..8a40ffc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,8 +12,6 @@ env: - DEP_VERSION="0.5.0" - PATH=/snap/bin:$PATH -services: -- docker addons: apt: update: true @@ -23,9 +21,6 @@ addons: before_install: - rpmbuild --version -- sudo apt-get update -- sudo apt-get install -y rpm -- rpmbuild --version - openssl aes-256-cbc -K $encrypted_12c8071d2874_key -iv $encrypted_12c8071d2874_iv -in snap.login.enc -out snap.login -d - curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64