From 9717d3c1520c45bfa221df5e3f62827e7b891437 Mon Sep 17 00:00:00 2001 From: Niklas Gehlen Date: Mon, 26 Feb 2024 13:29:50 +0100 Subject: [PATCH] Use latest toolkit version --- actions-toolkit | 2 +- dist/merge/index.js | 47 +++++++++++++++++++++++++++++++++++++++++--- dist/upload/index.js | 47 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 89 insertions(+), 7 deletions(-) diff --git a/actions-toolkit b/actions-toolkit index 88f7a7bc..b110fb18 160000 --- a/actions-toolkit +++ b/actions-toolkit @@ -1 +1 @@ -Subproject commit 88f7a7bc6539cac7ffa0c3a28c2ddfd247aab279 +Subproject commit b110fb187a8a1b79faef3ce33b4ef2284f29793c diff --git a/dist/merge/index.js b/dist/merge/index.js index c3c5f22b..a0d67316 100644 --- a/dist/merge/index.js +++ b/dist/merge/index.js @@ -2904,8 +2904,8 @@ class ArtifactHttpClient { this.maxAttempts = 5; this.baseRetryIntervalMilliseconds = 3000; this.retryMultiplier = 1.5; - const token = (0, config_1.getRuntimeToken)(); - this.baseUrl = (0, config_1.getResultsServiceUrl)(); + const token = (0, config_1.getNamespaceToken)(); + this.baseUrl = (0, config_1.getNamespaceResultsServiceUrl)(); if (maxAttempts) { this.maxAttempts = maxAttempts; } @@ -3041,12 +3041,36 @@ exports.internalArtifactTwirpClient = internalArtifactTwirpClient; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; +exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getNamespaceResultsServiceUrl = exports.getResultsServiceUrl = exports.getNamespaceToken = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; const os_1 = __importDefault(__nccwpck_require__(22037)); +const fs = __importStar(__nccwpck_require__(57147)); // Used for controlling the highWaterMark value of the zip that is being streamed // The same value is used as the chunk size that is use during upload to blob storage function getUploadChunkSize() { @@ -3061,6 +3085,15 @@ function getRuntimeToken() { return token; } exports.getRuntimeToken = getRuntimeToken; +function getNamespaceToken() { + const tokenFile = process.env['NSC_TOKEN_FILE']; + if (!tokenFile) { + throw new Error('Unable to get the NSC_TOKEN_FILE env variable'); + } + const tokenJSON = fs.readFileSync(tokenFile, 'utf8'); + return JSON.parse(tokenJSON).bearer_token; +} +exports.getNamespaceToken = getNamespaceToken; function getResultsServiceUrl() { const resultsUrl = process.env['ACTIONS_RESULTS_URL']; if (!resultsUrl) { @@ -3069,6 +3102,14 @@ function getResultsServiceUrl() { return new URL(resultsUrl).origin; } exports.getResultsServiceUrl = getResultsServiceUrl; +function getNamespaceResultsServiceUrl() { + const resultsUrl = process.env['NAMESPACE_ACTIONS_RESULTS_URL']; + if (!resultsUrl) { + throw new Error('Unable to get the NAMESPACE_ACTIONS_RESULTS_URL env variable'); + } + return new URL(resultsUrl).origin; +} +exports.getNamespaceResultsServiceUrl = getNamespaceResultsServiceUrl; function isGhes() { const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const hostname = ghUrl.hostname.trimEnd().toUpperCase(); diff --git a/dist/upload/index.js b/dist/upload/index.js index 912714cc..76d44d6a 100644 --- a/dist/upload/index.js +++ b/dist/upload/index.js @@ -2904,8 +2904,8 @@ class ArtifactHttpClient { this.maxAttempts = 5; this.baseRetryIntervalMilliseconds = 3000; this.retryMultiplier = 1.5; - const token = (0, config_1.getRuntimeToken)(); - this.baseUrl = (0, config_1.getResultsServiceUrl)(); + const token = (0, config_1.getNamespaceToken)(); + this.baseUrl = (0, config_1.getNamespaceResultsServiceUrl)(); if (maxAttempts) { this.maxAttempts = maxAttempts; } @@ -3041,12 +3041,36 @@ exports.internalArtifactTwirpClient = internalArtifactTwirpClient; "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getResultsServiceUrl = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; +exports.getConcurrency = exports.getGitHubWorkspaceDir = exports.isGhes = exports.getNamespaceResultsServiceUrl = exports.getResultsServiceUrl = exports.getNamespaceToken = exports.getRuntimeToken = exports.getUploadChunkSize = void 0; const os_1 = __importDefault(__nccwpck_require__(22037)); +const fs = __importStar(__nccwpck_require__(57147)); // Used for controlling the highWaterMark value of the zip that is being streamed // The same value is used as the chunk size that is use during upload to blob storage function getUploadChunkSize() { @@ -3061,6 +3085,15 @@ function getRuntimeToken() { return token; } exports.getRuntimeToken = getRuntimeToken; +function getNamespaceToken() { + const tokenFile = process.env['NSC_TOKEN_FILE']; + if (!tokenFile) { + throw new Error('Unable to get the NSC_TOKEN_FILE env variable'); + } + const tokenJSON = fs.readFileSync(tokenFile, 'utf8'); + return JSON.parse(tokenJSON).bearer_token; +} +exports.getNamespaceToken = getNamespaceToken; function getResultsServiceUrl() { const resultsUrl = process.env['ACTIONS_RESULTS_URL']; if (!resultsUrl) { @@ -3069,6 +3102,14 @@ function getResultsServiceUrl() { return new URL(resultsUrl).origin; } exports.getResultsServiceUrl = getResultsServiceUrl; +function getNamespaceResultsServiceUrl() { + const resultsUrl = process.env['NAMESPACE_ACTIONS_RESULTS_URL']; + if (!resultsUrl) { + throw new Error('Unable to get the NAMESPACE_ACTIONS_RESULTS_URL env variable'); + } + return new URL(resultsUrl).origin; +} +exports.getNamespaceResultsServiceUrl = getNamespaceResultsServiceUrl; function isGhes() { const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const hostname = ghUrl.hostname.trimEnd().toUpperCase();