kit-image-deployer
Advanced tools
Comparing version 3.3.4-PRERELEASE-github-abuse-updates.0 to 3.3.4
{ | ||
"name": "kit-image-deployer", | ||
"version": "3.3.4-PRERELEASE-github-abuse-updates.0", | ||
"version": "3.3.4", | ||
"description": "A service that can be used to update given yaml files within a git repository with a new docker image path.", | ||
@@ -41,11 +41,3 @@ "repository": { | ||
"src" | ||
], | ||
"publishConfig": { | ||
"tag": "PRERELEASE-github-abuse-updates" | ||
}, | ||
"release": { | ||
"fallbackTags": { | ||
"PRERELEASE-github-abuse-updates": "latest" | ||
} | ||
} | ||
] | ||
} |
@@ -15,2 +15,3 @@ "use strict"; | ||
retries: 10, | ||
retryIncrement: 30, // seconds | ||
docker: { | ||
@@ -66,2 +67,3 @@ registry: undefined, | ||
self.emitter.emit("request", "Getting an image file from github"); | ||
return self.github.getContent(imageRequest).then(imageResponse => { | ||
@@ -102,2 +104,8 @@ // get | ||
if (tries > self.options.retries) { | ||
self.emitter.emit( | ||
"error", | ||
`Unable to update the image file after ${ | ||
self.options.retries | ||
} attempts final error: ${lastError}` | ||
); | ||
return reject(lastError); | ||
@@ -129,2 +137,3 @@ } | ||
self.emitter.emit("request", "Updating an image file in github"); | ||
self.github | ||
@@ -145,13 +154,8 @@ .updateFile({ | ||
let errCode = err && err.code ? err.code : undefined; | ||
if (errCode && errCode >= 500) { | ||
// don't retry 500 errors | ||
reject(err); | ||
} else { | ||
self.emitter.emit( | ||
"error", | ||
`Error updating image file status code ${errCode}, will retry after delay` | ||
); | ||
// try again after a delay | ||
self.retryAfterDelay(tries, err, attempt); | ||
} | ||
self.emitter.emit( | ||
"backoff", | ||
`Error updating image file status code ${errCode}, will retry after a delay` | ||
); | ||
// try again after a delay | ||
self.retryAfterDelay(tries, err, attempt); | ||
}); | ||
@@ -192,3 +196,3 @@ } else { | ||
self.emitter.emit( | ||
"info", | ||
"request", | ||
`Image file didn't exist creating image file` | ||
@@ -208,18 +212,18 @@ ); | ||
}) | ||
.catch(() => { | ||
// try again | ||
attempt(err); | ||
.catch(err => { | ||
let errCode = err && err.code ? err.code : undefined; | ||
// try again after a delay | ||
self.emitter.emit( | ||
"backoff", | ||
`Error creating image file status code ${errCode}, will retry after a delay` | ||
); | ||
self.retryAfterDelay(tries, err, attempt); | ||
}); | ||
} else { | ||
if (errCode && errCode >= 500) { | ||
// don't retry 500 errors | ||
reject(err); | ||
} else { | ||
self.emitter.emit( | ||
"error", | ||
`Error creating image file status code ${errCode}, will retry after delay` | ||
); | ||
// try again after a delay | ||
self.retryAfterDelay(tries, err, attempt); | ||
} | ||
self.emitter.emit( | ||
"backoff", | ||
`Error getting image file status code ${errCode}, will retry after a delay` | ||
); | ||
// try again after a delay | ||
self.retryAfterDelay(tries, err, attempt); | ||
} | ||
@@ -250,29 +254,29 @@ }); | ||
.catch(reject); | ||
} else { | ||
const configRequest = { | ||
user: self.options.github.user, | ||
repo: self.options.github.repo, | ||
path: "kit.yaml" | ||
}; | ||
self.github | ||
.getContent(configRequest) | ||
.then(function(configResponse) { | ||
const rawConfig = new Buffer( | ||
configResponse.content, | ||
configResponse.encoding | ||
).toString("ascii"); | ||
const config = yaml.safeLoad(rawConfig); | ||
return self.attemptCommit( | ||
config, | ||
image, | ||
branch, | ||
committer, | ||
message, | ||
save | ||
); | ||
}) | ||
.then(resolve) | ||
.catch(reject); | ||
} | ||
const configRequest = { | ||
user: self.options.github.user, | ||
repo: self.options.github.repo, | ||
path: "kit.yaml" | ||
}; | ||
self.github | ||
.getContent(configRequest) | ||
.then(function(configResponse) { | ||
const rawConfig = new Buffer( | ||
configResponse.content, | ||
configResponse.encoding | ||
).toString("ascii"); | ||
const config = yaml.safeLoad(rawConfig); | ||
return self.attemptCommit( | ||
config, | ||
image, | ||
branch, | ||
committer, | ||
message, | ||
save | ||
); | ||
}) | ||
.then(resolve) | ||
.catch(reject); | ||
}); | ||
@@ -289,3 +293,3 @@ } | ||
retryAfterDelay(attempt, err, func) { | ||
let retryDelay = attempt * 15 * 1000; | ||
let retryDelay = attempt * this.options.retryIncrement * 1000; | ||
return setTimeout(() => { | ||
@@ -292,0 +296,0 @@ return func(err); |
Sorry, the diff of this file is not supported yet
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
19365
278
1
1
1