Allow configured env fallback for GCS bucket

pull/1786/head
Jasperhino 2 months ago
parent 993ce21c74
commit 2f176eae24

@ -207,11 +207,13 @@ test("getGCSBucket returns gcs-bucket input when provided", () => {
try {
testUtils.setInput("gcs-bucket", "input-bucket");
process.env["CULA_CACHE_GCS_BUCKET"] = "env-bucket";
process.env["CONFIGURED_GCS_BUCKET"] = "configured-bucket";
expect(actionUtils.getGCSBucket()).toBe("input-bucket");
} finally {
testUtils.clearInputs();
delete process.env["CULA_CACHE_GCS_BUCKET"];
delete process.env["CONFIGURED_GCS_BUCKET"];
}
});
@ -225,15 +227,39 @@ test("getGCSBucket falls back to CULA_CACHE_GCS_BUCKET", () => {
}
});
test("getGCSBucket falls back to CONFIGURED_GCS_BUCKET", () => {
try {
process.env["CONFIGURED_GCS_BUCKET"] = "configured-bucket";
expect(actionUtils.getGCSBucket()).toBe("configured-bucket");
} finally {
delete process.env["CONFIGURED_GCS_BUCKET"];
}
});
test("getGCSBucket prefers CULA_CACHE_GCS_BUCKET over CONFIGURED_GCS_BUCKET", () => {
try {
process.env["CULA_CACHE_GCS_BUCKET"] = "env-bucket";
process.env["CONFIGURED_GCS_BUCKET"] = "configured-bucket";
expect(actionUtils.getGCSBucket()).toBe("env-bucket");
} finally {
delete process.env["CULA_CACHE_GCS_BUCKET"];
delete process.env["CONFIGURED_GCS_BUCKET"];
}
});
test("getGCSBucket returns empty string without input or environment variable", () => {
try {
testUtils.clearInputs();
delete process.env["CULA_CACHE_GCS_BUCKET"];
delete process.env["CONFIGURED_GCS_BUCKET"];
expect(actionUtils.getGCSBucket()).toBe("");
} finally {
testUtils.clearInputs();
delete process.env["CULA_CACHE_GCS_BUCKET"];
delete process.env["CONFIGURED_GCS_BUCKET"];
}
});

@ -27,7 +27,7 @@ inputs:
default: 'false'
required: false
gcs-bucket:
description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET environment variable when omitted.'
description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET or CONFIGURED_GCS_BUCKET environment variable when omitted.'
required: false
gcs-path-prefix:
description: 'Optional prefix path within the GCS bucket for cache files'

@ -78376,7 +78376,10 @@ function getInputAsBool(name, options) {
return result.toLowerCase() === "true";
}
function getGCSBucket() {
return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || "";
return (core.getInput(constants_1.Inputs.GCSBucket) ||
process.env["CULA_CACHE_GCS_BUCKET"] ||
process.env["CONFIGURED_GCS_BUCKET"] ||
"");
}
// Check if GCS is configured and available
function isGCSAvailable() {

@ -78376,7 +78376,10 @@ function getInputAsBool(name, options) {
return result.toLowerCase() === "true";
}
function getGCSBucket() {
return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || "";
return (core.getInput(constants_1.Inputs.GCSBucket) ||
process.env["CULA_CACHE_GCS_BUCKET"] ||
process.env["CONFIGURED_GCS_BUCKET"] ||
"");
}
// Check if GCS is configured and available
function isGCSAvailable() {

@ -78389,7 +78389,10 @@ function getInputAsBool(name, options) {
return result.toLowerCase() === "true";
}
function getGCSBucket() {
return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || "";
return (core.getInput(constants_1.Inputs.GCSBucket) ||
process.env["CULA_CACHE_GCS_BUCKET"] ||
process.env["CONFIGURED_GCS_BUCKET"] ||
"");
}
// Check if GCS is configured and available
function isGCSAvailable() {

@ -78389,7 +78389,10 @@ function getInputAsBool(name, options) {
return result.toLowerCase() === "true";
}
function getGCSBucket() {
return core.getInput(constants_1.Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || "";
return (core.getInput(constants_1.Inputs.GCSBucket) ||
process.env["CULA_CACHE_GCS_BUCKET"] ||
process.env["CONFIGURED_GCS_BUCKET"] ||
"");
}
// Check if GCS is configured and available
function isGCSAvailable() {

@ -24,7 +24,7 @@ inputs:
default: 'false'
required: false
gcs-bucket:
description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET environment variable when omitted.'
description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET or CONFIGURED_GCS_BUCKET environment variable when omitted.'
required: false
gcs-path-prefix:
description: 'Optional prefix path within the GCS bucket for cache files'

@ -16,7 +16,7 @@ inputs:
default: 'false'
required: false
gcs-bucket:
description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET environment variable when omitted.'
description: 'Google Cloud Storage bucket name to use for caching. When provided, GCS will be used as the cache backend. Defaults to the CULA_CACHE_GCS_BUCKET or CONFIGURED_GCS_BUCKET environment variable when omitted.'
required: false
gcs-path-prefix:
description: 'Optional prefix path within the GCS bucket for cache files'

@ -67,7 +67,12 @@ export function getInputAsBool(
}
export function getGCSBucket(): string {
return core.getInput(Inputs.GCSBucket) || process.env["CULA_CACHE_GCS_BUCKET"] || "";
return (
core.getInput(Inputs.GCSBucket) ||
process.env["CULA_CACHE_GCS_BUCKET"] ||
process.env["CONFIGURED_GCS_BUCKET"] ||
""
);
}
// Check if GCS is configured and available

Loading…
Cancel
Save