@leverege/build-tools 2.66.7 → 2.66.8

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.66.7",
3
+ "version": "2.66.8",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -73,7 +73,7 @@
73
73
  "glob": "^11.0.2",
74
74
  "handlebars": "^4.7.8",
75
75
  "ignore": "^7.0.4",
76
- "inquirer": "^12.6.0",
76
+ "inquirer": "^12.6.1",
77
77
  "js-yaml": "^4.1.0",
78
78
  "jsdoc": "^4.0.4",
79
79
  "ms": "^2.1.3",
@@ -82,7 +82,7 @@
82
82
  "p-limit": "^6.2.0",
83
83
  "package-up": "^5.0.0",
84
84
  "readline-sync": "^1.4.10",
85
- "semver": "^7.7.1",
85
+ "semver": "^7.7.2",
86
86
  "shell-quote": "^1.8.2",
87
87
  "simple-git": "^3.27.0",
88
88
  "toml": "^3.0.0",
package/src/Docker.mjs CHANGED
@@ -177,7 +177,7 @@ const buildContainerImage = async ( {
177
177
  artifactProject, artifactRegistry, containerName,
178
178
  imageVersion, isNpmWorkspace, options
179
179
  } ) => {
180
- const { useCloudBuildFile } = options || {}
180
+ const useCloudBuildFile = true // { useCloudBuildFile } = options || {}
181
181
  const buildWorkspace = './build/workspace' // passed to Cloud Build
182
182
  const imageName = `${artifactRegistry}/images/${containerName}`
183
183
 
@@ -216,25 +216,24 @@ const buildContainerImage = async ( {
216
216
  const { fullName : builderName } = await getGcpAccount()
217
217
  const gcloudBuild = `gcloud builds submit --project ${artifactProject}`
218
218
  const gcloudProjectNumber = await shellCmd( `gcloud projects describe ${artifactProject} --format="value(projectNumber)"` )
219
- const cloudBuildSA = `--service-account=${gcloudProjectNumber}-compute@cloudbuild.gserviceaccount.com`
219
+ const gcloudBuildSA = `--service-account=projects/${artifactProject}/serviceAccounts/${gcloudProjectNumber}-compute@developer.gserviceaccount.com`
220
220
  const gcloudLogs = `--gcs-log-dir ${formCloudBuildBucketName( artifactProject )}/log`
221
- let gcloudTags = `--tag ${imageName}:${imageVersion}`
221
+ const imageTag = `${defaultSettings.date}-${defaultSettings.nodeimage}-${builderName}`
222
222
 
223
- if ( useCloudBuildFile ) {
224
- const cloudBuildFile = './docker/cloudbuild.yaml'
225
- gcloudTags = `--config=${cloudBuildFile}`
226
- const cbst = handlebars.compile( cloudBuildSteps, { noEscape : true } )
227
- const cbs = cbst( { artifactProject, artifactRegistry, imageName, imageVersion } )
223
+ // create the cloud build config from the handlebars template
224
+ const cloudBuildFile = './docker/cloudbuild.yaml'
225
+ const cbst = handlebars.compile( cloudBuildSteps, { noEscape : true } )
226
+ const cbs = cbst( { artifactProject, artifactRegistry, imageName, imageVersion, imageTag } )
227
+ fs.writeFileSync( cloudBuildFile, cbs )
228
228
 
229
- fs.writeFileSync( cloudBuildFile, cbs )
230
- }
229
+ const gcloudBuildConfig = `--config=${cloudBuildFile}`
231
230
 
232
231
  log( chalk.green.bold( `
233
232
  *** Submitting Build as ${builderName} ***
234
233
  ${gcloudBuild} \\
235
234
  ${gcloudLogs} \\
236
- ${gcloudTags} \\
237
- ${cloudBuildSA}
235
+ ${gcloudBuildConfig} \\
236
+ ${gcloudBuildSA}
238
237
  ` ) )
239
238
 
240
239
  if ( process.env.DRY_RUN === '1' ) {
@@ -242,12 +241,7 @@ const buildContainerImage = async ( {
242
241
  process.exit( 0 )
243
242
  }
244
243
 
245
- await shellCmd( `${gcloudBuild} ${gcloudLogs} ${gcloudTags} ./build`, { stdio : 'inherit' } )
246
-
247
- const imageTag = `${defaultSettings.date}-${defaultSettings.nodeimage}-${builderName}`
248
- await shellCmd(
249
- `gcloud container images add-tag --quiet ${imageName}:${imageVersion} ${imageName}:${imageTag} ${imageName}:latest`
250
- )
244
+ await shellCmd( `${gcloudBuild} ${gcloudLogs} ${gcloudBuildConfig} ${gcloudBuildSA} ./build`, { stdio : 'inherit' } )
251
245
  }
252
246
 
253
247
  const repoCleanup = async () => {
package/src/bash-funcs CHANGED
@@ -187,7 +187,6 @@ function ifPluggedIn() {
187
187
  *)
188
188
  cat<<PLUGIN_INVOKED_AS_ERROR
189
189
 
190
-
191
190
  $RED_ERROR bash-funcs ifPluggedIn: unknown INVOKED_AS=[`color r $INVOKED_AS`]
192
191
 
193
192
  PLUGIN_INVOKED_AS_ERROR
@@ -191,6 +191,7 @@ alertmanager:
191
191
  *Description:* {{ .Annotations.description }}
192
192
  *Dashboard:* {{ .Annotations.dashboard }}
193
193
  {{ end }}
194
+ - name: discard
194
195
 
195
196
  route:
196
197
  group_wait: 30s
@@ -198,12 +199,19 @@ alertmanager:
198
199
  group_by:
199
200
  - alertname
200
201
  - namespace
201
- receiver: slack
202
+ receiver: slack # default for everything
202
203
  routes:
203
- - match_re:
204
- alertname: "Watchdog"
205
- receiver: slack-watchdog
206
- - match:
207
- severity: page
208
- receiver: opsgenie
204
+ - matchers:
205
+ - severity="page" # 📢 paging DevOps
206
+ receiver: opsgenie
207
+ continue: true # 👈 KEEP GOING after this match
208
+
209
+ - matchers:
210
+ - namespace="kube-system" # 🙈 ignore these alerts - GKE will handle them
211
+ receiver: discard
212
+
213
+ - matchers:
214
+ - alertname="Watchdog"
215
+ receiver: slack-watchdog
216
+
209
217
  repeat_interval: 6h
@@ -29,8 +29,7 @@ spec:
29
29
  expr: sum(stackdriver_pubsub_subscription_pubsub_googleapis_com_subscription_num_undelivered_messages) by (subscription_id) > 1000
30
30
  for: 5m
31
31
  labels:
32
- severity: page
33
- priority: P3
32
+ severity: info # awesome was => page / priority: P3
34
33
  annotations:
35
34
  summary: "High Number of Undelivered Messages on PubSub"
36
35
  description: "Undelivered message count on topic {{$labels.subscription_id}} is greater than 1000"
@@ -130,8 +130,8 @@ spec:
130
130
  VALUE = {{ $value }}
131
131
  LABELS = {{ $labels }}
132
132
  - alert: PrometheusRuleEvaluationFailures
133
- expr: increase(prometheus_rule_evaluation_failures_total[3m]) > 0
134
- for: 0m
133
+ expr: increase(prometheus_rule_evaluation_failures_total[5m]) > 0 # awesome was 3m
134
+ for: 5m # awesome was 0m
135
135
  labels:
136
136
  severity: critical
137
137
  annotations:
@@ -186,7 +186,7 @@ spec:
186
186
  LABELS = {{ $labels }}
187
187
  - alert: PrometheusTargetEmpty
188
188
  expr: prometheus_sd_discovered_targets == 0
189
- for: 0m
189
+ for: 3m # awesome was => 0m
190
190
  labels:
191
191
  severity: critical
192
192
  annotations:
@@ -71,7 +71,7 @@ networkPolicy:
71
71
  metrics:
72
72
  enabled: true
73
73
  serviceMonitor:
74
- enabled: false # set to true for prometheus operator
74
+ enabled: true # set to true for prometheus operator
75
75
  namespace: "prometheus"
76
76
  relabelings:
77
77
  - action: labelmap
package/src/helmup.sh CHANGED
@@ -394,7 +394,7 @@ function installPreemptibleKiller() {
394
394
  gcloud iam service-accounts create $SVC_ACCT \
395
395
  --project $GCP_PROJECT_ID \
396
396
  --description "Estafette Node Killer SA" \
397
- --display-name "Estafette Node Killer SA"
397
+ --display-name "Estafette Node Killer SA" &> $DEVNULL
398
398
  warnOnError $? "SA creation may have failed or it already exists"
399
399
 
400
400
  printf "\nCreate the $SVC_ACCT IAM role\n"
@@ -402,7 +402,7 @@ function installPreemptibleKiller() {
402
402
  --project $GCP_PROJECT_ID \
403
403
  --title "Estafette Node Killer" \
404
404
  --description "Delete compute instances" \
405
- --permissions compute.instances.delete
405
+ --permissions compute.instances.delete &> $DEVNULL
406
406
  warnOnError $? "Role creation may have failed or it already exists"
407
407
 
408
408
  local service_account_email=$(gcloud iam --project=$GCP_PROJECT_ID service-accounts list --filter $SVC_ACCT --format 'value([email])')
@@ -417,6 +417,7 @@ function installPreemptibleKiller() {
417
417
  helm upgrade --install estafette-gke-preemptible-killer \
418
418
  estafette/estafette-gke-preemptible-killer \
419
419
  --namespace ${NAMESPACE} \
420
+ --set resources.limits.cpu="100m" \
420
421
  --set secret.workloadIdentityServiceAccount="$SVC_ACCT@$GCP_PROJECT_ID.iam.gserviceaccount.com" \
421
422
  --set extraEnv.BLACKLIST_HOURS="10:00-02:00" # No killing from 5AM-9PM EST
422
423
  # --set extraEnv.WHITELIST_HOURS="12:30-13:30"
@@ -1,5 +1,14 @@
1
1
  #!/bin/bash
2
2
 
3
+ # Load the standard helper functions
4
+ . `build-tools --bashfun`
5
+
6
+ cat<<DEPRECATED
7
+
8
+ `color r "**DEPRECATED - refresh-py-idx is no longer used"`
9
+ DEPRECATED
10
+ exit 1
11
+
3
12
  function leveregeBuildToolsRefreshPyIdx() {
4
13
  # Execute gcloud command to get the token
5
14
  local TOKEN=$(gcloud auth print-access-token)
@@ -1,3 +1,6 @@
1
+ options:
2
+ machineType: E2_HIGHCPU_8
3
+
1
4
  steps:
2
5
  - name: 'gcr.io/cloud-builders/docker'
3
6
  entrypoint: 'bash'
@@ -12,6 +15,28 @@ steps:
12
15
  - '--cache-from'
13
16
  - '{{imageName}}:latest'
14
17
  - '.'
15
-
18
+
19
+ - name: 'gcr.io/cloud-builders/docker'
20
+ args:
21
+ - 'tag'
22
+ - '{{imageName}}:{{imageVersion}}'
23
+ - '{{imageName}}:{{imageTag}}'
24
+
25
+ - name: 'gcr.io/cloud-builders/docker'
26
+ args:
27
+ - 'tag'
28
+ - '{{imageName}}:{{imageVersion}}'
29
+ - '{{imageName}}:latest'
30
+
31
+ - name: 'gcr.io/cloud-builders/docker'
32
+ args:
33
+ - 'push'
34
+ - '{{imageName}}:{{imageTag}}'
35
+
36
+ - name: 'gcr.io/cloud-builders/docker'
37
+ args:
38
+ - 'push'
39
+ - '{{imageName}}:latest'
40
+
16
41
  images:
17
42
  - '{{imageName}}:{{imageVersion}}'