Skip to content

support npm install traffic via tunnel #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module.exports = function (args) {
set_args
.sync_args_from_cmd(args)
.then(function (lt_config) {
console.log("lt_config -> ", lt_config);
//validate the config options
validate(lt_config, resp)
.then(function (cypressVersion) {
Expand Down
11 changes: 5 additions & 6 deletions commands/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,15 @@ module.exports = {
"https://api.lambdatest.com/automation/api/v1/cypress/artefacts/test/",
},
beta: {
INTEGRATION_BASE_URL:
"https://api-cypress-v2-dev.lambdatestinternal.com/liis",
INTEGRATION_BASE_URL: "https://api-envi-dev.lambdatestinternal.com/liis",
BUILD_BASE_URL:
"https://api-cypress-v2-dev.lambdatestinternal.com/automation/api/v1/builds/",
"https://api-envi-dev.lambdatestinternal.com/automation/api/v1/builds/",
BUILD_STOP_URL:
"https://api-cypress-v2-dev.lambdatestinternal.com/api/v1/test/stop?sessionId=",
"https://api-envi-dev.lambdatestinternal.com/api/v1/test/stop?sessionId=",
SESSION_URL:
"https://api-cypress-v2-dev.lambdatestinternal.com/automation/api/v1/sessions?limit=200&session_id=",
"https://api-envi-dev.lambdatestinternal.com/automation/api/v1/sessions?limit=200&session_id=",
REPORT_URL:
"https://api-cypress-v2-dev.lambdatestinternal.com/automation/api/v1/cypress/artefacts/test/",
"https://api-envi-dev.lambdatestinternal.com/automation/api/v1/cypress/artefacts/test/",
},
stage: {
INTEGRATION_BASE_URL: "https://stage-api.lambdatestinternal.com/liis",
Expand Down
9 changes: 9 additions & 0 deletions commands/utils/set_args.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,15 @@ function sync_args_from_cmd(args) {
lt_config["run_settings"]["dedicated_proxy"] = false;
}

//Allow npm install via tunnel, to install private dependencies which are behind VPN
if ("npm_via_tunnel" in args) {
lt_config["run_settings"]["npm_via_tunnel"] = true
? args["npm_via_tunnel"] == "true"
: false;
} else if (!lt_config["run_settings"]["npm_via_tunnel"]) {
lt_config["run_settings"]["npm_via_tunnel"] = false;
}

//get specs from current directory if specs are not passed in config or cli
if (
(lt_config["run_settings"]["specs"] == undefined ||
Expand Down
14 changes: 14 additions & 0 deletions commands/utils/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,20 @@ module.exports = validate_config = function (lt_config, validation_configs) {
reject("Error!! Tunnel and Dedicated Proxy can not be passed in same run")
}

//validate if npm_via_tunnel field contains expected value
if ("npm_via_tunnel" in lt_config["run_settings"]) {
if (!(typeof lt_config["run_settings"]["npm_via_tunnel"] === "boolean")) {
reject("Error!! boolean value is expected in npm_via_tunnel key");
}
}

//validate that if npm_via_tunnel is set, tunnel must be set to true
if (lt_config["run_settings"]["npm_via_tunnel"]==true && lt_config["run_settings"]["tunnel"] ==false){
reject("Error!! Installing npm packages behind private VPN is supported only with tunnel. Please pass tunnel as true.")
}else{
console.log("Warning!! Using the flag `npm_via_tunnel` may result in higher build duration.")
}

if(lt_config)
resolve(cypress_version);
});
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ const argv = require("yargs")
alias: "dedicated_proxy",
describe: "dedicated proxy",
type: "bool",
})
.option("npm_tun", {
alias: "npm_via_tunnel",
describe: "Install npm packages which are behind private VPN. Disclaimer:This will increase the build duration of your tests.",
type: "bool",
});
},
function (argv) {
Expand Down