@catladder/pipeline 1.128.1 → 1.129.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,6 +35,11 @@ const setGoogleProjectNumberScript = (deployConfig: DeployConfigCloudRun) => [
35
35
  `echo "GCLOUD_PROJECT_NUMBER: $GCLOUD_PROJECT_NUMBER"`,
36
36
  ];
37
37
 
38
+ const makeLabelString = (obj: Record<string, unknown>) =>
39
+ Object.entries(obj)
40
+ .map(([key, value]) => `${key}=${value}`)
41
+ .join(",");
42
+
38
43
  export const createGoogleCloudRunDeployJobs = (
39
44
  context: Context
40
45
  ): CatladderJob[] => {
@@ -52,10 +57,6 @@ export const createGoogleCloudRunDeployJobs = (
52
57
  GCLOUD_DEPLOY_CREDENTIALS_KEY
53
58
  );
54
59
 
55
- const labelsString = Object.entries(getLabels(context))
56
- .map(([key, value]) => `${key}=${value}`)
57
- .join(",");
58
-
59
60
  const commonArgs = {
60
61
  project: deployConfig.projectId,
61
62
  region: deployConfig.region,
@@ -67,7 +68,6 @@ export const createGoogleCloudRunDeployJobs = (
67
68
  "set-cloudsql-instances": deployConfig.cloudSql
68
69
  ? deployConfig.cloudSql.instanceConnectionName
69
70
  : undefined,
70
- labels: labelsString,
71
71
  };
72
72
 
73
73
  const serviceName = getServiceName(context);
@@ -114,11 +114,15 @@ export const createGoogleCloudRunDeployJobs = (
114
114
  ? command
115
115
  : command.split(" ")
116
116
  : undefined;
117
-
117
+ const fullServiceName = `${serviceName}${nameSuffix ?? ""}`;
118
118
  const argsString = createArgsString({
119
119
  // command as empty string resets it to default (uses the image's entrypoint)
120
120
  command: commandArray ? '"' + commandArray.join(",") + '"' : '""',
121
121
  ...commonDeployArgs,
122
+ labels: makeLabelString({
123
+ ...getLabels(context),
124
+ "cloud-run-service-name": fullServiceName,
125
+ }),
122
126
  "env-vars-file": "____envvars.yaml",
123
127
  "min-instances": customConfig?.minInstances ?? 0,
124
128
  "max-instances": customConfig?.maxInstances ?? 100,
@@ -129,7 +133,7 @@ export const createGoogleCloudRunDeployJobs = (
129
133
  "cpu-boost": true,
130
134
  });
131
135
 
132
- return `gcloud run deploy ${serviceName}${nameSuffix ?? ""} ${argsString}`;
136
+ return `gcloud run deploy ${fullServiceName} ${argsString}`;
133
137
  };
134
138
 
135
139
  const getJobCreateScriptsForJob = (
@@ -148,6 +152,10 @@ export const createGoogleCloudRunDeployJobs = (
148
152
  const commonDeployArgsString = createArgsString({
149
153
  command: '"' + commandArray.join(",") + '"',
150
154
  ...commonDeployArgs,
155
+ labels: makeLabelString({
156
+ ...getLabels(context),
157
+ "cloud-run-job-name": jobName,
158
+ }),
151
159
  image: job.image || commonDeployArgs.image,
152
160
  memory: job.memory || "512Mi",
153
161
  "task-timeout": job.timeout || "10m",