@leverege/build-tools 2.37.1 → 2.37.2

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.
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- //XXX console.log( `TOP=>[${process.cwd()}] PWD=[${process.env.PWD}]` )
3
+ // XXX console.log( `TOP=>[${process.cwd()}] PWD=[${process.env.PWD}]` )
4
4
  /* eslint-disable no-console */
5
5
  "use strict";
6
6
 
7
7
  const path = require('node:path');
8
+ const exec = require('node:child_process').execSync;
9
+ const fs = require('node:fs');
8
10
  const chalk = require('chalk');
9
11
  const cliArgs = require('command-line-args');
10
12
  // const cliHelp = require( 'command-line-usage' )
11
13
  const deepmerge = require('deepmerge');
12
- const exec = require('child_process').execSync;
13
- const fs = require('fs');
14
14
  const glob = require('glob');
15
15
  const parse = require('parse-gitignore');
16
16
  const ask = require('readline-sync');
@@ -146,8 +146,8 @@ if (!cfgs) {
146
146
  }
147
147
 
148
148
  // Check to see if we are deriving from another configuration.
149
- if (cfgs['PROJECT_BASE']) {
150
- const baseName = cfgs['PROJECT_BASE'];
149
+ if (cfgs.PROJECT_BASE) {
150
+ const baseName = cfgs.PROJECT_BASE;
151
151
  const tempCfgs = cfgs;
152
152
  cfgs = yaml[baseName];
153
153
  Object.keys(tempCfgs).forEach(key => {
@@ -362,7 +362,7 @@ if (over.PROJECT_NAME === 'minikube') {
362
362
  process.exit(0);
363
363
  }
364
364
  const projectId = over.PROJECT_ID;
365
- let zone = over['GCE_REGION'] + (over['GCE_ZONE'] ? `-${over['GCE_ZONE']}` : '');
365
+ let zone = over.GCE_REGION + (over.GCE_ZONE ? `-${over.GCE_ZONE}` : '');
366
366
  if (!clusterName) {
367
367
  console.log(chalk.yellow(`
368
368
 
@@ -392,17 +392,6 @@ try {
392
392
  const currentCtx = kubeout.toString().trim();
393
393
  let desiredCtx = `gke_${projectId}_${zone}_${clusterName}`;
394
394
  let cmd = `gcloud container clusters get-credentials ${clusterName} --zone ${zone} --project ${projectId}`;
395
-
396
- // Check if we are using AWS
397
- if (cfgs.CLOUD === 'aws') {
398
- const awsAcctId = cfgs['AWS_ACCT_ID'];
399
- zone = over['AWS_REGION'];
400
- desiredCtx = `arn:aws:eks:${zone}:${awsAcctId}:cluster/${clusterName}`;
401
- cmd = `aws eks --region ${zone} update-kubeconfig --name ${clusterName}`;
402
- }
403
-
404
- // TODO - FETCH AWS CLUSTER CREDENTIALS
405
-
406
395
  const matchedCtx = currentCtx === desiredCtx;
407
396
  if (args.matchk8s) {
408
397
  process.exit(matchedCtx ? 0 : 1);
@@ -1,4 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ /*
3
+ * refresh-npm-token will check the access time of the $HOME/.npmrc npm token
4
+ * file and if it is older than 24 hours then it will be updated to whatever
5
+ * value is currently in the NPM_DEVELOPER_SECRET on leverege-artifacts. It
6
+ * will also check to see if the deprecated $HOME/.npmrc.ro file exists and
7
+ * will suggest to the user to remove it. If either of the token files exist
8
+ * the first 6 and last four characters of the token will be extracted and
9
+ * reported via slack to allow DevOps operators to clean up old tokens in npm.
10
+ *
11
+ * For testing the Unix touch command may be used to modify the access access
12
+ * time of the npmrc token. The REFRESH_NPM_TOKEN_DEBUG env variable may also
13
+ * be set to enable debugging and disable the slack channel spam.
14
+ *
15
+ * touch -d 2023-08-20 ~/.npmrc; REFRESH_NPM_TOKEN_DEBUG=1 refresh-npm-token.mjs
16
+ */
17
+
2
18
  /* eslint-disable security/detect-non-literal-fs-filename */
3
19
  "use strict";
4
20
 
@@ -13,6 +29,11 @@ const refreshThreshold = 3600 * 24; // 1 day
13
29
 
14
30
  // eslint-disable-next-line no-console
15
31
  const log = console.log;
32
+ const debug = (obj, text) => {
33
+ if (process.env.REFRESH_NPM_TOKEN_DEBUG) {
34
+ log(obj, _chalk.default.yellow(text));
35
+ }
36
+ };
16
37
  const fetchToken = filename => {
17
38
  const results = {
18
39
  filename,
@@ -43,8 +64,10 @@ const fetchToken = filename => {
43
64
  // fetch the tokens - note the RO token is deprecated and may not exist
44
65
  const npmrc = fetchToken(`${_nodeOs.default.homedir()}/.npmrc`);
45
66
  const npmrcRo = fetchToken(`${_nodeOs.default.homedir()}/.npmrc.ro`);
46
-
47
- // log( { npmrc, npmrcRo }, '<==Your tokens be' )
67
+ debug({
68
+ npmrc,
69
+ npmrcRo
70
+ }, '<==Your current tokens'); // debug
48
71
 
49
72
  if (npmrc.exists && npmrc.lastUpdated < refreshThreshold) {
50
73
  process.exit(0);
@@ -52,11 +75,14 @@ if (npmrc.exists && npmrc.lastUpdated < refreshThreshold) {
52
75
 
53
76
  // fetch the contents of the npmrc secret stored on leverege-registry
54
77
  let npmrcSecret;
78
+ const execaOpts = ['secrets', 'versions', 'access', 'latest', '--secret=NPM_DEVELOPER_NPMRC', '--project=leverege-registry'];
55
79
  try {
56
- const {
57
- stdout
58
- } = await (0, _execa.default)('gcloud', ['secrets', 'versions', 'access', 'latest', '--secret=NPM_DEVELOPER_NPMRC', '--project=leverege-registry']);
59
- npmrcSecret = stdout;
80
+ const execaOut = await (0, _execa.default)('gcloud', execaOpts);
81
+ npmrcSecret = execaOut.stdout;
82
+ debug({
83
+ execaOut,
84
+ execaOpts
85
+ }, '<==exec info'); // debug
60
86
  } catch (err) {
61
87
  log(_chalk.default.yellow(`\nFailed Command => [${err.escapedCommand}]\n\n`), _chalk.default.red(err.stderr));
62
88
  process.exit(1);
@@ -81,13 +107,20 @@ const slackData = {
81
107
  text: `--- npmrc refreshed by \`${process.env.USER}\` at ${now}\n tokens RW [\`${npmrc.token}\`] RO [\`${npmrcRo.token}\`]`,
82
108
  channel: '#dev-ops-helm'
83
109
  };
84
- fetch(slackURL, {
85
- method: 'POST',
86
- body: JSON.stringify(slackData),
87
- headers: {
88
- 'Content-Type': 'application/json'
89
- }
90
- }).catch(err => log(err));
110
+ if (process.env.REFRESH_NPM_TOKEN_DEBUG) {
111
+ log({
112
+ slackURL,
113
+ slackData
114
+ }, '<==Slack skipped');
115
+ } else {
116
+ fetch(slackURL, {
117
+ method: 'POST',
118
+ body: JSON.stringify(slackData),
119
+ headers: {
120
+ 'Content-Type': 'application/json'
121
+ }
122
+ });
123
+ }
91
124
  if (npmrcRo.exists) {
92
125
  log(_chalk.default.red('\nWARNING - the need for the ~/.npmrc.ro file has been eliminated - please remove'));
93
126
  process.exit(1);
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- //XXX console.log( `TOP=>[${process.cwd()}] PWD=[${process.env.PWD}]` )
3
+ // XXX console.log( `TOP=>[${process.cwd()}] PWD=[${process.env.PWD}]` )
4
4
  /* eslint-disable no-console */
5
5
  "use strict";
6
6
 
7
7
  const path = require('node:path');
8
+ const exec = require('node:child_process').execSync;
9
+ const fs = require('node:fs');
8
10
  const chalk = require('chalk');
9
11
  const cliArgs = require('command-line-args');
10
12
  // const cliHelp = require( 'command-line-usage' )
11
13
  const deepmerge = require('deepmerge');
12
- const exec = require('child_process').execSync;
13
- const fs = require('fs');
14
14
  const glob = require('glob');
15
15
  const parse = require('parse-gitignore');
16
16
  const ask = require('readline-sync');
@@ -146,8 +146,8 @@ if (!cfgs) {
146
146
  }
147
147
 
148
148
  // Check to see if we are deriving from another configuration.
149
- if (cfgs['PROJECT_BASE']) {
150
- const baseName = cfgs['PROJECT_BASE'];
149
+ if (cfgs.PROJECT_BASE) {
150
+ const baseName = cfgs.PROJECT_BASE;
151
151
  const tempCfgs = cfgs;
152
152
  cfgs = yaml[baseName];
153
153
  Object.keys(tempCfgs).forEach(key => {
@@ -362,7 +362,7 @@ if (over.PROJECT_NAME === 'minikube') {
362
362
  process.exit(0);
363
363
  }
364
364
  const projectId = over.PROJECT_ID;
365
- let zone = over['GCE_REGION'] + (over['GCE_ZONE'] ? `-${over['GCE_ZONE']}` : '');
365
+ let zone = over.GCE_REGION + (over.GCE_ZONE ? `-${over.GCE_ZONE}` : '');
366
366
  if (!clusterName) {
367
367
  console.log(chalk.yellow(`
368
368
 
@@ -392,17 +392,6 @@ try {
392
392
  const currentCtx = kubeout.toString().trim();
393
393
  let desiredCtx = `gke_${projectId}_${zone}_${clusterName}`;
394
394
  let cmd = `gcloud container clusters get-credentials ${clusterName} --zone ${zone} --project ${projectId}`;
395
-
396
- // Check if we are using AWS
397
- if (cfgs.CLOUD === 'aws') {
398
- const awsAcctId = cfgs['AWS_ACCT_ID'];
399
- zone = over['AWS_REGION'];
400
- desiredCtx = `arn:aws:eks:${zone}:${awsAcctId}:cluster/${clusterName}`;
401
- cmd = `aws eks --region ${zone} update-kubeconfig --name ${clusterName}`;
402
- }
403
-
404
- // TODO - FETCH AWS CLUSTER CREDENTIALS
405
-
406
395
  const matchedCtx = currentCtx === desiredCtx;
407
396
  if (args.matchk8s) {
408
397
  process.exit(matchedCtx ? 0 : 1);
@@ -1,4 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ /*
3
+ * refresh-npm-token will check the access time of the $HOME/.npmrc npm token
4
+ * file and if it is older than 24 hours then it will be updated to whatever
5
+ * value is currently in the NPM_DEVELOPER_SECRET on leverege-artifacts. It
6
+ * will also check to see if the deprecated $HOME/.npmrc.ro file exists and
7
+ * will suggest to the user to remove it. If either of the token files exist
8
+ * the first 6 and last four characters of the token will be extracted and
9
+ * reported via slack to allow DevOps operators to clean up old tokens in npm.
10
+ *
11
+ * For testing the Unix touch command may be used to modify the access access
12
+ * time of the npmrc token. The REFRESH_NPM_TOKEN_DEBUG env variable may also
13
+ * be set to enable debugging and disable the slack channel spam.
14
+ *
15
+ * touch -d 2023-08-20 ~/.npmrc; REFRESH_NPM_TOKEN_DEBUG=1 refresh-npm-token.mjs
16
+ */
17
+
2
18
  /* eslint-disable security/detect-non-literal-fs-filename */
3
19
  "use strict";
4
20
 
@@ -13,6 +29,11 @@ const refreshThreshold = 3600 * 24; // 1 day
13
29
 
14
30
  // eslint-disable-next-line no-console
15
31
  const log = console.log;
32
+ const debug = (obj, text) => {
33
+ if (process.env.REFRESH_NPM_TOKEN_DEBUG) {
34
+ log(obj, _chalk.default.yellow(text));
35
+ }
36
+ };
16
37
  const fetchToken = filename => {
17
38
  const results = {
18
39
  filename,
@@ -43,8 +64,10 @@ const fetchToken = filename => {
43
64
  // fetch the tokens - note the RO token is deprecated and may not exist
44
65
  const npmrc = fetchToken(`${_nodeOs.default.homedir()}/.npmrc`);
45
66
  const npmrcRo = fetchToken(`${_nodeOs.default.homedir()}/.npmrc.ro`);
46
-
47
- // log( { npmrc, npmrcRo }, '<==Your tokens be' )
67
+ debug({
68
+ npmrc,
69
+ npmrcRo
70
+ }, '<==Your current tokens'); // debug
48
71
 
49
72
  if (npmrc.exists && npmrc.lastUpdated < refreshThreshold) {
50
73
  process.exit(0);
@@ -52,11 +75,14 @@ if (npmrc.exists && npmrc.lastUpdated < refreshThreshold) {
52
75
 
53
76
  // fetch the contents of the npmrc secret stored on leverege-registry
54
77
  let npmrcSecret;
78
+ const execaOpts = ['secrets', 'versions', 'access', 'latest', '--secret=NPM_DEVELOPER_NPMRC', '--project=leverege-registry'];
55
79
  try {
56
- const {
57
- stdout
58
- } = await (0, _execa.default)('gcloud', ['secrets', 'versions', 'access', 'latest', '--secret=NPM_DEVELOPER_NPMRC', '--project=leverege-registry']);
59
- npmrcSecret = stdout;
80
+ const execaOut = await (0, _execa.default)('gcloud', execaOpts);
81
+ npmrcSecret = execaOut.stdout;
82
+ debug({
83
+ execaOut,
84
+ execaOpts
85
+ }, '<==exec info'); // debug
60
86
  } catch (err) {
61
87
  log(_chalk.default.yellow(`\nFailed Command => [${err.escapedCommand}]\n\n`), _chalk.default.red(err.stderr));
62
88
  process.exit(1);
@@ -81,13 +107,20 @@ const slackData = {
81
107
  text: `--- npmrc refreshed by \`${process.env.USER}\` at ${now}\n tokens RW [\`${npmrc.token}\`] RO [\`${npmrcRo.token}\`]`,
82
108
  channel: '#dev-ops-helm'
83
109
  };
84
- fetch(slackURL, {
85
- method: 'POST',
86
- body: JSON.stringify(slackData),
87
- headers: {
88
- 'Content-Type': 'application/json'
89
- }
90
- }).catch(err => log(err));
110
+ if (process.env.REFRESH_NPM_TOKEN_DEBUG) {
111
+ log({
112
+ slackURL,
113
+ slackData
114
+ }, '<==Slack skipped');
115
+ } else {
116
+ fetch(slackURL, {
117
+ method: 'POST',
118
+ body: JSON.stringify(slackData),
119
+ headers: {
120
+ 'Content-Type': 'application/json'
121
+ }
122
+ });
123
+ }
91
124
  if (npmrcRo.exists) {
92
125
  log(_chalk.default.red('\nWARNING - the need for the ~/.npmrc.ro file has been eliminated - please remove'));
93
126
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.37.1",
3
+ "version": "2.37.2",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -4,7 +4,7 @@ showInstalling "Velero Backup System"
4
4
 
5
5
  addHelmRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
6
6
 
7
- [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="4"
7
+ [ -z "$VELERO_CHART_VERSION" ] && VELERO_CHART_VERSION="5"
8
8
  #
9
9
  # Build the bucket, region and SA email variables and use --set to mod the
10
10
  # chart values as opposed to using an OVH:<label> approach. This eliminates
package/src/helmup CHANGED
@@ -399,7 +399,7 @@ function installVeleroEnvironment() {
399
399
  gcloud config set project $GCP_PROJECT_ID
400
400
 
401
401
  ## The major chart version will determine the bucket suffix
402
- [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="4"
402
+ [ -z "$VELERO_HELM_CHART" ] && VELERO_HELM_CHART="5"
403
403
 
404
404
  ## Create a bucket
405
405
  BUCKET="$GCP_PROJECT_ID-velero-$VELERO_HELM_CHART"
package/src/overwhelm.js CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- //XXX console.log( `TOP=>[${process.cwd()}] PWD=[${process.env.PWD}]` )
3
+ // XXX console.log( `TOP=>[${process.cwd()}] PWD=[${process.env.PWD}]` )
4
4
  /* eslint-disable no-console */
5
5
 
6
6
  const path = require( 'node:path' )
7
+ const exec = require( 'node:child_process' ).execSync
8
+ const fs = require( 'node:fs' )
9
+
7
10
  const chalk = require( 'chalk' )
8
11
  const cliArgs = require( 'command-line-args' )
9
12
  // const cliHelp = require( 'command-line-usage' )
10
13
  const deepmerge = require( 'deepmerge' )
11
- const exec = require( 'child_process' ).execSync
12
- const fs = require( 'fs' )
13
14
  const glob = require( 'glob' )
14
15
  const parse = require( 'parse-gitignore' )
15
16
  const ask = require( 'readline-sync' )
@@ -36,7 +37,7 @@ const gitTop = exec(
36
37
  'git rev-parse --show-toplevel', { stdio : [ undefined ] }
37
38
  ).toString().trim()
38
39
  let monoTop
39
- if( fs.existsSync( `${gitTop}/packages` ) ) {
40
+ if ( fs.existsSync( `${gitTop}/packages` ) ) {
40
41
  monoTop = path.basename( path.resolve() ) // process.env.PWD
41
42
  console.log( `MONO=[${monoTop}]` )
42
43
  }
@@ -97,8 +98,8 @@ if ( !cfgs ) {
97
98
  }
98
99
 
99
100
  // Check to see if we are deriving from another configuration.
100
- if ( cfgs['PROJECT_BASE'] ) {
101
- const baseName = cfgs['PROJECT_BASE']
101
+ if ( cfgs.PROJECT_BASE ) {
102
+ const baseName = cfgs.PROJECT_BASE
102
103
  const tempCfgs = cfgs
103
104
  cfgs = yaml[baseName]
104
105
  Object.keys( tempCfgs ).forEach( ( key ) => { cfgs[key] = tempCfgs[key] } )
@@ -294,21 +295,21 @@ ahoy.forEach( ( dir ) => {
294
295
 
295
296
  // we can also apply replaceables to any top level .ovh files to support top level config maps
296
297
  glob.sync( '**/*.ovh' ).forEach( ( cfgmap ) => {
297
- const target = cfgmap.replace(/.ovh$/,'')
298
+ const target = cfgmap.replace( /.ovh$/, '' )
298
299
  let valuesOut = fs.readFileSync( cfgmap, { encoding : 'utf-8' } )
299
300
  valuesOut = doReplacements( valuesOut, over )
300
301
  fs.writeFileSync( target, valuesOut )
301
302
  } )
302
303
 
303
- if( args.genvals ) { process.exit( 0 ) }
304
+ if ( args.genvals ) { process.exit( 0 ) }
304
305
 
305
306
  // Set the GCP context for safety!
306
307
  const clusterName = over.CLUSTER_NAME
307
308
  if ( over.PROJECT_NAME === 'minikube' ) {
308
- process.exit(0)
309
+ process.exit( 0 )
309
310
  }
310
311
  const projectId = over.PROJECT_ID
311
- let zone = over['GCE_REGION'] + ( over['GCE_ZONE'] ? `-${over['GCE_ZONE']}` : '' )
312
+ let zone = over.GCE_REGION + ( over.GCE_ZONE ? `-${over.GCE_ZONE}` : '' )
312
313
 
313
314
  if ( !clusterName ) {
314
315
  console.log( chalk.yellow(
@@ -341,16 +342,6 @@ const currentCtx = kubeout.toString().trim()
341
342
  let desiredCtx = `gke_${projectId}_${zone}_${clusterName}`
342
343
  let cmd = `gcloud container clusters get-credentials ${clusterName} --zone ${zone} --project ${projectId}`
343
344
 
344
- // Check if we are using AWS
345
- if ( cfgs.CLOUD === 'aws' ) {
346
- const awsAcctId = cfgs['AWS_ACCT_ID']
347
- zone = over['AWS_REGION']
348
- desiredCtx = `arn:aws:eks:${zone}:${awsAcctId}:cluster/${clusterName}`
349
- cmd = `aws eks --region ${zone} update-kubeconfig --name ${clusterName}`
350
- }
351
-
352
- // TODO - FETCH AWS CLUSTER CREDENTIALS
353
-
354
345
  const matchedCtx = ( currentCtx === desiredCtx )
355
346
 
356
347
  if ( args.matchk8s ) {
package/src/push-my-chart CHANGED
@@ -8,7 +8,7 @@ const pushItGood = async () => {
8
8
  const pusher = ( semverLt( version.stdout, '3.7.0' ) ? 'push' : 'cm-push' )
9
9
 
10
10
  try {
11
- const museum = await execa ( 'helm', [ pusher, 'helm', 'leverege' ] )
11
+ const museum = await execa( 'helm', [ pusher, 'helm', 'leverege' ] )
12
12
  console.log( museum.stdout )
13
13
  } catch ( ex ) {
14
14
  console.log( ex.stderr )
@@ -1,4 +1,20 @@
1
1
  #!/usr/bin/env node
2
+ /*
3
+ * refresh-npm-token will check the access time of the $HOME/.npmrc npm token
4
+ * file and if it is older than 24 hours then it will be updated to whatever
5
+ * value is currently in the NPM_DEVELOPER_SECRET on leverege-artifacts. It
6
+ * will also check to see if the deprecated $HOME/.npmrc.ro file exists and
7
+ * will suggest to the user to remove it. If either of the token files exist
8
+ * the first 6 and last four characters of the token will be extracted and
9
+ * reported via slack to allow DevOps operators to clean up old tokens in npm.
10
+ *
11
+ * For testing the Unix touch command may be used to modify the access access
12
+ * time of the npmrc token. The REFRESH_NPM_TOKEN_DEBUG env variable may also
13
+ * be set to enable debugging and disable the slack channel spam.
14
+ *
15
+ * touch -d 2023-08-20 ~/.npmrc; REFRESH_NPM_TOKEN_DEBUG=1 refresh-npm-token.mjs
16
+ */
17
+
2
18
  /* eslint-disable security/detect-non-literal-fs-filename */
3
19
  import fs from 'node:fs'
4
20
  import os from 'node:os'
@@ -11,6 +27,9 @@ const refreshThreshold = 3600 * 24 // 1 day
11
27
 
12
28
  // eslint-disable-next-line no-console
13
29
  const log = console.log
30
+ const debug = ( obj, text ) => {
31
+ if ( process.env.REFRESH_NPM_TOKEN_DEBUG ) { log( obj, chalk.yellow( text ) ) }
32
+ }
14
33
 
15
34
  const fetchToken = ( filename ) => {
16
35
  const results = {
@@ -43,22 +62,24 @@ const fetchToken = ( filename ) => {
43
62
  const npmrc = fetchToken( `${os.homedir()}/.npmrc` )
44
63
  const npmrcRo = fetchToken( `${os.homedir()}/.npmrc.ro` )
45
64
 
46
- // log( { npmrc, npmrcRo }, '<==Your tokens be' )
65
+ debug( { npmrc, npmrcRo }, '<==Your current tokens' ) // debug
47
66
 
48
67
  if ( npmrc.exists && npmrc.lastUpdated < refreshThreshold ) { process.exit( 0 ) }
49
68
 
50
69
  // fetch the contents of the npmrc secret stored on leverege-registry
51
70
  let npmrcSecret
71
+ const execaOpts = [
72
+ 'secrets',
73
+ 'versions',
74
+ 'access',
75
+ 'latest',
76
+ '--secret=NPM_DEVELOPER_NPMRC',
77
+ '--project=leverege-registry',
78
+ ]
52
79
  try {
53
- const { stdout } = await execa( 'gcloud', [
54
- 'secrets',
55
- 'versions',
56
- 'access',
57
- 'latest',
58
- '--secret=NPM_DEVELOPER_NPMRC',
59
- '--project=leverege-registry',
60
- ] )
61
- npmrcSecret = stdout
80
+ const execaOut = await execa( 'gcloud', execaOpts )
81
+ npmrcSecret = execaOut.stdout
82
+ debug( { execaOut, execaOpts }, '<==exec info' )// debug
62
83
  } catch ( err ) {
63
84
  log( chalk.yellow( `\nFailed Command => [${err.escapedCommand}]\n\n` ), chalk.red( err.stderr ) )
64
85
  process.exit( 1 )
@@ -85,14 +106,17 @@ const slackData = {
85
106
  channel : '#dev-ops-helm',
86
107
  }
87
108
 
88
- fetch( slackURL, {
89
- method : 'POST',
90
- body : JSON.stringify( slackData ),
91
- headers : {
92
- 'Content-Type' : 'application/json',
93
- },
94
- } )
95
- .catch( err => log( err ) )
109
+ if ( process.env.REFRESH_NPM_TOKEN_DEBUG ) {
110
+ log( { slackURL, slackData }, '<==Slack skipped' )
111
+ } else {
112
+ fetch( slackURL, {
113
+ method : 'POST',
114
+ body : JSON.stringify( slackData ),
115
+ headers : {
116
+ 'Content-Type' : 'application/json',
117
+ },
118
+ } )
119
+ }
96
120
 
97
121
  if ( npmrcRo.exists ) {
98
122
  log( chalk.red( '\nWARNING - the need for the ~/.npmrc.ro file has been eliminated - please remove' ) )