Merge pull request #3409 from github/mbg/start-proxy/make-unique-artifact

Ensure that proxy log artifacts have unique names
This commit is contained in:
Michael B. Gale
2026-01-20 14:24:28 +00:00
committed by GitHub
7 changed files with 1718 additions and 1342 deletions
+26 -17
View File
@@ -125716,10 +125716,26 @@ async function uploadCombinedSarifArtifacts(logger, gitHubVariant, codeQlVersion
});
}
}
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, codeQlVersion) {
if (toUpload.length === 0) {
return "no-artifacts-to-upload";
function getArtifactSuffix(matrix) {
let suffix = "";
if (matrix) {
try {
const matrixObject = JSON.parse(matrix);
if (matrixObject !== null && typeof matrixObject === "object") {
for (const matrixKey of Object.keys(matrixObject).sort())
suffix += `-${matrixObject[matrixKey]}`;
} else {
core12.warning("User-specified `matrix` input is not an object.");
}
} catch {
core12.warning(
"Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."
);
}
}
return suffix;
}
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, codeQlVersion) {
const uploadSupported = isSafeArtifactUpload(codeQlVersion);
if (!uploadSupported) {
core12.info(
@@ -125727,24 +125743,17 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
);
return "upload-not-supported";
}
return uploadArtifacts(logger, toUpload, rootDir, artifactName, ghVariant);
}
async function uploadArtifacts(logger, toUpload, rootDir, artifactName, ghVariant) {
if (toUpload.length === 0) {
return "no-artifacts-to-upload";
}
if (isInTestMode()) {
await scanArtifactsForTokens(toUpload, logger);
core12.exportVariable("CODEQL_ACTION_ARTIFACT_SCAN_FINISHED", "true");
}
let suffix = "";
const matrix = getOptionalInput("matrix");
if (matrix) {
try {
for (const [, matrixVal] of Object.entries(
JSON.parse(matrix)
).sort())
suffix += `-${matrixVal}`;
} catch {
core12.info(
"Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."
);
}
}
const suffix = getArtifactSuffix(getOptionalInput("matrix"));
const artifactUploader = await getArtifactUploaderClient(logger, ghVariant);
try {
await artifactUploader.uploadArtifact(
+26 -17
View File
@@ -130453,10 +130453,26 @@ async function tryUploadAllAvailableDebugArtifacts(codeql, config, logger, codeQ
);
}
}
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, codeQlVersion) {
if (toUpload.length === 0) {
return "no-artifacts-to-upload";
function getArtifactSuffix(matrix) {
let suffix = "";
if (matrix) {
try {
const matrixObject = JSON.parse(matrix);
if (matrixObject !== null && typeof matrixObject === "object") {
for (const matrixKey of Object.keys(matrixObject).sort())
suffix += `-${matrixObject[matrixKey]}`;
} else {
core12.warning("User-specified `matrix` input is not an object.");
}
} catch {
core12.warning(
"Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."
);
}
}
return suffix;
}
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, codeQlVersion) {
const uploadSupported = isSafeArtifactUpload(codeQlVersion);
if (!uploadSupported) {
core12.info(
@@ -130464,24 +130480,17 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
);
return "upload-not-supported";
}
return uploadArtifacts(logger, toUpload, rootDir, artifactName, ghVariant);
}
async function uploadArtifacts(logger, toUpload, rootDir, artifactName, ghVariant) {
if (toUpload.length === 0) {
return "no-artifacts-to-upload";
}
if (isInTestMode()) {
await scanArtifactsForTokens(toUpload, logger);
core12.exportVariable("CODEQL_ACTION_ARTIFACT_SCAN_FINISHED", "true");
}
let suffix = "";
const matrix = getOptionalInput("matrix");
if (matrix) {
try {
for (const [, matrixVal] of Object.entries(
JSON.parse(matrix)
).sort())
suffix += `-${matrixVal}`;
} catch {
core12.info(
"Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."
);
}
}
const suffix = getArtifactSuffix(getOptionalInput("matrix"));
const artifactUploader = await getArtifactUploaderClient(logger, ghVariant);
try {
await artifactUploader.uploadArtifact(
+1542 -1256
View File
File diff suppressed because it is too large Load Diff
+26 -17
View File
@@ -124642,10 +124642,26 @@ async function uploadCombinedSarifArtifacts(logger, gitHubVariant, codeQlVersion
});
}
}
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, codeQlVersion) {
if (toUpload.length === 0) {
return "no-artifacts-to-upload";
function getArtifactSuffix(matrix) {
let suffix = "";
if (matrix) {
try {
const matrixObject = JSON.parse(matrix);
if (matrixObject !== null && typeof matrixObject === "object") {
for (const matrixKey of Object.keys(matrixObject).sort())
suffix += `-${matrixObject[matrixKey]}`;
} else {
core12.warning("User-specified `matrix` input is not an object.");
}
} catch {
core12.warning(
"Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."
);
}
}
return suffix;
}
async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghVariant, codeQlVersion) {
const uploadSupported = isSafeArtifactUpload(codeQlVersion);
if (!uploadSupported) {
core12.info(
@@ -124653,24 +124669,17 @@ async function uploadDebugArtifacts(logger, toUpload, rootDir, artifactName, ghV
);
return "upload-not-supported";
}
return uploadArtifacts(logger, toUpload, rootDir, artifactName, ghVariant);
}
async function uploadArtifacts(logger, toUpload, rootDir, artifactName, ghVariant) {
if (toUpload.length === 0) {
return "no-artifacts-to-upload";
}
if (isInTestMode()) {
await scanArtifactsForTokens(toUpload, logger);
core12.exportVariable("CODEQL_ACTION_ARTIFACT_SCAN_FINISHED", "true");
}
let suffix = "";
const matrix = getOptionalInput("matrix");
if (matrix) {
try {
for (const [, matrixVal] of Object.entries(
JSON.parse(matrix)
).sort())
suffix += `-${matrixVal}`;
} catch {
core12.info(
"Could not parse user-specified `matrix` input into JSON. The debug artifact will not be named with the user's `matrix` input."
);
}
}
const suffix = getArtifactSuffix(getOptionalInput("matrix"));
const artifactUploader = await getArtifactUploaderClient(logger, ghVariant);
try {
await artifactUploader.uploadArtifact(