kennknowles commented on code in PR #21725:
URL: https://github.com/apache/beam/pull/21725#discussion_r892523781


##########
scripts/ci/issue-report/generateReport.js:
##########
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+const { Octokit } = require("@octokit/rest");
+const nodemailer = require('nodemailer');
+
+function sendReport(title, header, issues) {
+    if (!issues || issues.length == 0) {
+        return;
+    }
+    let report = header + "\n\n"
+    for (const issue of issues) {
+        report += `${issue.url}: ${issue.title}\n`;
+    }
+      
+      nodemailer.createTransport({
+        service: process.env['ISSUE_REPORT_SENDER_EMAIL_SERVICE'], // e.g. 
"gmail"
+        auth: {
+          user: process.env['ISSUE_REPORT_SENDER_EMAIL_ADDRESS'],
+          pass: process.env['ISSUE_REPORT_SENDER_EMAIL_PASSWORD']
+        }
+      }).sendMail({
+        from: process.env['ISSUE_REPORT_SENDER_EMAIL_ADDRESS'],
+        to: process.env['ISSUE_REPORT_RECIPIENT_EMAIL_ADDRESS'],
+        subject: title,
+        text: report
+      }, function(error, info){
+        if (error) {
+          console.log(error);

Review Comment:
   Where will failure end up with this?



##########
scripts/ci/issue-report/generateReport.js:
##########
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+const { Octokit } = require("@octokit/rest");
+const nodemailer = require('nodemailer');
+
+function sendReport(title, header, issues) {
+    if (!issues || issues.length == 0) {
+        return;
+    }
+    let report = header + "\n\n"
+    for (const issue of issues) {
+        report += `${issue.url}: ${issue.title}\n`;
+    }
+      
+      nodemailer.createTransport({
+        service: process.env['ISSUE_REPORT_SENDER_EMAIL_SERVICE'], // e.g. 
"gmail"
+        auth: {
+          user: process.env['ISSUE_REPORT_SENDER_EMAIL_ADDRESS'],
+          pass: process.env['ISSUE_REPORT_SENDER_EMAIL_PASSWORD']
+        }
+      }).sendMail({
+        from: process.env['ISSUE_REPORT_SENDER_EMAIL_ADDRESS'],
+        to: process.env['ISSUE_REPORT_RECIPIENT_EMAIL_ADDRESS'],
+        subject: title,
+        text: report
+      }, function(error, info){
+        if (error) {
+          console.log(error);
+        } else {
+          console.log('Email sent: ' + info.response);

Review Comment:
   Presumably we don't want to get a notification when there is a success. So 
I'm guessing both the above and this are both only visible when someone opts in 
to debugging. Ideally we would get an explicit notification of failure somehow 
(probably not via an emailed report, if we failed to email a report :-).



##########
scripts/ci/issue-report/generateReport.js:
##########
@@ -0,0 +1,118 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+const { Octokit } = require("@octokit/rest");
+const nodemailer = require('nodemailer');
+
+function sendReport(title, header, issues) {
+    if (!issues || issues.length == 0) {
+        return;
+    }
+    let report = header + "\n\n"
+    for (const issue of issues) {
+        report += `${issue.url}: ${issue.title}\n`;
+    }
+      
+      nodemailer.createTransport({
+        service: process.env['ISSUE_REPORT_SENDER_EMAIL_SERVICE'], // e.g. 
"gmail"
+        auth: {
+          user: process.env['ISSUE_REPORT_SENDER_EMAIL_ADDRESS'],
+          pass: process.env['ISSUE_REPORT_SENDER_EMAIL_PASSWORD']
+        }
+      }).sendMail({
+        from: process.env['ISSUE_REPORT_SENDER_EMAIL_ADDRESS'],
+        to: process.env['ISSUE_REPORT_RECIPIENT_EMAIL_ADDRESS'],
+        subject: title,
+        text: report
+      }, function(error, info){
+        if (error) {
+          console.log(error);
+        } else {
+          console.log('Email sent: ' + info.response);
+        }
+      });
+}
+
+async function generateReport() {
+    const octokit = new Octokit({});
+
+    let p0Issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
+    owner: 'apache',
+    repo: 'beam',
+    labels: 'P0'
+    });
+    p0Issues = p0Issues.filter(i => {
+        for (const l of i.labels) {
+            if (l.name == "flaky") {
+                return false;
+            }
+        }
+        return true;
+    });
+    let p0Header = `This is your daily summary of Beam's current P0 issues, 
not including flaky tests.
+
+    See https://beam.apache.org/contribute/issue-priorities/#p0-outage for the 
meaning and expectations around P0 issues.
+
+`;
+    sendReport(`P0 issues report (${p0Issues.length})`, p0Header, p0Issues);
+
+    let p1Issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
+    owner: 'apache',
+    repo: 'beam',
+    labels: 'P1'
+    });
+    p1Issues = p1Issues.filter(i => {
+        for (const l of i.labels) {
+            if (l.name == "flaky") {
+                return false;
+            }
+        }
+        return true;
+    });
+    let p1Header = `This is your daily summary of Beam's current P1 issues, 
not including flaky tests.
+
+    See https://beam.apache.org/contribute/issue-priorities/#p1-critical for 
the meaning and expectations around P1 issues.
+
+`;
+    sendReport(`P1 issues report (${p1Issues.length})`, p1Header, p1Issues);
+
+    let flakyIssues = await octokit.paginate(octokit.rest.issues.listForRepo, {
+    owner: 'apache',
+    repo: 'beam',
+    labels: 'flaky'

Review Comment:
   Incidentally, I standardized on the label `flake` because people are 
inconsistent about `flaky` and `flakey`. Let's see if that becomes an issue or 
not? Or are labels more locked down now so it won't be a problem? Or we could 
have a bot that adjusts common spelling errors.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to