Skip to content

Commit

Permalink
Publish containers (#1117)
Browse files Browse the repository at this point in the history
  • Loading branch information
nklincoln authored Jan 6, 2021
1 parent 88a1568 commit c48f9ad
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 77 deletions.
2 changes: 1 addition & 1 deletion .build/publish-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
64 changes: 0 additions & 64 deletions .travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
10 changes: 2 additions & 8 deletions packages/caliper-publish/lib/dockerCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
};
6 changes: 2 additions & 4 deletions packages/caliper-publish/lib/impl/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -127,7 +126,6 @@ class Docker {
}

let publishEnvs = {
DOCKER_USER: user,
IMAGE: image,
TAG: imageTag
};
Expand Down

0 comments on commit c48f9ad

Please sign in to comment.