From ad2fd7b5e6069300af28654acc5deab5b60536c2 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Wed, 1 Jun 2022 13:18:50 +0000 Subject: [PATCH 01/13] Adding fix for tar exiting with code 1 issue --- RELEASES.md | 5 ++++- package.json | 2 +- src/internal/tar.ts | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 133be52..0c17c5e 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -64,4 +64,7 @@ - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087) ### 2.0.5 -- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) \ No newline at end of file +- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) + +### 2.0.6 +- Fix `Tar failed with error: The process '/usr/bin/tar' failed with exit code 1` issue when temp directory where tar is getting created is actually the subdirectory of the path mentioned by the user for caching. ([issue](https://github.com/actions/cache/issues/689)) diff --git a/package.json b/package.json index 813ac88..d2f8d10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/src/internal/tar.ts b/src/internal/tar.ts index fbea7c2..c809191 100644 --- a/src/internal/tar.ts +++ b/src/internal/tar.ts @@ -118,6 +118,8 @@ export async function createTar( ...getCompressionProgram(), '-cf', cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + '--exclude', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), From f4607ebf6872a6792f5018f59e948812a053ee14 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Wed, 1 Jun 2022 13:32:34 +0000 Subject: [PATCH 02/13] Adding updated package-lock.json for cache --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6a7414d..1971ba1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "license": "MIT", "dependencies": { "@actions/core": "^1.2.6", From 3738ec9e0e6ade1b7d9eb7adf432d32b29f3271a Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Fri, 3 Jun 2022 07:19:54 +0000 Subject: [PATCH 03/13] Fixed test case for tar creation --- __tests__/tar.test.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index fa81af9..038868a 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -143,6 +143,8 @@ test('zstd create tar', async () => { 'zstd -T0 --long=30', '-cf', IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, + '--exclude', + IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, @@ -180,6 +182,8 @@ test('gzip create tar', async () => { '-z', '-cf', IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, + '--exclude', + IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Gzip, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, From 030e8aae597e66eb2e64e5f9786645eeebb00557 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Fri, 3 Jun 2022 07:33:12 +0000 Subject: [PATCH 04/13] Fixed test case for Windows env --- __tests__/tar.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 038868a..4aed759 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -183,7 +183,7 @@ test('gzip create tar', async () => { '-cf', IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, '--exclude', - IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Gzip, + IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, From a3ed6186f82d52f855767cccffc7507d56c79ff9 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Fri, 3 Jun 2022 07:45:12 +0000 Subject: [PATCH 05/13] Changed an import in test case to standard import --- __tests__/tar.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 4aed759..9a3f0a6 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -5,7 +5,7 @@ import {CacheFilename, CompressionMethod} from '../src/internal/constants' import * as tar from '../src/internal/tar' import * as utils from '../src/internal/cacheUtils' // eslint-disable-next-line @typescript-eslint/no-require-imports -import fs = require('fs') +import * as fs from 'fs' jest.mock('@actions/exec') jest.mock('@actions/io') From babade1a371e70f08726923d01e9902ef175be37 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:05:12 +0000 Subject: [PATCH 06/13] Revert "Changed an import in test case to standard import" This reverts commit a3ed6186f82d52f855767cccffc7507d56c79ff9. --- __tests__/tar.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 9a3f0a6..4aed759 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -5,7 +5,7 @@ import {CacheFilename, CompressionMethod} from '../src/internal/constants' import * as tar from '../src/internal/tar' import * as utils from '../src/internal/cacheUtils' // eslint-disable-next-line @typescript-eslint/no-require-imports -import * as fs from 'fs' +import fs = require('fs') jest.mock('@actions/exec') jest.mock('@actions/io') From 427da1ded7ff50bb197e217ca0f722c64de322d6 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:56:13 +0000 Subject: [PATCH 07/13] Revert "Revert "Changed an import in test case to standard import"" This reverts commit babade1a371e70f08726923d01e9902ef175be37. --- __tests__/tar.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 4aed759..9a3f0a6 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -5,7 +5,7 @@ import {CacheFilename, CompressionMethod} from '../src/internal/constants' import * as tar from '../src/internal/tar' import * as utils from '../src/internal/cacheUtils' // eslint-disable-next-line @typescript-eslint/no-require-imports -import fs = require('fs') +import * as fs from 'fs' jest.mock('@actions/exec') jest.mock('@actions/io') From b4cbf6ed63658581a569a1d873758cf00b8cd3f7 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:56:16 +0000 Subject: [PATCH 08/13] Revert "Changed an import in test case to standard import" This reverts commit a3ed6186f82d52f855767cccffc7507d56c79ff9. --- __tests__/tar.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 9a3f0a6..4aed759 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -5,7 +5,7 @@ import {CacheFilename, CompressionMethod} from '../src/internal/constants' import * as tar from '../src/internal/tar' import * as utils from '../src/internal/cacheUtils' // eslint-disable-next-line @typescript-eslint/no-require-imports -import * as fs from 'fs' +import fs = require('fs') jest.mock('@actions/exec') jest.mock('@actions/io') From 54d053e436fe173b60b5b62e56ab1df35bb6ab8a Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:56:18 +0000 Subject: [PATCH 09/13] Revert "Fixed test case for Windows env" This reverts commit 030e8aae597e66eb2e64e5f9786645eeebb00557. --- __tests__/tar.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 4aed759..038868a 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -183,7 +183,7 @@ test('gzip create tar', async () => { '-cf', IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, '--exclude', - IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, + IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Gzip, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, From 1ae91a9cd4d67fa0dd2c980422947f84b4926e5c Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:56:23 +0000 Subject: [PATCH 10/13] Revert "Fixed test case for tar creation" This reverts commit 3738ec9e0e6ade1b7d9eb7adf432d32b29f3271a. --- __tests__/tar.test.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index 038868a..fa81af9 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -143,8 +143,6 @@ test('zstd create tar', async () => { 'zstd -T0 --long=30', '-cf', IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, - '--exclude', - IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, @@ -182,8 +180,6 @@ test('gzip create tar', async () => { '-z', '-cf', IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, - '--exclude', - IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Gzip, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, From ad0bcfaed55472064464860c46b0d4692fb79f94 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:56:25 +0000 Subject: [PATCH 11/13] Revert "Adding updated package-lock.json for cache" This reverts commit f4607ebf6872a6792f5018f59e948812a053ee14. --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1971ba1..6a7414d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "2.0.6", + "version": "2.0.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "2.0.6", + "version": "2.0.5", "license": "MIT", "dependencies": { "@actions/core": "^1.2.6", From 0c96c069dfdab4a42ab186e11b731853c420b025 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 07:56:27 +0000 Subject: [PATCH 12/13] Revert "Adding fix for tar exiting with code 1 issue" This reverts commit ad2fd7b5e6069300af28654acc5deab5b60536c2. --- RELEASES.md | 5 +---- package.json | 2 +- src/internal/tar.ts | 2 -- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 0c17c5e..133be52 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -64,7 +64,4 @@ - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087) ### 2.0.5 -- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) - -### 2.0.6 -- Fix `Tar failed with error: The process '/usr/bin/tar' failed with exit code 1` issue when temp directory where tar is getting created is actually the subdirectory of the path mentioned by the user for caching. ([issue](https://github.com/actions/cache/issues/689)) +- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) \ No newline at end of file diff --git a/package.json b/package.json index d2f8d10..813ac88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "2.0.6", + "version": "2.0.5", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/src/internal/tar.ts b/src/internal/tar.ts index c809191..fbea7c2 100644 --- a/src/internal/tar.ts +++ b/src/internal/tar.ts @@ -118,8 +118,6 @@ export async function createTar( ...getCompressionProgram(), '-cf', cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - '--exclude', - cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), From 24cec71274e3da3e436d239fff52293b6c44f785 Mon Sep 17 00:00:00 2001 From: Sankalp Kotewar <98868223+kotewar@users.noreply.github.com> Date: Mon, 6 Jun 2022 08:03:56 +0000 Subject: [PATCH 13/13] Reverted other package-lock.json --- RELEASES.md | 5 ++++- __tests__/tar.test.ts | 4 ++++ package-lock.json | 4 ++-- package.json | 2 +- src/internal/tar.ts | 2 ++ 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/RELEASES.md b/RELEASES.md index 133be52..aab5fc3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -64,4 +64,7 @@ - Update to v2.0.1 of `@actions/http-client` [#1087](https://github.com/actions/toolkit/pull/1087) ### 2.0.5 -- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) \ No newline at end of file +- Fix to avoid saving empty cache when no files are available for caching. ([issue](https://github.com/actions/cache/issues/624)) + +### 2.0.6 +- Fix `Tar failed with error: The process '/usr/bin/tar' failed with exit code 1` issue when temp directory where tar is getting created is actually the subdirectory of the path mentioned by the user for caching. ([issue](https://github.com/actions/cache/issues/689)) \ No newline at end of file diff --git a/__tests__/tar.test.ts b/__tests__/tar.test.ts index fa81af9..4aed759 100644 --- a/__tests__/tar.test.ts +++ b/__tests__/tar.test.ts @@ -143,6 +143,8 @@ test('zstd create tar', async () => { 'zstd -T0 --long=30', '-cf', IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, + '--exclude', + IS_WINDOWS ? CacheFilename.Zstd.replace(/\\/g, '/') : CacheFilename.Zstd, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, @@ -180,6 +182,8 @@ test('gzip create tar', async () => { '-z', '-cf', IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, + '--exclude', + IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, '-P', '-C', IS_WINDOWS ? workspace?.replace(/\\/g, '/') : workspace, diff --git a/package-lock.json b/package-lock.json index 6a7414d..1971ba1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "license": "MIT", "dependencies": { "@actions/core": "^1.2.6", diff --git a/package.json b/package.json index 813ac88..d2f8d10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@actions/cache", - "version": "2.0.5", + "version": "2.0.6", "preview": true, "description": "Actions cache lib", "keywords": [ diff --git a/src/internal/tar.ts b/src/internal/tar.ts index fbea7c2..c809191 100644 --- a/src/internal/tar.ts +++ b/src/internal/tar.ts @@ -118,6 +118,8 @@ export async function createTar( ...getCompressionProgram(), '-cf', cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), + '--exclude', + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), '-P', '-C', workingDirectory.replace(new RegExp(`\\${path.sep}`, 'g'), '/'),