Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

Use precise revision hash length #28

Merged
merged 1 commit into from Jan 25, 2017
Merged

Conversation

lexmarin
Copy link
Member

  • ran into problem using incorrect revision hash length
  • using precise revision hash length now

Copy link
Member

@LeZuse LeZuse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍 Have you tested the whole set up? Rollbar etc .. We can merge after we're sure nothing breaks. Then we will bump the patch version and publish to npm.

@lexmarin lexmarin force-pushed the feature/rev-hash-length branch 2 times, most recently from 6428d69 to 0109834 Compare January 18, 2017 16:30
LeZuse
LeZuse previously approved these changes Jan 19, 2017
request.post(config.notifyWebHook).send(payload).end();
if (config.notifyWebHook) {
request.post(config.notifyWebHook).send(payload).end();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

var DEFAULT_CONFIG_ABBREV = 7;

var path = require('path');
var config = require(path.join(process.cwd(), CONFIG_FILENAME))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are more places where the config could be stored. See https://github.com/productboard/webpack-deploy/pull/28/files#diff-1bf37fe770044c540521fd30ab26dec4R19
We could just export a function to get the config file.

var argv = require('yargs').string('env').argv;

var env = argv.env;
var abbrev = (config['git'][env] && config['git'][env].abbrev) || DEFAULT_CONFIG_ABBREV;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should check for config['git'].abbrev

@@ -54,7 +54,8 @@ case "$ENV" in
exit 1
esac

COMMIT=`git rev-parse --short HEAD`
ABBREV_LENGTH=`node ${DIRNAME}/config-abbrev --env=${ENV}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you said, I also don't think this is the ideal approach. Nevertheless it gets the job done and that's what's important here. We need to revisit this whole JS/Bash interop soon anyway.

Copy link
Member

@LeZuse LeZuse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few changes in config-rev needed to keep the compatibility intact.

@lexmarin lexmarin force-pushed the feature/rev-hash-length branch 2 times, most recently from 41ffeab to 478f3e3 Compare January 20, 2017 11:22
@lexmarin
Copy link
Member Author

@LeZuse I've incorporated changes and refactored requiring deploy config, please take a look at this.

return require(filename);
}
function requireConfig(silent) {
var filename = CONFIG_PATHS.filter(function(configPath) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use find instead of filter()[0]

var config = getConfigFor('git', true);
var abbrev = (config && config.abbrev) || DEFAULT_CONFIG_ABBREV;

process.stdout.write(abbrev.toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bin/ folder is meant for executables. I would suggest to move this to utils.js, tasks/ or some new folder.

@LeZuse
Copy link
Member

LeZuse commented Jan 24, 2017

@marinale A few simple changes and we should be ready to merge.

@LeZuse LeZuse assigned lexmarin and unassigned LeZuse Jan 24, 2017
@lexmarin
Copy link
Member Author

@LeZuse Changes incorporated, installed and tested this particular commit in other repo and it works! Thanks for your review!

Copy link
Member

@LeZuse LeZuse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🎉

@lexmarin lexmarin merged commit abaa09d into master Jan 25, 2017
@lexmarin lexmarin deleted the feature/rev-hash-length branch January 25, 2017 09:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants