Comparing version 0.0.4 to 0.0.5
@@ -19,3 +19,3 @@ var crypto = require('crypto'); | ||
return Q() | ||
return Q() //jshint ignore:line | ||
.then(function () { | ||
@@ -26,2 +26,3 @@ | ||
var useDockerfileFromRepo = false; | ||
var repo = (repoOwner + '/' + repoName).replace(/-/g, '_').toLowerCase(); | ||
@@ -34,21 +35,30 @@ if (settings) { | ||
//if we use customer dockerfile, we don't have an image per repo, we have an image per sha. | ||
var revisionInfoIfRelevant = useDockerfileFromRepo ? latestSha : ''; | ||
function calcHash(sha) { | ||
var hash = crypto.createHash('sha1'); | ||
hash.update( | ||
JSON.stringify(build_sh) + | ||
JSON.stringify(start_sh) + | ||
JSON.stringify(useDockerfileFromRepo) + | ||
revisionInfoIfRelevant); | ||
var hash = | ||
crypto.createHash('sha1') | ||
.update( | ||
JSON.stringify(build_sh) + | ||
JSON.stringify(start_sh) + | ||
JSON.stringify(useDockerfileFromRepo) + | ||
sha) | ||
.digest('hex') | ||
.replace(/-/g, '_').toLowerCase(); | ||
var buildHash = hash.digest('hex').replace(/-/g, '_').toLowerCase(); | ||
var repo = (repoOwner + '/' + repoName).replace(/-/g, '_').toLowerCase(); | ||
return { | ||
build_sh: build_sh, | ||
start_sh: start_sh, | ||
hash: hash, | ||
repo: repo, | ||
imageName: repo + ':' + buildHash | ||
}; | ||
} | ||
var forRevision = calcHash(latestSha); | ||
//if we use customer dockerfile, we don't have an image per repo, we have an image per sha. | ||
var forRepo = useDockerfileFromRepo ? withSha : calcHash(''); | ||
return { | ||
build_sh: build_sh, | ||
start_sh: start_sh, | ||
hash: buildHash, | ||
repo: repo, | ||
imageName: repo + ':' + buildHash | ||
repo: forRepo, | ||
revision: forRevision | ||
}; | ||
@@ -55,0 +65,0 @@ }); |
{ | ||
"name": "cf-common", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "common modules for codefresh runtime and api", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2554
58