Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to node20 runtime and resolve bug with Http keepAlive settings #106

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,5 @@ outputs:
installed:
description: 'JSON object describing the versions that were installed.'
runs:
using: node16
using: node20
main: dist/index.js
9 changes: 6 additions & 3 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

78 changes: 53 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
komish marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@redhat-actions/eslint-config": "^1.3.2",
"@redhat-actions/tsconfig": "^1.2.0",
"@types/cheerio": "^0.22.29",
"@types/node": "^12.19.12",
"@types/node": "^20.14.11",
"@types/semver": "^7.3.6",
"@typescript-eslint/eslint-plugin": "^5.54.1",
"@typescript-eslint/parser": "^5.54.1",
Expand All @@ -38,7 +38,7 @@
"@actions/exec": "^1.0.4",
"@actions/github": "^5.0.0",
"@actions/glob": "^0.1.2",
"@actions/http-client": "^1.0.11",
"@actions/http-client": "^2.2.1",
"@actions/io": "^1.1.1",
"@actions/tool-cache": "^1.6.1",
"@octokit/core": "^3.5.1",
Expand Down
22 changes: 17 additions & 5 deletions src/util/utils.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import * as ghCore from "@actions/core";
import * as http from "@actions/http-client";
import * as http from "@actions/http-client/lib";
import * as ghIO from "@actions/io";
import * as path from "path";
import * as os from "os";
import * as fs from "fs";
import { IHttpClientResponse } from "@actions/http-client/interfaces";
import { HttpClientResponse } from "@actions/http-client/lib";
import {
ClientDetailOverrides, ClientFile, InstallableClient, MirrorClient,
} from "./types";

export const HttpClient = new http.HttpClient();
export const HttpClient = new http.HttpClient(
undefined,
undefined,
// Explicitl set keepAlive to false to workaround bug in node20 runtime
// https://github.com/nodejs/node/issues/47228
{ keepAlive: false }
);

export async function assertOkStatus(res: IHttpClientResponse): Promise<void> {
export async function assertOkStatus(res: HttpClientResponse): Promise<void> {
const status = res.message.statusCode;
if (status !== undefined && status >= 400) {
const method = res.message.method?.toUpperCase();
Expand Down Expand Up @@ -124,10 +130,16 @@ type Architecture = `${Architectures}`;

let currentArch: Architecture | undefined;

/**
* @returns The OpenShift binary architecture identifier corresponding to the
* runtime's architecture. E.g. "amd64" for "x64".
* @throws an error if the runtime's architecture does not translate to an
* architecture for which the OpenShift binaries are built.
*/
export function getArch(): Architecture {
if (currentArch == null) {
// https://nodejs.org/api/process.html#process_process_arch
let arch = process.arch;
let arch: Architecture | NodeJS.Architecture = process.arch;
if (arch === "x64") {
arch = Architectures.AMD64;
}
Expand Down
Loading