Merge branch 'main' into robherley/artifact-digest
This commit is contained in:
commit
98c309c2e0
9 files changed
+68
-45
No files matched your search
+9
-1
@@ -77,4 +77,12 @@
|
|||||||
|
|
||||||
### 1.0.0
|
### 1.0.0
|
||||||
|
|
||||||
- Update `lockfileVersion` to `v2` in `package-lock.json [#1009](https://github.com/actions/toolkit/pull/1009)
|
- Update `lockfileVersion` to `v2` in `package-lock.json` [#1009](https://github.com/actions/toolkit/pull/1009)
|
||||||
|
|
||||||
|
### 1.0.1
|
||||||
|
|
||||||
|
- Update to v2.0.0 of `@actions/http-client`
|
||||||
|
|
||||||
|
### 1.0.2
|
||||||
|
|
||||||
|
- Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087)
|
||||||
@@ -3,7 +3,6 @@ import * as net from 'net'
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as configVariables from '../src/internal/config-variables'
|
import * as configVariables from '../src/internal/config-variables'
|
||||||
import {retry} from '../src/internal/requestUtils'
|
import {retry} from '../src/internal/requestUtils'
|
||||||
import {IHttpClientResponse} from '@actions/http-client/interfaces'
|
|
||||||
import {HttpClientResponse} from '@actions/http-client'
|
import {HttpClientResponse} from '@actions/http-client'
|
||||||
|
|
||||||
jest.mock('../src/internal/config-variables')
|
jest.mock('../src/internal/config-variables')
|
||||||
@@ -42,7 +41,7 @@ async function testRetry(
|
|||||||
|
|
||||||
async function handleResponse(
|
async function handleResponse(
|
||||||
testResponseCode: number | undefined
|
testResponseCode: number | undefined
|
||||||
): Promise<IHttpClientResponse> {
|
): Promise<HttpClientResponse> {
|
||||||
if (!testResponseCode) {
|
if (!testResponseCode) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Test incorrectly set up. reverse.pop() was called too many times so not enough test response codes were supplied'
|
'Test incorrectly set up. reverse.pop() was called too many times so not enough test response codes were supplied'
|
||||||
@@ -72,7 +71,7 @@ async function emptyMockReadBody(): Promise<string> {
|
|||||||
|
|
||||||
async function setupSingleMockResponse(
|
async function setupSingleMockResponse(
|
||||||
statusCode: number
|
statusCode: number
|
||||||
): Promise<IHttpClientResponse> {
|
): Promise<HttpClientResponse> {
|
||||||
const mockMessage = new http.IncomingMessage(new net.Socket())
|
const mockMessage = new http.IncomingMessage(new net.Socket())
|
||||||
const mockReadBody = emptyMockReadBody
|
const mockReadBody = emptyMockReadBody
|
||||||
mockMessage.statusCode = statusCode
|
mockMessage.statusCode = statusCode
|
||||||
|
|||||||
Generated
+32
-14
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/artifact",
|
"name": "@actions/artifact",
|
||||||
"version": "0.6.1",
|
"version": "1.0.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/artifact",
|
"name": "@actions/artifact",
|
||||||
"version": "0.6.1",
|
"version": "1.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^2.0.1",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"tmp-promise": "^3.0.2"
|
"tmp-promise": "^3.0.2"
|
||||||
},
|
},
|
||||||
@@ -20,14 +20,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
"version": "1.6.0",
|
"version": "1.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.0.tgz",
|
||||||
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
|
"integrity": "sha512-XirM+Zo/PFlA+1h+i4bkfvagujta+LIM2AOSzPbt8JqXbbuxb1HTB+FqIyaKmue9yiCx/JIJY6pXsOl3+T8JGw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^1.0.11"
|
"@actions/http-client": "^1.0.11"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/http-client": {
|
"node_modules/@actions/core/node_modules/@actions/http-client": {
|
||||||
"version": "1.0.11",
|
"version": "1.0.11",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
||||||
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
||||||
@@ -35,6 +35,14 @@
|
|||||||
"tunnel": "0.0.6"
|
"tunnel": "0.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@actions/http-client": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||||
|
"dependencies": {
|
||||||
|
"tunnel": "^0.0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/tmp": {
|
"node_modules/@types/tmp": {
|
||||||
"version": "0.2.3",
|
"version": "0.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.2.3.tgz",
|
||||||
@@ -187,19 +195,29 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.6.0",
|
"version": "1.8.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.8.0.tgz",
|
||||||
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
|
"integrity": "sha512-XirM+Zo/PFlA+1h+i4bkfvagujta+LIM2AOSzPbt8JqXbbuxb1HTB+FqIyaKmue9yiCx/JIJY6pXsOl3+T8JGw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^1.0.11"
|
"@actions/http-client": "^1.0.11"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/http-client": {
|
||||||
|
"version": "1.0.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
||||||
|
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
||||||
|
"requires": {
|
||||||
|
"tunnel": "0.0.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/http-client": {
|
"@actions/http-client": {
|
||||||
"version": "1.0.11",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||||
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tunnel": "0.0.6"
|
"tunnel": "^0.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/tmp": {
|
"@types/tmp": {
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/artifact",
|
"name": "@actions/artifact",
|
||||||
"version": "1.0.0",
|
"version": "1.0.2",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions artifact lib",
|
"description": "Actions artifact lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.2.6",
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^2.0.1",
|
||||||
"tmp": "^0.2.1",
|
"tmp": "^0.2.1",
|
||||||
"tmp-promise": "^3.0.2"
|
"tmp-promise": "^3.0.2"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {URL} from 'url'
|
|||||||
import {StatusReporter} from './status-reporter'
|
import {StatusReporter} from './status-reporter'
|
||||||
import {performance} from 'perf_hooks'
|
import {performance} from 'perf_hooks'
|
||||||
import {ListArtifactsResponse, QueryArtifactResponse} from './contracts'
|
import {ListArtifactsResponse, QueryArtifactResponse} from './contracts'
|
||||||
import {IHttpClientResponse} from '@actions/http-client/interfaces'
|
import {HttpClientResponse} from '@actions/http-client'
|
||||||
import {HttpManager} from './http-manager'
|
import {HttpManager} from './http-manager'
|
||||||
import {DownloadItem} from './download-specification'
|
import {DownloadItem} from './download-specification'
|
||||||
import {getDownloadFileConcurrency, getRetryLimit} from './config-variables'
|
import {getDownloadFileConcurrency, getRetryLimit} from './config-variables'
|
||||||
@@ -152,7 +152,7 @@ export class DownloadHttpClient {
|
|||||||
const headers = getDownloadHeaders('application/json', true, true)
|
const headers = getDownloadHeaders('application/json', true, true)
|
||||||
|
|
||||||
// a single GET request is used to download a file
|
// a single GET request is used to download a file
|
||||||
const makeDownloadRequest = async (): Promise<IHttpClientResponse> => {
|
const makeDownloadRequest = async (): Promise<HttpClientResponse> => {
|
||||||
const client = this.downloadHttpManager.getClient(httpClientIndex)
|
const client = this.downloadHttpManager.getClient(httpClientIndex)
|
||||||
return await client.get(artifactLocation, headers)
|
return await client.get(artifactLocation, headers)
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ export class DownloadHttpClient {
|
|||||||
|
|
||||||
// keep trying to download a file until a retry limit has been reached
|
// keep trying to download a file until a retry limit has been reached
|
||||||
while (retryCount <= retryLimit) {
|
while (retryCount <= retryLimit) {
|
||||||
let response: IHttpClientResponse
|
let response: HttpClientResponse
|
||||||
try {
|
try {
|
||||||
response = await makeDownloadRequest()
|
response = await makeDownloadRequest()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -295,7 +295,7 @@ export class DownloadHttpClient {
|
|||||||
* @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
|
* @param isGzip a boolean denoting if the content is compressed using gzip and if we need to decode it
|
||||||
*/
|
*/
|
||||||
async pipeResponseToFile(
|
async pipeResponseToFile(
|
||||||
response: IHttpClientResponse,
|
response: HttpClientResponse,
|
||||||
destinationStream: fs.WriteStream,
|
destinationStream: fs.WriteStream,
|
||||||
isGzip: boolean
|
isGzip: boolean
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {HttpClient} from '@actions/http-client/index'
|
import {HttpClient} from '@actions/http-client'
|
||||||
import {createHttpClient} from './utils'
|
import {createHttpClient} from './utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {IHttpClientResponse} from '@actions/http-client/interfaces'
|
import {HttpClientResponse} from '@actions/http-client'
|
||||||
import {
|
import {
|
||||||
isRetryableStatusCode,
|
isRetryableStatusCode,
|
||||||
isSuccessStatusCode,
|
isSuccessStatusCode,
|
||||||
@@ -11,11 +11,11 @@ import {getRetryLimit} from './config-variables'
|
|||||||
|
|
||||||
export async function retry(
|
export async function retry(
|
||||||
name: string,
|
name: string,
|
||||||
operation: () => Promise<IHttpClientResponse>,
|
operation: () => Promise<HttpClientResponse>,
|
||||||
customErrorMessages: Map<number, string>,
|
customErrorMessages: Map<number, string>,
|
||||||
maxAttempts: number
|
maxAttempts: number
|
||||||
): Promise<IHttpClientResponse> {
|
): Promise<HttpClientResponse> {
|
||||||
let response: IHttpClientResponse | undefined = undefined
|
let response: HttpClientResponse | undefined = undefined
|
||||||
let statusCode: number | undefined = undefined
|
let statusCode: number | undefined = undefined
|
||||||
let isRetryable = false
|
let isRetryable = false
|
||||||
let errorMessage = ''
|
let errorMessage = ''
|
||||||
@@ -71,9 +71,9 @@ export async function retry(
|
|||||||
|
|
||||||
export async function retryHttpClientRequest(
|
export async function retryHttpClientRequest(
|
||||||
name: string,
|
name: string,
|
||||||
method: () => Promise<IHttpClientResponse>,
|
method: () => Promise<HttpClientResponse>,
|
||||||
customErrorMessages: Map<number, string> = new Map(),
|
customErrorMessages: Map<number, string> = new Map(),
|
||||||
maxAttempts = getRetryLimit()
|
maxAttempts = getRetryLimit()
|
||||||
): Promise<IHttpClientResponse> {
|
): Promise<HttpClientResponse> {
|
||||||
return await retry(name, method, customErrorMessages, maxAttempts)
|
return await retry(name, method, customErrorMessages, maxAttempts)
|
||||||
}
|
}
|
||||||
@@ -32,8 +32,7 @@ import {promisify} from 'util'
|
|||||||
import {URL} from 'url'
|
import {URL} from 'url'
|
||||||
import {performance} from 'perf_hooks'
|
import {performance} from 'perf_hooks'
|
||||||
import {StatusReporter} from './status-reporter'
|
import {StatusReporter} from './status-reporter'
|
||||||
import {HttpCodes} from '@actions/http-client'
|
import {HttpCodes, HttpClientResponse} from '@actions/http-client'
|
||||||
import {IHttpClientResponse} from '@actions/http-client/interfaces'
|
|
||||||
import {HttpManager} from './http-manager'
|
import {HttpManager} from './http-manager'
|
||||||
import {UploadSpecification} from './upload-specification'
|
import {UploadSpecification} from './upload-specification'
|
||||||
import {UploadOptions} from './upload-options'
|
import {UploadOptions} from './upload-options'
|
||||||
@@ -421,7 +420,7 @@ export class UploadHttpClient {
|
|||||||
digest
|
digest
|
||||||
)
|
)
|
||||||
|
|
||||||
const uploadChunkRequest = async (): Promise<IHttpClientResponse> => {
|
const uploadChunkRequest = async (): Promise<HttpClientResponse> => {
|
||||||
const client = this.uploadHttpManager.getClient(httpClientIndex)
|
const client = this.uploadHttpManager.getClient(httpClientIndex)
|
||||||
return await client.sendStream('PUT', resourceUrl, openStream(), headers)
|
return await client.sendStream('PUT', resourceUrl, openStream(), headers)
|
||||||
}
|
}
|
||||||
@@ -432,7 +431,7 @@ export class UploadHttpClient {
|
|||||||
// Increments the current retry count and then checks if the retry limit has been reached
|
// Increments the current retry count and then checks if the retry limit has been reached
|
||||||
// If there have been too many retries, fail so the download stops
|
// If there have been too many retries, fail so the download stops
|
||||||
const incrementAndCheckRetryLimit = (
|
const incrementAndCheckRetryLimit = (
|
||||||
response?: IHttpClientResponse
|
response?: HttpClientResponse
|
||||||
): boolean => {
|
): boolean => {
|
||||||
retryCount++
|
retryCount++
|
||||||
if (retryCount > retryLimit) {
|
if (retryCount > retryLimit) {
|
||||||
@@ -469,7 +468,7 @@ export class UploadHttpClient {
|
|||||||
|
|
||||||
// allow for failed chunks to be retried multiple times
|
// allow for failed chunks to be retried multiple times
|
||||||
while (retryCount <= retryLimit) {
|
while (retryCount <= retryLimit) {
|
||||||
let response: IHttpClientResponse
|
let response: HttpClientResponse
|
||||||
|
|
||||||
try {
|
try {
|
||||||
response = await uploadChunkRequest()
|
response = await uploadChunkRequest()
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import crypto from 'crypto'
|
import crypto from 'crypto'
|
||||||
import {promises as fs} from 'fs'
|
import {promises as fs} from 'fs'
|
||||||
import {IncomingHttpHeaders} from 'http'
|
import {IncomingHttpHeaders, OutgoingHttpHeaders} from 'http'
|
||||||
import {debug, info, warning} from '@actions/core'
|
import {debug, info, warning} from '@actions/core'
|
||||||
import {HttpCodes, HttpClient} from '@actions/http-client'
|
import {HttpCodes, HttpClient, HttpClientResponse} from '@actions/http-client'
|
||||||
import {BearerCredentialHandler} from '@actions/http-client/auth'
|
import {BearerCredentialHandler} from '@actions/http-client/lib/auth'
|
||||||
import {IHeaders, IHttpClientResponse} from '@actions/http-client/interfaces'
|
|
||||||
import {
|
import {
|
||||||
getRuntimeToken,
|
getRuntimeToken,
|
||||||
getRuntimeUrl,
|
getRuntimeUrl,
|
||||||
@@ -141,8 +140,8 @@ export function getDownloadHeaders(
|
|||||||
contentType: string,
|
contentType: string,
|
||||||
isKeepAlive?: boolean,
|
isKeepAlive?: boolean,
|
||||||
acceptGzip?: boolean
|
acceptGzip?: boolean
|
||||||
): IHeaders {
|
): OutgoingHttpHeaders {
|
||||||
const requestOptions: IHeaders = {}
|
const requestOptions: OutgoingHttpHeaders = {}
|
||||||
|
|
||||||
if (contentType) {
|
if (contentType) {
|
||||||
requestOptions['Content-Type'] = contentType
|
requestOptions['Content-Type'] = contentType
|
||||||
@@ -184,8 +183,8 @@ export function getUploadHeaders(
|
|||||||
contentLength?: number,
|
contentLength?: number,
|
||||||
contentRange?: string,
|
contentRange?: string,
|
||||||
digest?: StreamDigest
|
digest?: StreamDigest
|
||||||
): IHeaders {
|
): OutgoingHttpHeaders {
|
||||||
const requestOptions: IHeaders = {}
|
const requestOptions: OutgoingHttpHeaders = {}
|
||||||
requestOptions['Accept'] = `application/json;api-version=${getApiVersion()}`
|
requestOptions['Accept'] = `application/json;api-version=${getApiVersion()}`
|
||||||
if (contentType) {
|
if (contentType) {
|
||||||
requestOptions['Content-Type'] = contentType
|
requestOptions['Content-Type'] = contentType
|
||||||
@@ -234,7 +233,7 @@ export function getArtifactUrl(): string {
|
|||||||
* Certain information such as the TLSSocket and the Readable state are not really useful for diagnostic purposes so they can be avoided.
|
* Certain information such as the TLSSocket and the Readable state are not really useful for diagnostic purposes so they can be avoided.
|
||||||
* Other information such as the headers, the response code and message might be useful, so this is displayed.
|
* Other information such as the headers, the response code and message might be useful, so this is displayed.
|
||||||
*/
|
*/
|
||||||
export function displayHttpDiagnostics(response: IHttpClientResponse): void {
|
export function displayHttpDiagnostics(response: HttpClientResponse): void {
|
||||||
info(
|
info(
|
||||||
`##### Begin Diagnostic HTTP information #####
|
`##### Begin Diagnostic HTTP information #####
|
||||||
Status Code: ${response.message.statusCode}
|
Status Code: ${response.message.statusCode}
|
||||||
|
|||||||
Reference in new issue
Block a user