-
Notifications
You must be signed in to change notification settings - Fork 19
Conversation
…us Dockerfile matches
44b2c46
to
d7cf202
Compare
* More explicit error messages
use inquirer to pick
@KarateCowboy -- Does this need to be merged before I can play with it? cc @tt |
1 similar comment
@KarateCowboy -- Does this need to be merged before I can play with it? cc @tt |
you can run the plugins locally by checking out the code and running |
@jbyrum no just check out the multiple-dockerfiles branch, then do as @dickeyxxx just suggested with |
multiple stuff seems good, I was able to get inquirer to at least prompt but it would probably be good to have @jbyrum do a more thorough test |
test/sanbashi.test.js
Outdated
expect(results.web[1]).to.have.property('depth', 2, 'dockerfile', './Nested/Dockerfile.web', 'postfix', 1) | ||
}) | ||
it('filters out by process type', () => { | ||
const dockerfiles = ['./Dockerfile.web', './Nested/Dockerfile.worker'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should use path.join()
so they could work on windows
commands/push.js
Outdated
|
||
try { | ||
let build = yield buildImage(resource, context.cwd, context.flags.verbose); | ||
for (let job of jobs) { | ||
cli.log(`\n=== Building ${ job.name } (${ job.dockerfile })`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cli.header might be preferable
commands/push.js
Outdated
let herokuHost = process.env.HEROKU_HOST || 'heroku.com' | ||
let registry = `registry.${ herokuHost }` | ||
let dockerfiles = Sanbashi.getDockerfiles(process.cwd(), recurse) | ||
let possibleJobs = Sanbashi.getJobs(`${ registry }/${ context.app }`, context.args, dockerfiles) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path.join here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, no it isn't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we should concat manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this code is fine
commands/push.js
Outdated
let jobs = yield Sanbashi.chooseJobs(possibleJobs) | ||
if (!jobs.length) { | ||
cli.warn('No images to push') | ||
process.exit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an error to me not a place for a warning
If the CLI uses the latest version of node now there's a good opportunity to use modern async constructs as well (like async/await instead of co). |
package.json
Outdated
"is-there": "4.0.0", | ||
"lodash": "3.3.1", | ||
"mkdirp": "^0.5.0", | ||
"node-uuid": "^1.4.3", | ||
"node-uuid": "1.4.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this package is deprecated
package.json
Outdated
@@ -19,28 +19,29 @@ | |||
"license": "ISC", | |||
"dependencies": { | |||
"camelcase": "1.0.2", | |||
"chalk": "1.1.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use cli.color
not chalk directly
commands/push.js
Outdated
if (context.args.length === 0 && !recurse) { | ||
cli.error(`Error: Requires either --recursive or one or more process types | ||
${Chalk.bold.underline.magenta('Usage:')} | ||
${ Chalk.white(' heroku container:push web')} # Pushes Dockerfile in current directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a style for this: cli.color.cmd()
check out the style guide
0eedbe1
to
434c6c4
Compare
use Path.join some formatting changes
434c6c4
to
9522087
Compare
Jbyrum text updates
} | ||
catch (err) { | ||
cli.error(`Error: docker login exited with ${ err }`); | ||
cli.error(`Error: docker login exited with ${ err }`) | ||
cli.hush(err.stack || err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should exit with a nonzero code, it looks like it's exiting with 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
commands/push.js
Outdated
const child = require('child_process'); | ||
let usage = ` | ||
${cli.color.bold.underline.magenta('Usage:')} | ||
${ cli.color.white('heroku container:push web')} # Pushes Dockerfile in current directory to web process type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use cli.color.cmd
commands/push.js
Outdated
} | ||
|
||
try { | ||
let push = yield pushImage(resource, context.flags.verbose); | ||
for (let job of jobs) { | ||
cli.styledHeader(`Pushing ${job.name} (${job.dockerfile })`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are a lot of little style issues like the indentation on this line. It's probably too much work to put it in for the whole project, but it would be good to run it at least on the new code
commands/logout.js
Outdated
|
||
module.exports = function(topic) { | ||
return { | ||
topic: topic, | ||
command: 'logout', | ||
flags: [{ name: 'verbose', char: 'v', hasValue: false }], | ||
description: 'Logs out from the Heroku Docker registry', | ||
description: 'logs out from the Heroku Container Registry', | ||
help: `Usage: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the CLI already automatically adds a "usage" help bit. Just take the help attribute out here since it's not adding anything useful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran heroku container:push web -a alpine-helloworld-dogwood
The header said "=== Building standard" rather than "=== Building web"
It is also pushing to a process type called 'standard':
v50 Deployed standard (701dbd3a2818) [email protected] 2017/05/23 15:31:20 -0700 (~ 7s ago)
@jbyrum fixed that issue |
This is now working for me -- I don't see any additional bugs. What's next? @dickeyxxx @tt |
@dickeyxxx poke poke. Please review |
commands/login.js
Outdated
flags: [{name: 'verbose', char: 'v', hasValue: false}], | ||
description: 'logs in to the Heroku Container Registry', | ||
help: `Usage: | ||
heroku container:login`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing the $ sign and this example shold show some output
commands/login.js
Outdated
flags: [{ name: 'verbose', char: 'v', hasValue: false }], | ||
description: 'Logs in to the Heroku Docker registry', | ||
flags: [{name: 'verbose', char: 'v', hasValue: false}], | ||
description: 'logs in to the Heroku Container Registry', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"logs into"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"logs in to" is actually correct. "in" is part of the verb phase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I recently ran through our entire help and audited everything: heroku/cli-engine#196
What I found was there is a mix of using present tense and another type that I think might be "imperative mood" but I'm not sure. Anyways, this "imperative mood" (if that is the correct term) is used much more commonly and I think makes more sense.
So in this case it would be "log in to the Heroku Container Registry". Not "logs in to the Heroku Container Registry". I plan to add this to the style guide.
Also, I'm not sure what language we use elsewhere in documentation, but I'm pretty sure in the CLI we never use "log in" as 2 words, it's always "login" and "logout". So I think my first comment here was wrong for a few reasons.
commands/push.js
Outdated
|
||
let possibleJobs = Sanbashi.getJobs(`${ registry }/${ context.app }`, dockerfiles) | ||
let jobs = [] | ||
if(recurse){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you run standard on this file at least to fix the formatting?
commands/login.js
Outdated
child.spawn('docker', args, { stdio: 'inherit' }) | ||
] | ||
log(verbose, args) | ||
child.spawn('docker', args, {stdio: 'inherit'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should abstract this into 1 spawn function that returns a promise
lib/sanbashi.js
Outdated
} | ||
|
||
Sanbashi.pushImage = function (resource, verbose) { | ||
console.dir(resource, { colors:true, depth: null }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this supposed to be in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed it
commands/push.js
Outdated
let usage = ` | ||
${cli.color.bold.underline.magenta('Usage:')} | ||
${ cli.color.cmd('heroku container:push web')} # Pushes Dockerfile in current directory to web process type | ||
${ cli.color.cmd('heroku container:push web worker --recursive')} # Pushes Dockerfile.web and Dockerfile.worker found in current & subdirectories |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these lines are far too long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should show output too if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback -- @KarateCowboy, can we update with this text? It adds new help text to -R
and new text for the heroku container:push
examples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
soon(-ish) we plan to have a format for examples since we use them so much: heroku/cli-engine#190
commands/logout.js
Outdated
flags: [{ name: 'verbose', char: 'v', hasValue: false }], | ||
description: 'Logs out from the Heroku Docker registry', | ||
flags: [{name: 'verbose', char: 'v', hasValue: false}], | ||
description: 'logs out from the Heroku Container Registry', | ||
needsApp: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add help with an output example?
return { | ||
topic: pkg.topic, | ||
description: pkg.description, | ||
help: pkg.description, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you put the help back in with an output example?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To which command are you referring? the basic heroku containers
just prints the version. What would you like added -- the sum of all the help for the other commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an example of it printing the version then, we're supposed to have output examples for every command. I realize that isn't the most useful thing in the world, but it clearly demonstrates what a command is for.
this is the (soon-to-be enforced) rule for core plugins anyways, but we should do it on any plugin we can
Made text updates to push
the same code was repeated in several places to spawn docker commands. Consolidated this into a helper method
Okay @tt and @jbyrum, got a preliminary implementation of the multiple dockerfiles UX. To test:
npm install
heroku plugins:link
Should go something like: