Skip to content

Commit

Permalink
Merge pull request #307 from actions/v-alsvir/disable-cache-usage-tem…
Browse files Browse the repository at this point in the history
…p-v1

Temporarily disable image cache usage for v1
  • Loading branch information
AlenaSviridenko authored Aug 3, 2021
2 parents 56899e0 + 5f10e34 commit eb41679
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
6 changes: 4 additions & 2 deletions __tests__/installer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ describe('installer tests', () => {
}
}, 100000);

it('Uses version of node installed in cache', async () => {
// Usage of pre-cached Node.js is temporarily disabled.
xit('Uses version of node installed in cache', async () => {
const nodeDir: string = path.join(toolDir, 'node', '250.0.0', os.arch());
await io.mkdirP(nodeDir);
fs.writeFileSync(`${nodeDir}.complete`, 'hello');
Expand All @@ -111,7 +112,8 @@ describe('installer tests', () => {
return;
});

it('Resolves semantic versions of node installed in cache', async () => {
// Usage of pre-cached Node.js is temporarily disabled.
xit('Resolves semantic versions of node installed in cache', async () => {
const nodeDir: string = path.join(toolDir, 'node', '252.0.0', os.arch());
await io.mkdirP(nodeDir);
fs.writeFileSync(`${nodeDir}.complete`, 'hello');
Expand Down
7 changes: 5 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12231,7 +12231,8 @@ function getNode(versionSpec) {
let toolPath;
toolPath = tc.find('node', versionSpec);
// If not found in cache, download
if (!toolPath) {
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
let version;
const c = semver.clean(versionSpec) || '';
// If explicit version
Expand All @@ -12248,7 +12249,8 @@ function getNode(versionSpec) {
// check cache
toolPath = tc.find('node', version);
}
if (!toolPath) {
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
// download, extract, cache
toolPath = yield acquireNode(version);
}
Expand Down Expand Up @@ -12342,6 +12344,7 @@ function acquireNode(version) {
let downloadUrl = `https://nodejs.org/dist/v${version}/${urlFileName}`;
let downloadPath;
try {
core.info(`Downloading ${downloadUrl}`);
downloadPath = yield tc.downloadTool(downloadUrl);
}
catch (err) {
Expand Down
7 changes: 5 additions & 2 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export async function getNode(versionSpec: string) {
toolPath = tc.find('node', versionSpec);

// If not found in cache, download
if (!toolPath) {
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
let version: string;
const c = semver.clean(versionSpec) || '';
// If explicit version
Expand All @@ -45,7 +46,8 @@ export async function getNode(versionSpec: string) {
toolPath = tc.find('node', version);
}

if (!toolPath) {
// Usage of pre-cached Node.js is temporarily disabled.
if (true) {
// download, extract, cache
toolPath = await acquireNode(version);
}
Expand Down Expand Up @@ -146,6 +148,7 @@ async function acquireNode(version: string): Promise<string> {
let downloadPath: string;

try {
core.info(`Downloading ${downloadUrl}`);
downloadPath = await tc.downloadTool(downloadUrl);
} catch (err) {
if (err instanceof tc.HTTPError && err.httpStatusCode == 404) {
Expand Down

0 comments on commit eb41679

Please sign in to comment.