1
0
Fork 0
pull/1505/head
Bethany 2023-08-23 13:55:26 -07:00
parent 03a876f0a7
commit 3b44a4cc23
3 changed files with 36 additions and 44 deletions

View File

@ -47,9 +47,7 @@ describe('upload-artifact', () => {
jest jest
.spyOn(zip, 'createZipUploadStream') .spyOn(zip, 'createZipUploadStream')
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1))) .mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
jest jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
.spyOn(util, 'getBackendIdsFromToken')
.mockReturnValue({
workflowRunBackendId: '1234', workflowRunBackendId: '1234',
workflowJobRunBackendId: '5678' workflowJobRunBackendId: '5678'
}) })
@ -64,9 +62,7 @@ describe('upload-artifact', () => {
signedUploadUrl: 'https://signed-upload-url.com' signedUploadUrl: 'https://signed-upload-url.com'
}) })
) )
jest jest.spyOn(blobUpload, 'uploadZipToBlobStorage').mockReturnValue(
.spyOn(blobUpload, 'uploadZipToBlobStorage')
.mockReturnValue(
Promise.resolve({ Promise.resolve({
isSuccess: true, isSuccess: true,
uploadSize: 1234, uploadSize: 1234,
@ -202,9 +198,7 @@ describe('upload-artifact', () => {
jest jest
.spyOn(zip, 'createZipUploadStream') .spyOn(zip, 'createZipUploadStream')
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1))) .mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
jest jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
.spyOn(util, 'getBackendIdsFromToken')
.mockReturnValue({
workflowRunBackendId: '1234', workflowRunBackendId: '1234',
workflowJobRunBackendId: '5678' workflowJobRunBackendId: '5678'
}) })
@ -259,9 +253,7 @@ describe('upload-artifact', () => {
jest jest
.spyOn(zip, 'createZipUploadStream') .spyOn(zip, 'createZipUploadStream')
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1))) .mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
jest jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
.spyOn(util, 'getBackendIdsFromToken')
.mockReturnValue({
workflowRunBackendId: '1234', workflowRunBackendId: '1234',
workflowJobRunBackendId: '5678' workflowJobRunBackendId: '5678'
}) })
@ -324,9 +316,7 @@ describe('upload-artifact', () => {
jest jest
.spyOn(zip, 'createZipUploadStream') .spyOn(zip, 'createZipUploadStream')
.mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1))) .mockReturnValue(Promise.resolve(new zip.ZipUploadStream(1)))
jest jest.spyOn(util, 'getBackendIdsFromToken').mockReturnValue({
.spyOn(util, 'getBackendIdsFromToken')
.mockReturnValue({
workflowRunBackendId: '1234', workflowRunBackendId: '1234',
workflowJobRunBackendId: '5678' workflowJobRunBackendId: '5678'
}) })
@ -341,9 +331,7 @@ describe('upload-artifact', () => {
signedUploadUrl: 'https://signed-upload-url.com' signedUploadUrl: 'https://signed-upload-url.com'
}) })
) )
jest jest.spyOn(blobUpload, 'uploadZipToBlobStorage').mockReturnValue(
.spyOn(blobUpload, 'uploadZipToBlobStorage')
.mockReturnValue(
Promise.resolve({ Promise.resolve({
isSuccess: true, isSuccess: true,
uploadSize: 1234, uploadSize: 1234,

View File

@ -61,7 +61,9 @@ export async function downloadArtifact(
} }
if (!(await exists(downloadPath))) { if (!(await exists(downloadPath))) {
core.debug(`Artifact destination folder does not exist, creating: ${downloadPath}`) core.debug(
`Artifact destination folder does not exist, creating: ${downloadPath}`
)
await fs.mkdir(downloadPath, {recursive: true}) await fs.mkdir(downloadPath, {recursive: true})
} else { } else {
core.debug(`Artifact destination folder already exists: ${downloadPath}`) core.debug(`Artifact destination folder already exists: ${downloadPath}`)

View File

@ -29,7 +29,9 @@ export async function listArtifacts(
repositoryName: string, repositoryName: string,
token: string token: string
): Promise<ListArtifactsResponse> { ): Promise<ListArtifactsResponse> {
info(`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}`) info(
`Fetching artifact list for workflow run ${workflowRunId} in repository ${repositoryOwner}/${repositoryName}`
)
const artifacts: Artifact[] = [] const artifacts: Artifact[] = []
const [retryOpts, requestOpts] = getRetryOptions( const [retryOpts, requestOpts] = getRetryOptions(