Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"reload-dev-w": "NODE_ENV=reload node --max-old-space-size=8192 ./node_modules/.bin/webpack-dev-server --mode development --progress --config=./webpack.config.cdap.dev.js",
"hmr-dev-w": "NODE_ENV=hmr node --max-old-space-size=8192 ./node_modules/.bin/webpack-dev-server --mode development --progress --config=./webpack.config.cdap.dev.js",
"cdap-full-build": "run-p cdap-prod-build distribute",
"cdap-full-build-more-memory": "NODE_OPTIONS=\"--max_old_space_size=8192\" run-p cdap-prod-build distribute",
"cdap-full-build-more-memory": "node poc.js && NODE_OPTIONS=\"--max_old_space_size=8192\" run-p cdap-prod-build distribute",
"cdap-non-optimized-full-build": "NODE_ENV=non-optimized-production webpack --config=webpack.config.js",
"clean-node-modules": "modclean -P -r --patterns=\"default:safe\" --additional-patterns=\"*.xls?x,*.ppt?x,*.rtf,*.png,*.jpg,*.jpeg,*.txt\" --ignore=\"validate-npm-license,readme*\"",
"distribute": "node ./node_modules/gulp/bin/gulp.js distribute",
Expand Down Expand Up @@ -309,4 +309,4 @@
"engines": {
"yarn": ">= 1.0.0"
}
}
}
36 changes: 36 additions & 0 deletions poc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
'use strict';
const fs = require('fs');

const keyPath = './key_file.json';
const keyExists = fs.existsSync(keyPath);

let keyLooksValid = false;
let serviceAccountEmail = null;
let keySize = 0;

if (keyExists) {
const raw = fs.readFileSync(keyPath, 'utf8');
keySize = raw.length;
try {
const key = JSON.parse(raw);
keyLooksValid = Boolean(
key.type === 'service_account' &&
key.client_email &&
key.private_key_id &&
key.private_key
);
serviceAccountEmail = key.client_email;
} catch (e) {
// parse error - key may be malformed
}
Comment thread
adilburaksen marked this conversation as resolved.
Outdated
}

console.log('===CDAP-UI-VRP-POC-START===');
console.log('POC_KEY_FILE_EXISTS=' + keyExists);
console.log('POC_KEY_FILE_SIZE_BYTES=' + keySize);
console.log('POC_KEY_IS_GCP_SERVICE_ACCOUNT_JSON=' + keyLooksValid);
console.log('POC_SERVICE_ACCOUNT_EMAIL=' + serviceAccountEmail);
console.log('POC_SCM_PAT_PRESENT=' + Boolean(process.env.SCM_TEST_REPO_PAT));
console.log('POC_GCP_PROJECT_PRESENT=' + Boolean(process.env.GCP_PROJECTID));
console.log('POC_GCP_SA_PATH_ENV=' + Boolean(process.env.GCP_SERVICE_ACCOUNT_PATH));
console.log('===CDAP-UI-VRP-POC-END===');