Proxy support

pull/1766/head
Boris Staal 3 years ago
parent 2f484236b8
commit 847b0c7400
No known key found for this signature in database

File diff suppressed because one or more lines are too long

62479
dist/restore/index.js vendored

File diff suppressed because one or more lines are too long

62479
dist/save-only/index.js vendored

File diff suppressed because one or more lines are too long

62479
dist/save/index.js vendored

File diff suppressed because one or more lines are too long

912
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -30,10 +30,13 @@
"@actions/io": "^1.1.2",
"@aws-sdk/client-s3": "^3.309.0",
"@aws-sdk/lib-storage": "^3.309.0",
"@aws-sdk/node-http-handler": "^3.306.0",
"proxy-agent": "^5.0.0",
"semver": "^7.3.8",
"uuid": "^9.0.0"
},
"devDependencies": {
"@aws-sdk/types": "^3.306.0",
"@types/jest": "^27.5.2",
"@types/nock": "^11.1.0",
"@types/node": "^16.18.3",
@ -41,7 +44,6 @@
"@types/uuid": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@aws-sdk/types": "^3.306.0",
"@vercel/ncc": "^0.36.1",
"eslint": "^8.28.0",
"eslint-config-prettier": "^8.5.0",

@ -1,10 +1,10 @@
import * as core from "@actions/core";
import { S3ClientConfig } from "@aws-sdk/client-s3";
import * as cache from "./backend";
import { Events, Inputs, Outputs, State } from "./constants";
import { IStateProvider } from "./stateProvider";
import * as utils from "./utils/actionUtils";
import { getConfig } from "./utils/options";
async function restoreImpl(
stateProvider: IStateProvider
@ -32,18 +32,10 @@ async function restoreImpl(
const cachePaths = utils.getInputAsArray(Inputs.Path, {
required: true
});
const s3Config = {
credentials: {
accessKeyId: core.getInput(Inputs.AwsAccessKeyId),
secretAccessKey: core.getInput(Inputs.AwsSecretAccessKey)
},
region: core.getInput(Inputs.AwsRegion)
} as S3ClientConfig;
const s3Bucket = core.getInput(Inputs.AwsBucket);
const failOnCacheMiss = utils.getInputAsBool(Inputs.FailOnCacheMiss);
const lookupOnly = utils.getInputAsBool(Inputs.LookupOnly);
const s3Bucket = core.getInput(Inputs.AwsBucket);
const s3Config = getConfig();
const cacheKey = await cache.restoreCache(
cachePaths,

@ -1,10 +1,10 @@
import * as core from "@actions/core";
import { S3ClientConfig } from "@aws-sdk/client-s3";
import * as cache from "./backend";
import { Events, Inputs, State } from "./constants";
import { IStateProvider } from "./stateProvider";
import * as utils from "./utils/actionUtils";
import { getConfig } from "./utils/options";
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
@ -52,16 +52,8 @@ async function saveImpl(stateProvider: IStateProvider): Promise<number | void> {
const cachePaths = utils.getInputAsArray(Inputs.Path, {
required: true
});
const s3Config = {
credentials: {
accessKeyId: core.getInput(Inputs.AwsAccessKeyId),
secretAccessKey: core.getInput(Inputs.AwsSecretAccessKey)
},
region: core.getInput(Inputs.AwsRegion)
} as S3ClientConfig;
const s3Bucket = core.getInput(Inputs.AwsBucket);
const s3Config = getConfig();
cacheId = await cache.saveCache(
cachePaths,

@ -1,7 +1,32 @@
import * as core from "@actions/core";
import { getProxyUrl } from "@actions/http-client";
import { S3ClientConfig } from "@aws-sdk/client-s3";
import { NodeHttpHandler } from "@aws-sdk/node-http-handler";
import ProxyAgent from "proxy-agent";
import { Inputs } from "../constants";
import { DownloadOptions, UploadOptions } from "./contracts";
export function getConfig(): S3ClientConfig {
const proxy = getProxyUrl("https://amazonaws.com");
const config: S3ClientConfig = {
credentials: {
accessKeyId: core.getInput(Inputs.AwsAccessKeyId),
secretAccessKey: core.getInput(Inputs.AwsSecretAccessKey)
},
region: core.getInput(Inputs.AwsRegion)
};
if (proxy) {
config.requestHandler = new NodeHttpHandler({
httpsAgent: ProxyAgent(proxy)
});
}
return config;
}
/**
* Returns a copy of the upload options with defaults filled in.
*

Loading…
Cancel
Save