Stop sending mails

This was broken for some time (at one point just because the name
of the parameters was wrong) so do not send mail ; nobody reads them anyway.

Fixes #107.
Fixes #108.

Change-Id: I29ab256349360fe7ab1cdb723e7dfe400eed4fde
diff --git a/jenkins/build_defs/bazel-job-Gerrit.xml.tpl b/jenkins/build_defs/bazel-job-Gerrit.xml.tpl
index 201038b..c008779 100644
--- a/jenkins/build_defs/bazel-job-Gerrit.xml.tpl
+++ b/jenkins/build_defs/bazel-job-Gerrit.xml.tpl
@@ -60,7 +60,6 @@
         bazel_version: "latest",
         configuration: '''{{ raw_imports['JSON_CONFIGURATION'].replace('\\', '\\\\').replace("'", "\\'") }}''',
         workspace: "{{ variables.WORKSPACE }}",
-        mail_recipient: "",
         {% if variables.SAUCE_ENABLED == "true" %}
         sauce: "61b4846b-279d-4369-ae20-31e9d8b9bc66",
         {% endif %}
diff --git a/jenkins/build_defs/bazel-job-Global.xml.tpl b/jenkins/build_defs/bazel-job-Global.xml.tpl
index 14ecb16..6826b74 100644
--- a/jenkins/build_defs/bazel-job-Global.xml.tpl
+++ b/jenkins/build_defs/bazel-job-Global.xml.tpl
@@ -60,7 +60,6 @@
     extra_bazelrc: params.EXTRA_BAZELRC,
     configuration: '''{{ raw_imports['JSON_CONFIGURATION'].replace('\\', '\\\\').replace("'", "\\'") }}''',
     workspace: "{{ variables.WORKSPACE }}",
-    mail_recipient: "",
     {% if variables.SAUCE_ENABLED == "true" %}
     sauce: "61b4846b-279d-4369-ae20-31e9d8b9bc66",
     {% endif %}
diff --git a/jenkins/build_defs/bazel-job-PR.xml.tpl b/jenkins/build_defs/bazel-job-PR.xml.tpl
index 38e11b0..65873cf 100644
--- a/jenkins/build_defs/bazel-job-PR.xml.tpl
+++ b/jenkins/build_defs/bazel-job-PR.xml.tpl
@@ -66,7 +66,6 @@
         bazel_version: "latest",
         configuration: '''{{ raw_imports['JSON_CONFIGURATION'].replace('\\', '\\\\').replace("'", "\\'") }}''',
         workspace: "{{ variables.WORKSPACE }}",
-        mail_recipient: "",
         {% if variables.SAUCE_ENABLED == "true" %}
         sauce: "61b4846b-279d-4369-ae20-31e9d8b9bc66",
         {% endif %}
diff --git a/jenkins/build_defs/bazel-job.xml.tpl b/jenkins/build_defs/bazel-job.xml.tpl
index 311ae41..b45146f 100644
--- a/jenkins/build_defs/bazel-job.xml.tpl
+++ b/jenkins/build_defs/bazel-job.xml.tpl
@@ -49,7 +49,6 @@
     bazel_version: "latest",
     configuration: '''{{ raw_imports['JSON_CONFIGURATION'].replace('\\', '\\\\').replace("'", "\\'") }}''',
     workspace: "{{ variables.WORKSPACE }}",
-    mail_recipient: "{{ variables.BAZEL_BUILD_RECIPIENT }}",
     {% if variables.SAUCE_ENABLED == "true" %}
     sauce: "61b4846b-279d-4369-ae20-31e9d8b9bc66",
     {% endif %}
diff --git a/jenkins/jobs/global/nightly.xml.tpl b/jenkins/jobs/global/nightly.xml.tpl
index 2b69a93..830cb73 100644
--- a/jenkins/jobs/global/nightly.xml.tpl
+++ b/jenkins/jobs/global/nightly.xml.tpl
@@ -44,8 +44,7 @@
       extra_bazelrc: params.EXTRA_BAZELRC,
       refspec: "+refs/heads/*:refs/remotes/origin/*",
       configuration: '''{{ raw_imports['//jenkins/jobs:configs/bootstrap.json'].replace('\\', '\\\\').replace("'", "\\'") }}''',
-      restrict_configuration: {{ variables.RESTRICT_CONFIGURATION }},
-      mail_recipient: "{{ variables.BAZEL_BUILD_RECIPIENT }}")
+      restrict_configuration: {{ variables.RESTRICT_CONFIGURATION }})
   </script>
     <sandbox>true</sandbox>
   </definition>
diff --git a/jenkins/jobs/global/release.xml.tpl b/jenkins/jobs/global/release.xml.tpl
index 4c441c4..7fd5e13 100644
--- a/jenkins/jobs/global/release.xml.tpl
+++ b/jenkins/jobs/global/release.xml.tpl
@@ -42,8 +42,7 @@
       extra_bazelrc: params.EXTRA_BAZELRC,
       refspec: "+refs/heads/*:refs/remotes/origin/* +refs/notes/*:refs/notes/*",
       configuration: '''{{ raw_imports['//jenkins/jobs:configs/bootstrap.json'].replace('\\', '\\\\').replace("'", "\\'") }}''',
-      restrict_configuration: {{ variables.RESTRICT_CONFIGURATION }},
-      mail_recipient: "{{ variables.BAZEL_BUILD_RECIPIENT }}")
+      restrict_configuration: {{ variables.RESTRICT_CONFIGURATION }})
 }
   </script>
     <sandbox>true</sandbox>
diff --git a/jenkins/lib/vars/bazelCiConfiguredJob.groovy b/jenkins/lib/vars/bazelCiConfiguredJob.groovy
index ec045a3..f4b1fe3 100644
--- a/jenkins/lib/vars/bazelCiConfiguredJob.groovy
+++ b/jenkins/lib/vars/bazelCiConfiguredJob.groovy
@@ -70,7 +70,6 @@
  *   - repository: git repository to clone.
  *   - branch: branch of the repository to clone (default: master).
  *   - refspec: specification of the references to fetch
- *   - mail_recipient: recipient for mail notification (empty: no mail notification)
  *   - sauce: identifier of the crendentials to connect to SauceLabs.
  *   - run_sequentially: run each configuration sequentially rather than in parallel
  */
@@ -83,7 +82,6 @@
   config["repository"] = config.get("repository", "")
   config["branch"] = config.get("branch", "master")
   config["refspec"] = config.get("refspec", "+refs/heads/*:refs/remotes/origin/*")
-  config["mail_recipient"] = config.get("mail_recipient", "bazel-ci@googlegroups.com")
   config["sauce"] = config.get("sauce", "")
   config["run_sequentially"] = config.get("run_sequentially", false)
 
@@ -104,22 +102,20 @@
   }
 
 
-  notifyStatus(config.mail_recipient) {
-    timeout(240) {
-      try {
-        stage("Run configurations") {
-          if (config.run_sequentially) {
-            for (configName in configNames) {
-              configs[configName]()
-            }
-          } else {
-            parallel configs
+  timeout(240) {
+    try {
+      stage("Run configurations") {
+        if (config.run_sequentially) {
+          for (configName in configNames) {
+            configs[configName]()
           }
+        } else {
+          parallel configs
         }
-      } catch(build.bazel.ci.BazelTestFailure ex) {
-        // Do not mark the build as error with a test failure
-        currentBuild.result = "UNSTABLE"
       }
+    } catch(build.bazel.ci.BazelTestFailure ex) {
+      // Do not mark the build as error with a test failure
+      currentBuild.result = "UNSTABLE"
     }
   }
 }
diff --git a/jenkins/lib/vars/globalBazelTest.groovy b/jenkins/lib/vars/globalBazelTest.groovy
index d00c8de..35271cd 100644
--- a/jenkins/lib/vars/globalBazelTest.groovy
+++ b/jenkins/lib/vars/globalBazelTest.groovy
@@ -21,7 +21,6 @@
   def branch = config.get("branch", "master")
   def extra_bazelrc = config.get("extra_bazelrc", "")
   def refspec = config.get("refspec", "+refs/heads/*:refs/remotes/origin/*")
-  def mail_recipient = config.get("recipient", "")
   def json_config = config.configuration
   def restrict_configuration = config.get("restrict_configuration", [])
 
@@ -29,16 +28,13 @@
     echo "Running global test for branch ${branch} (refspec: ${refspec})"
   }
 
-  notifyStatus(mail_recipient) {
-    // First we bootstrap bazel on all platform
-    stage("Bootstrap on all platforms") {
-      bootstrapBazelAll(repository: repository,
-                        branch: branch,
-                        refspec: refspec,
-                        email: mail_recipient,
-                        configuration: json_config,
-                        restrict_configuration: restrict_configuration)
-    }
+  // First we bootstrap bazel on all platform
+  stage("Bootstrap on all platforms") {
+    bootstrapBazelAll(repository: repository,
+                      branch: branch,
+                      refspec: refspec,
+                      configuration: json_config,
+                      restrict_configuration: restrict_configuration)
   }
 
 
@@ -107,13 +103,5 @@
 
   stage("Publish report") {
     reportAB report: report, name: "Downstream projects"
-    if (mail_recipient) {
-      mail(subject: "Global tests #${currentBuild.number} finished with status ${currentBuild.result}",
-           body: """A global tests has just finished with status ${currentBuild.result}.
-
-You can find the report at ${currentBuild.getAbsoluteUrl()}Downstream_projects/.
-""",
-           to: mail_recipient)
-    }
   }
 }
diff --git a/jenkins/lib/vars/notifyStatus.groovy b/jenkins/lib/vars/notifyStatus.groovy
deleted file mode 100644
index 4d13af9..0000000
--- a/jenkins/lib/vars/notifyStatus.groovy
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2017 The Bazel Authors
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * Define a step "notifyStatus" to notify the status of the
- * current build. Currently only send a mail to "recipients".
- */
-def call(String recipients, Closure body) {
-  try {
-    body()
-  } finally {
-    stage("Sending results") {
-      if (recipients != null && !recipients.isEmpty()) {
-        node("deploy") {
-          // Why do we even need a node to send a mail?
-          // TODO(dmarting): maybe use mailext?
-          echo "Sending mail to ${recipients}"
-          step([$class: 'Mailer',
-                notifyEveryUnstableBuild: false,
-                recipients: recipients,
-                sendToIndividuals: false])
-        }
-      } else {
-        echo "Mail notifications disabled"
-      }
-    }
-  }
-}