From faad2cb8702e08ded1918cec343f439a7b86fb57 Mon Sep 17 00:00:00 2001 From: Mihai Plesa Date: Thu, 6 Feb 2020 16:49:45 +0000 Subject: [PATCH] added feature to run network audit on demand --- Jenkinsfile | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 36be49e42c7a..4a4ef60addf3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -129,9 +129,7 @@ pipeline { } stage("sccache") { when { - allOf { - expression { !DISABLE_SCCACHE } - } + expression { !DISABLE_SCCACHE } } steps { script { @@ -351,9 +349,7 @@ pipeline { } stage("sccache") { when { - allOf { - expression { !DISABLE_SCCACHE } - } + expression { !DISABLE_SCCACHE } } steps { script { @@ -370,6 +366,9 @@ pipeline { } } stage("audit-network") { + when { + expression { RUN_NETWORK_AUDIT } + } steps { timeout(time: 4, unit: "MINUTES") { catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { @@ -497,9 +496,7 @@ pipeline { } stage("sccache") { when { - allOf { - expression { !DISABLE_SCCACHE } - } + expression { !DISABLE_SCCACHE } } steps { script { @@ -520,6 +517,9 @@ pipeline { } } stage("audit-network") { + when { + expression { RUN_NETWORK_AUDIT } + } steps { timeout(time: 4, unit: "MINUTES") { catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { @@ -687,18 +687,6 @@ pipeline { } } } - stage("sccache") { - when { - allOf { - expression { !DISABLE_SCCACHE } - } - } - steps { - script { - sccacheWindows() - } - } - } stage("build") { environment { SIGN_WIDEVINE_CERT = credentials("widevine_brave_prod_cert.der") @@ -715,6 +703,9 @@ pipeline { } } stage("audit-network") { + when { + expression { RUN_NETWORK_AUDIT } + } steps { timeout(time: 4, unit: "MINUTES") { catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') { @@ -837,6 +828,7 @@ def setEnv() { SKIP_LINUX = bbPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/skip-linux") }.equals(1) SKIP_MACOS = bbPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/skip-macos") }.equals(1) SKIP_WINDOWS = bbPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/skip-windows") }.equals(1) + RUN_NETWORK_AUDIT = bbPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/run-network-audit") }.equals(1) env.SLACK_USERNAME = readJSON(text: SLACK_USERNAME_MAP)[bbPrDetails.user.login] env.BRANCH_PRODUCTIVITY_HOMEPAGE = "https://github.com/brave/brave-browser/pull/${bbPrNumber}" env.BRANCH_PRODUCTIVITY_NAME = "Brave Browser PR #${bbPrNumber}" @@ -856,6 +848,7 @@ def setEnv() { SKIP_LINUX = SKIP_LINUX || bcPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/skip-linux") }.equals(1) SKIP_MACOS = SKIP_MACOS || bcPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/skip-macos") }.equals(1) SKIP_WINDOWS = SKIP_WINDOWS || bcPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/skip-windows") }.equals(1) + RUN_NETWORK_AUDIT = RUN_NETWORK_AUDIT || bcPrDetails.labels.count { label -> label.name.equalsIgnoreCase("CI/run-network-audit") }.equals(1) env.SLACK_USERNAME = readJSON(text: SLACK_USERNAME_MAP)[bcPrDetails.user.login] env.BRANCH_PRODUCTIVITY_HOMEPAGE = "https://github.com/brave/brave-core/pull/${bcPrDetails.number}" env.BRANCH_PRODUCTIVITY_NAME = "Brave Core PR #${bcPrDetails.number}" @@ -1024,14 +1017,6 @@ def sccache() { sh "npm config --userconfig=.npmrc set sccache sccache" } -def sccacheWindows() { - echo "Enabling sccache" - powershell """ - \$ErrorActionPreference = "Stop" - npm config --userconfig=.npmrc set sccache sccache - """ -} - def config() { sh """ npm config --userconfig=.npmrc set brave_referrals_api_key ${REFERRAL_API_KEY}