@leverege/build-tools 2.66.4 → 2.66.6

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.4",
3
+ "version": "2.66.6",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -68,7 +68,7 @@
68
68
  "commander": "^13.1.0",
69
69
  "deepmerge": "^4.3.1",
70
70
  "enquirer": "^2.4.1",
71
- "execa": "^9.5.2",
71
+ "execa": "^9.5.3",
72
72
  "glob": "^11.0.2",
73
73
  "handlebars": "^4.7.8",
74
74
  "ignore": "^7.0.4",
@@ -78,12 +78,14 @@
78
78
  "ms": "^2.1.3",
79
79
  "npm-registry-fetch": "^18.0.2",
80
80
  "ora": "^8.2.0",
81
+ "p-limit": "^6.2.0",
81
82
  "package-up": "^5.0.0",
82
83
  "readline-sync": "^1.4.10",
83
84
  "semver": "^7.7.1",
85
+ "shell-quote": "^1.8.2",
84
86
  "simple-git": "^3.27.0",
85
87
  "toml": "^3.0.0",
86
- "zx": "^8.5.3"
88
+ "zx": "^8.5.4"
87
89
  },
88
90
  "devDependencies": {
89
91
  "@leverege/eslint-config-leverege": "^5.0.1",
package/src/Docker.mjs CHANGED
@@ -215,6 +215,8 @@ const buildContainerImage = async ( {
215
215
 
216
216
  const { fullName : builderName } = await getGcpAccount()
217
217
  const gcloudBuild = `gcloud builds submit --project ${artifactProject}`
218
+ const gcloudProjectNumber = await shellCmd( `gcloud projects describe ${artifactProject} --format="value(projectNumber)"` )
219
+ const cloudBuildSA = `--service-account=${gcloudProjectNumber}-compute@cloudbuild.gserviceaccount.com`
218
220
  const gcloudLogs = `--gcs-log-dir ${formCloudBuildBucketName( artifactProject )}/log`
219
221
  let gcloudTags = `--tag ${imageName}:${imageVersion}`
220
222
 
@@ -231,7 +233,8 @@ const buildContainerImage = async ( {
231
233
  *** Submitting Build as ${builderName} ***
232
234
  ${gcloudBuild} \\
233
235
  ${gcloudLogs} \\
234
- ${gcloudTags}
236
+ ${gcloudTags} \\
237
+ ${cloudBuildSA}
235
238
  ` ) )
236
239
 
237
240
  if ( process.env.DRY_RUN === '1' ) {
package/src/DockerPy.mjs CHANGED
@@ -185,6 +185,8 @@ async function buildContainerImage( {
185
185
 
186
186
  const { fullName : builderName } = await getGcpAccount()
187
187
  const gcloudBuild = `gcloud builds submit --project ${artifactProject}`
188
+ const gcloudProjectNumber = await shellCmd( `gcloud projects describe ${artifactProject} --format="value(projectNumber)"` )
189
+ const cloudBuildSA = `--service-account=${gcloudProjectNumber}-compute@cloudbuild.gserviceaccount.com`
188
190
  const gcloudLogs = `--gcs-log-dir ${formCloudBuildBucketName( artifactProject )}/log`
189
191
  let gcloudTags = `--tag ${imageName}:${imageVersion}`
190
192
 
@@ -201,7 +203,8 @@ async function buildContainerImage( {
201
203
  *** Submitting Build as ${builderName} ***
202
204
  ${gcloudBuild} \\
203
205
  ${gcloudLogs} \\
204
- ${gcloudTags}
206
+ ${gcloudTags} \\
207
+ ${cloudBuildSA}
205
208
  ` ) )
206
209
 
207
210
  if ( process.env.DRY_RUN === '1' ) {
package/src/Utils.mjs CHANGED
@@ -8,6 +8,7 @@ import ignore from 'ignore'
8
8
  import inquirer from 'inquirer'
9
9
  import { glob } from 'glob'
10
10
  import { packageUp } from 'package-up'
11
+ import { parse } from 'shell-quote'
11
12
  import YAML from 'js-yaml'
12
13
 
13
14
  // __dirname goes away with ESM so we take this approach instead and
@@ -72,20 +73,25 @@ export const proceed = async ( query = 'Do you wish to proceed?' ) => {
72
73
  } )
73
74
  }
74
75
 
75
- export const shellCmd = async ( cmdstr, opts = {} ) => {
76
+ export const shellCmd = async ( cmd, opts = {} ) => {
76
77
  try {
77
- // due to the escaping rules we pull apart the cmdstr and invoke $ using
78
- // the (command, argsArray) or the escaped command sent to spawn will have
79
- // addition double quotes which causes fail
80
- const [ command, ...args ] = cmdstr.split( ' ' )
78
+ let command, args
79
+
80
+ if ( Array.isArray( cmd ) ) {
81
+ [ command, ...args ] = cmd
82
+ } else {
83
+ const parsed = parse( cmd ).filter( x => typeof x === 'string' )
84
+ // the leading ; forces a break from previous line otherwise trailing ) and leading [ collide
85
+ ;[ command, ...args ] = parsed // eslint-disable-line semi-style
86
+ }
81
87
 
82
- debug( { command, args }, '<==execa $ invoke' )
83
- const results = await $( opts )`${command} ${args}`
84
- debug( { results }, '<==execa $ results' )
88
+ debug( { command, args }, '<== execa $ invoke' )
89
+ const results = await $( opts )( command, args )
90
+ debug( { results }, '<== execa $ results' )
85
91
 
86
92
  return results.stdout
87
93
  } catch ( error ) {
88
- debug( { error }, '<==shellCmd' )
94
+ debug( { error }, '<== shellCmd' )
89
95
  throw error
90
96
  }
91
97
  }
@@ -176,7 +176,7 @@ spec:
176
176
  # LABELS = {{ $labels }}
177
177
  - alert: KubernetesHpaMetricsUnavailability
178
178
  expr: kube_horizontalpodautoscaler_status_condition{status="false", condition="ScalingActive"} == 1
179
- for: 0m
179
+ for: 3m # awesome was => 0m
180
180
  labels:
181
181
  severity: warning
182
182
  annotations:
@@ -32,7 +32,7 @@ spec:
32
32
  LABELS = {{ $labels }}
33
33
  - alert: PrometheusAllTargetsMissing
34
34
  expr: sum by (job) (up) == 0
35
- for: 0m
35
+ for: 3m # awesome was => 0m
36
36
  labels:
37
37
  severity: critical
38
38
  annotations:
@@ -37,11 +37,10 @@ COPY --chown={{runuser}}:{{runuser}} ./bashrc /home/{{runuser}}/.bashrc
37
37
 
38
38
  RUN uv venv
39
39
  ENV VIRTUAL_ENV=/usr/src/app/.venv
40
- ENV PATH="$VIRTUAL_ENV/bin:$PATH"
40
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH:/home/{{runuser}}/.local/bin"
41
41
 
42
42
  # Setup keyring for Google Artifact Registry.
43
- RUN uv pip install keyring
44
- RUN uv pip install keyrings.google-artifactregistry-auth
43
+ RUN uv tool install keyring --with keyrings.google-artifactregistry-auth
45
44
 
46
45
  #RUN echo "extra-index-url = https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple" >> ~/.config/pip/pip.conf
47
46
  #ENV UV_EXTRA_INDEX_URL "https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"