Skip to content

Commit 2573bd7

Browse files
chore: build dist deploy-cloud-functions (#63)
1 parent 6470936 commit 2573bd7

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

dist/index.js

+19-13
Original file line numberDiff line numberDiff line change
@@ -363967,13 +363967,16 @@ class CloudFunction {
363967363967
// Parse env vars
363968363968
let envVars;
363969363969
if (opts === null || opts === void 0 ? void 0 : opts.envVars) {
363970-
envVars = this.parseEnvVars(opts.envVars);
363970+
envVars = this.parseKVPairs(opts.envVars);
363971363971
request.environmentVariables = envVars;
363972363972
}
363973363973
if (opts === null || opts === void 0 ? void 0 : opts.envVarsFile) {
363974363974
envVars = this.parseEnvVarsFile(opts.envVarsFile);
363975363975
request.environmentVariables = envVars;
363976363976
}
363977+
if (opts === null || opts === void 0 ? void 0 : opts.labels) {
363978+
request.labels = this.parseKVPairs(opts.labels);
363979+
}
363977363980
this.request = request;
363978363981
this.name = opts.name;
363979363982
this.sourceDir = opts.sourceDir ? opts.sourceDir : './';
@@ -363987,22 +363990,22 @@ class CloudFunction {
363987363990
this.request.sourceUploadUrl = sourceUrl;
363988363991
}
363989363992
/**
363990-
* Parses a string of the format `KEY1=VALUE1`.
363993+
* Parses a string of the format `KEY1=VALUE1,KEY2=VALUE2`.
363991363994
*
363992-
* @param envVarInput Env var string to parse.
363995+
* @param values String with key/value pairs to parse.
363993363996
* @returns map of type {KEY1:VALUE1}
363994363997
*/
363995-
parseEnvVars(envVarInput) {
363996-
const envVarList = envVarInput.split(',');
363997-
const envVars = {};
363998-
envVarList.forEach((envVar) => {
363999-
if (!envVar.includes('=')) {
364000-
throw new TypeError(`Env Vars must be in "KEY1=VALUE1,KEY2=VALUE2" format, received ${envVar}`);
364001-
}
364002-
const keyValue = envVar.split('=');
364003-
envVars[keyValue[0]] = keyValue[1];
363998+
parseKVPairs(values) {
363999+
const valuePairs = values.split(',');
364000+
const kvPairs = {};
364001+
valuePairs.forEach((pair) => {
364002+
if (!pair.includes('=')) {
364003+
throw new TypeError(`The expected data format should be "KEY1=VALUE1", got "${pair}" while parsing "${values}"`);
364004+
}
364005+
const keyValue = pair.split('=');
364006+
kvPairs[keyValue[0]] = keyValue[1];
364004364007
});
364005-
return envVars;
364008+
return kvPairs;
364006364009
}
364007364010
/**
364008364011
* Read and parse an env var file.
@@ -364261,6 +364264,7 @@ class CloudFunctionClient {
364261364264
'eventTrigger.eventType',
364262364265
'eventTrigger.resource',
364263364266
'eventTrigger.service',
364267+
'labels',
364264364268
];
364265364269
const updateFunctionRequest = {
364266364270
updateMask: updateMasks.join(','),
@@ -364434,6 +364438,7 @@ function run() {
364434364438
const eventTriggerType = core.getInput('event_trigger_type');
364435364439
const eventTriggerResource = core.getInput('event_trigger_resource');
364436364440
const eventTriggerService = core.getInput('event_trigger_service');
364441+
const labels = core.getInput('labels');
364437364442
// Create Cloud Functions client
364438364443
const client = new cloudFunctionClient_1.CloudFunctionClient(region, { projectId, credentials });
364439364444
// Create Function definition
@@ -364453,6 +364458,7 @@ function run() {
364453364458
eventTriggerService,
364454364459
vpcConnector,
364455364460
serviceAccountEmail,
364461+
labels,
364456364462
});
364457364463
// Deploy function
364458364464
const deployFunctionResponse = yield client.deploy(newFunc);

0 commit comments

Comments
 (0)