Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kit-image-deployer

Package Overview
Dependencies
Maintainers
7
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kit-image-deployer - npm Package Compare versions

Comparing version 3.3.4-PRERELEASE-github-abuse-updates.0 to 3.3.4

12

package.json
{
"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"
}
}
]
}

110

src/lib/image-deployer.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc