diff --git a/.build/publish-docker.sh b/.build/publish-docker.sh index d0868da43..4afeb39a1 100755 --- a/.build/publish-docker.sh +++ b/.build/publish-docker.sh @@ -25,4 +25,4 @@ cp ./README.md ./packages/caliper-fisco-bcos/README.md cd ./packages/caliper-publish/ npm i -./publish.js docker --user klenik --publish +./publish.js docker --publish diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5361c56fb..000000000 --- a/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -language: node_js -node_js: -- "10" - -services: -- docker - -dist: xenial - -before_install: | - set -ev - set -o pipefail - npm install -g @alrra/travis-scripts - -env: - global: - - secure: "YKjfZ5p7MU6MKgVMC4kKbYNw3t9rtLHl7DGNe31S07ax/Xsp9oPpyExUCVHnmm9Qalk9RdecxWL6hSefujIxY6xYydYiaa1JBl+SewkorMZ3I0ew1q/DYS+39BXgH2o0YvQXt6gnkY+Ik520r+TCEzFJxqTB+1K5HevVHCR/pw2qAmSTXktc3YWHO813zyVzs1pD4xWs/J/pvEKhip7nYOgXWFrKiXrJCE/l/gDrS+3bejwk6cRZQ4qzyISns9FAMqytU1NAnSEfjTClkoj/eAJan+3HEUggoanveqgRKuG7jLTDjI664vulLogIWuDdhACh4+BL7ic7XNDoU2fGQCwexZVb34I2DE0VRGAtuVBWvWhKYW6auxgWeO0Fz29uFS/59X8hXaOfzOA5OMXiYVv6vUWKPYx3wMOZWHDAUZE7cDhTAte13PCKnQzq5EdrsoVFDr0bA5u4y3KQ4aiAFJJjX0qBZAtICT2SQkOPY1egooobruVjV+7h0Q7sDHP3mNGpIxW96dHUQmbyuzGZ69tv0S55WQdHUNA1ODFeURcoKI+bGCciNDDbkQ9OcnIjooeJRE+xW2K4eSZRYV1SFUSeFGbdLcuMaDNNMnaQQygqrUHeWijP6uma2m1HtJnzoqV+CYy2vBtjG4oDK/mPYBCwIN5D2laHkpPsEu86O9w=" - - secure: "3U5MfJ5YnPe3b97jwe17Oiy5MjhX92TK5OUKlTjuTiQhLFmPq0QipFv5HaFWBWWxT4a4yqz2B+L0lotKRLZXOU7EHuiIL0ObgENu0lpZCkN3t/6AdJaa0DBDrtqThGITp94894GbYYOi1p4DuEisa5tpOm+P0dquy8nTSBPAitCo+WmW3pKnZmt7TBtHoL+8qBjOgZCKNzwBsUx1HXOwGtwrQWHE+M1vfbR96XP15M4aE8TWJZ8/ga+VQ3hqkwB3S/TmWtsyqjIGzeCcZI17AE9Fxqb4kZe6CcvM+ntGaN5NT5TTGgErSjLPYYwhxYgQWiyShti7qdLJBt51ivt5GbtQaiNBbbPpbk9F0r8Ur9QpgfGhumURSDuloXmVtkjVrdkn+/E5suoSkvQZOWOOsFcNdsOYG7lOuHLoTbLItrXQf5mBKblBMG3A+Mmj4uhN4mRcZNtHRbiKhOABdZKP6vfocpH6+4Hq1Yzr7LuRL1/jhYa47qllhCxu586UznoGRXJQNMjuboqPVEURC1fhSweLw+rpOzLF6/aGizF60Xe/gFnIiLrLV0LaA0tRJt3tYbLcvR84bXPuRFe/jAmPX9qIVAwMdQ/aXSRe38WK2rCXb7TDl6tlGr3SH0tXcCuT+IeqClvKkq1179Y3SuZItKgzMYvU+V18EhXBJRyhXcc=" - -# NOTE: the unit test and integration test jobs are only run "for the PR". In this case the encrypted env vars are not present (are blank). -# The NPM and Docker Hub publish jobs are only run when the PR is merged. In this case the encrypted env vars are present, since the repo slug is hyperledger/caliper. -# So the presence of encrypted vars are used as conditions for the jobs. -jobs: - include: - - stage: checks and unit tests - name: Package name check, license check, lint check, unit tests - if: type = pull_request OR repo != hyperledger/caliper - script: ./.build/checks-and-unit-tests.sh - - # parallel integrations tests - - stage: benchmark integration tests - name: HL Fabric integration test - if: type = pull_request OR repo != hyperledger/caliper - script: BENCHMARK=fabric ./.build/benchmark-integration-test-direct.sh - - name: Ethereum integration test - if: type = pull_request OR repo != hyperledger/caliper - script: BENCHMARK=ethereum ./.build/benchmark-integration-test-direct.sh - - name: HL Besu integration test - if: type = pull_request OR repo != hyperledger/caliper - script: BENCHMARK=besu ./.build/benchmark-integration-test-direct.sh - - name: FISCO-BCOS integration test - if: type = pull_request OR repo != hyperledger/caliper - script: BENCHMARK=fisco-bcos ./.build/benchmark-integration-test-direct.sh - - name: Generator integration test - if: type = pull_request OR repo != hyperledger/caliper - script: BENCHMARK=generator ./.build/benchmark-integration-test-direct.sh - - # publish packages - - stage: publish - name: Publishing to NPM and Docker Hub - if: type = push AND repo = hyperledger/caliper - script: ./.build/publish.sh - -cache: - directories: - - node_modules - -notifications: - webhooks: - on_success: always # default: always - on_failure: always # default: always - on_start: always # default: never - on_cancel: always # default: always - on_error: always # default: always diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8eb302435..542e6f549 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -115,3 +115,15 @@ stages: displayName: Publish packages env: NPM_TOKEN: "$(npm)" + - job: PublishDocker + displayName: "Publish Caliper Docker images" + steps: + - task: NodeTool@0 + inputs: + versionSpec: "10.x" + displayName: "Install Node.js" + - script: .build/publish-docker.sh + displayName: Publish packages + env: + DOCKER_USER: "$(DockerHub-Username)" + DOCKER_TOKEN: "$(DockerHub-Password)" diff --git a/packages/caliper-publish/lib/dockerCommand.js b/packages/caliper-publish/lib/dockerCommand.js index 7c22567a0..bcf03371b 100755 --- a/packages/caliper-publish/lib/dockerCommand.js +++ b/packages/caliper-publish/lib/dockerCommand.js @@ -45,13 +45,7 @@ module.exports.builder = yargs => { demand: false, default: false, type: 'boolean', - describe: 'Indicates whether to publish the built image. Requires that DOCKER_TOKEN and "user" argument is set.' - }, - user : { - alias: 'u', - demand: false, - type: 'string', - describe: 'The user to use for publishing the built Docker image. Required when the "--publish" flag is set.' + describe: 'Indicates whether to publish the built image. Requires that DOCKER_TOKEN and DOCKER_USER export variables are set.' }, retries: { alias: 'n', @@ -67,5 +61,5 @@ module.exports.builder = yargs => { }; module.exports.handler = argv => { - argv.thePromise = Docker.handler(argv.image, argv.registry, argv.publish, argv.user, argv.retries, argv.tag); + argv.thePromise = Docker.handler(argv.image, argv.registry, argv.publish, argv.retries, argv.tag); }; diff --git a/packages/caliper-publish/lib/impl/docker.js b/packages/caliper-publish/lib/impl/docker.js index ab82352a9..eb798c9b4 100644 --- a/packages/caliper-publish/lib/impl/docker.js +++ b/packages/caliper-publish/lib/impl/docker.js @@ -42,13 +42,12 @@ class Docker { * Handler for the docker command invocation. * @param {string} image The name for the built image. * @param {string} registry The NPM registry address to use for building the Docker image. Defaults to the public NPM registry. - * @param {boolean} publish Indicates whether to publish the built image. Requires that DOCKER_TOKEN and "user" argument is set. - * @param {string} user The user to use for publishing the built Docker image. Required when "publish" is true. + * @param {boolean} publish Indicates whether to publish the built image. Requires that DOCKER_TOKEN and DOCKER_USER exports are set. * @param {number} retries The number of times to retry the build in case of failures. * @param {string} tag Override for the version-based tag for testing purposes. * @async */ - static async handler(image, registry, publish, user, retries, tag) { + static async handler(image, registry, publish, retries, tag) { const cliPackageJsonPath = path.join(packagesRoot, 'caliper-cli', 'package.json'); const cliPackageVersion = require(cliPackageJsonPath).version; const cliPackageName = `@hyperledger/caliper-cli@${cliPackageVersion}`; @@ -127,7 +126,6 @@ class Docker { } let publishEnvs = { - DOCKER_USER: user, IMAGE: image, TAG: imageTag };