You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2023/01/18 14:31:56 UTC

[GitHub] [beam] dannymartinm opened a new pull request, #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

dannymartinm opened a new pull request, #23157:
URL: https://github.com/apache/beam/pull/23157

   `DO NOT MERGE until the infrastructure is in place.`
   
   As part of the issue [21106](https://github.com/apache/beam/issues/21106), @elink21 and I have implemented the self-hosted runners for the Ubuntu and Windows operating systems. 
   
   Please see the Approved Pull Request ([PR#22703](https://github.com/apache/beam/pull/22703)) for reference.
   
   In this PR you will find the following changes: 
   
   * Adding Monitor Self-hosted Runners to `runs-on` GitHub-hosted runners. This workflow monitors if the Beam self-hosted runners are up and healthy. 
   
   [PR#16511 ](https://github.com/apache/beam/pull/16511): Previous PR for reference.
   [BEAM-12812](https://issues.apache.org/jira/browse/BEAM-12812): Original Jira may contain additional context. 
   
   ------------------------
   
   Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
   
    - [ ] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`).
    - [ ] Mention the appropriate issue in your description (for example: `addresses #123`), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment `fixes #<ISSUE NUMBER>` instead.
    - [ ] Update `CHANGES.md` with noteworthy changes.
    - [ ] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/get-started-contributing/#make-the-reviewers-job-easier).
   
   To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md)
   
   GitHub Actions Tests Status (on master branch)
   ------------------------------------------------------------------------------------------------
   [![Build python source distribution and wheels](https://github.com/apache/beam/workflows/Build%20python%20source%20distribution%20and%20wheels/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule)
   [![Python tests](https://github.com/apache/beam/workflows/Python%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Java tests](https://github.com/apache/beam/workflows/Java%20Tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule)
   [![Go tests](https://github.com/apache/beam/workflows/Go%20tests/badge.svg?branch=master&event=schedule)](https://github.com/apache/beam/actions?query=workflow%3A%22Go+tests%22+branch%3Amaster+event%3Aschedule)
   
   See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI.
   


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1254977375

   Reminder, please take a look at this pr: @damccorm 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] elink21 commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
elink21 commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1308957767

   Status update: reviewed by @damccorm, waiting for the migration window to deploy the infrastructure and request the merge. 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1375574814

   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] elink21 commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
elink21 commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1242454982

   This additional workflow doesn't run on Self-hosted Runners but is preferable to wait until the self-hosted Runners are up and running for merging to avoid false outage alerts. 


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] closed pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow 
URL: https://github.com/apache/beam/pull/23157


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1242466143

   Assigning reviewers. If you would like to opt out of this review, comment `assign to next reviewer`:
   
   R: @damccorm for label build.
   
   Available commands:
   - `stop reviewer notifications` - opt out of the automated review tooling
   - `remind me after tests pass` - tag the comment author after tests pass
   - `waiting on author` - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)
   
   The PR bot will only process comments in the main thread (not review comments).


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1477774165

   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damccorm closed pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by "damccorm (via GitHub)" <gi...@apache.org>.
damccorm closed pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow 
URL: https://github.com/apache/beam/pull/23157


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] elink21 commented on a diff in pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
elink21 commented on code in PR #23157:
URL: https://github.com/apache/beam/pull/23157#discussion_r970135709


##########
.github/workflows/monitor_self_hosted_runners.yml:
##########
@@ -0,0 +1,54 @@
+# 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.
+
+name: Monitor Self-Hosted Runners Status
+on:
+  schedule:
+    - cron: "0 */12 * * *"

Review Comment:
   Yes, it's only a single Cloud Function call so we can run it more frequently



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] github-actions[bot] commented on pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #23157:
URL: https://github.com/apache/beam/pull/23157#issuecomment-1387006721

   This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.


-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damccorm commented on a diff in pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
damccorm commented on code in PR #23157:
URL: https://github.com/apache/beam/pull/23157#discussion_r968412131


##########
.github/workflows/monitor_self_hosted_runners.yml:
##########
@@ -0,0 +1,54 @@
+# 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.
+
+name: Monitor Self-Hosted Runners Status
+on:
+  schedule:
+    - cron: "0 */12 * * *"

Review Comment:
   ```suggestion
       - cron: "*/30 * * * *"
   ```
   
   Lets maybe run this more frequently since it should be cheap?



##########
.github/workflows/monitor_self_hosted_runners.yml:
##########
@@ -0,0 +1,54 @@
+# 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.
+
+name: Monitor Self-Hosted Runners Status
+on:
+  schedule:
+    - cron: "0 */12 * * *"
+  workflow_dispatch:
+jobs:
+  monitor-runners:
+    name: Monitor Self-hosted Runners Status
+    runs-on: ubuntu-latest
+    steps:
+    - name: Set up Cloud SDK
+      uses: google-github-actions/setup-gcloud@v0
+    - name: Set up node
+      uses: actions/setup-node@v3
+      with:
+        node-version: 16
+    - name: Setup checkout
+      uses: actions/checkout@v3
+    - name: Setup GCP account
+      run: |
+            echo "${{ secrets.GCP_PLAYGROUND_SA_KEY }}" | base64 -d > /tmp/gcp_access.json
+            which gcloud
+            gcloud auth activate-service-account --project=apache-beam-testing --key-file=/tmp/gcp_access.json
+    - name: Exporting ID
+      run: echo "IDENTITY_TOKEN=$(gcloud auth print-identity-token)" >> $GITHUB_ENV
+            
+    - name: Run monitor script
+      run: |
+        npm install
+        node sendRunnersReport.js
+      working-directory: 'scripts/ci/self-hosted-runners-report' 
+      env:
+        ISSUE_REPORT_SENDER_EMAIL_ADDRESS: "${{ secrets.ISSUE_REPORT_SENDER_EMAIL_ADDRESS }}"
+        ISSUE_REPORT_SENDER_EMAIL_PASSWORD: ${{ secrets.ISSUE_REPORT_SENDER_EMAIL_PASSWORD }}
+        ISSUE_REPORT_RECIPIENT_EMAIL_ADDRESS: "dev@beam.apache.org"
+        ISSUE_REPORT_SENDER_EMAIL_SERVICE: "gmail"
+        ENDPOINT: "https://us-central1-apache-beam-testing.cloudfunctions.net/monitorRunnersStatus" #we suggest adding this ENDPOINT as a repo secret too

Review Comment:
   > we suggest adding this ENDPOINT as a repo secret too
   
   Does keeping this secret actually get us anything?



##########
scripts/ci/self-hosted-runners-report/sendRunnersReport.js:
##########
@@ -0,0 +1,101 @@
+//  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 nodemailer = require("nodemailer");
+const axios = require('axios');
+
+
+async function getRunnersStatus() {
+    let status = await axios.post(process.env["ENDPOINT"], {}, {
+        headers: {
+            Accept: "application/json",
+            Authorization: "bearer " + process.env["IDENTITY_TOKEN"]
+        }
+    });
+    return status.data;
+}
+
+async function sendAlertEmail(status) {
+    statusTables = {}
+    //Creating status tables
+    for (let OS of ["Linux", "Windows"]) {
+        statusTables[OS] = `
+        <h3> ${OS} </h3>
+        <table style='border: 1px solid grey;'>
+            <tr>
+                <th>Total Runners</th>
+                <th>Online Runners </th>
+                <th>Offline Runners</th>
+            </tr>
+        
+            <tr>
+                <td>${status[OS].totalRunners}</td>
+                <td>${status[OS].onlineRunners}</td>
+                <td>${status[OS].offlineRunners}</td>
+            </tr>
+        </table>
+        `
+    }
+
+    const htmlMsg = ` 
+        <p>Here is the runners status per Operative System, please inspect GCP console for further details: </p> <br>

Review Comment:
   ```suggestion
           <p>Here is the runners status per Operating System, please inspect GCP console for further details: </p> <br>
   ```



##########
scripts/ci/self-hosted-runners-report/sendRunnersReport.js:
##########
@@ -0,0 +1,101 @@
+//  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 nodemailer = require("nodemailer");
+const axios = require('axios');
+
+
+async function getRunnersStatus() {
+    let status = await axios.post(process.env["ENDPOINT"], {}, {
+        headers: {
+            Accept: "application/json",
+            Authorization: "bearer " + process.env["IDENTITY_TOKEN"]
+        }
+    });
+    return status.data;
+}
+
+async function sendAlertEmail(status) {
+    statusTables = {}
+    //Creating status tables
+    for (let OS of ["Linux", "Windows"]) {
+        statusTables[OS] = `
+        <h3> ${OS} </h3>
+        <table style='border: 1px solid grey;'>
+            <tr>
+                <th>Total Runners</th>
+                <th>Online Runners </th>
+                <th>Offline Runners</th>
+            </tr>
+        
+            <tr>
+                <td>${status[OS].totalRunners}</td>
+                <td>${status[OS].onlineRunners}</td>
+                <td>${status[OS].offlineRunners}</td>
+            </tr>
+        </table>
+        `
+    }
+
+    const htmlMsg = ` 
+        <p>Here is the runners status per Operative System, please inspect GCP console for further details: </p> <br>
+        ` + statusTables["Linux"] + "<br>" + statusTables["Windows"];
+
+    nodemailer.createTransport({
+        service: process.env['ISSUE_REPORT_SENDER_EMAIL_SERVICE'], 
+        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: "Alert; self-hosted runners are not healthy",
+        html: htmlMsg,
+    }, function (error, info) {
+        if (error) {
+            throw new Error(`Failed to send email with error: ${error}`);
+        } else {
+            console.log('Email sent: ' + info.response);
+        }
+    });
+}
+
+async function monitorRunnersStatus() {
+    const status = await getRunnersStatus().catch(console.error);
+    console.log(status);
+    if (status.Linux.onlineRunners == 0 || status.Windows.onlineRunners == 0) {

Review Comment:
   How many runners do we expect to be online? I'd anticipate its much more than 1 each; can we alert on higher numbers here? (e.g. `if (status.Linux.onlineRunners <= 3 || status.Windows.onlineRunners <= 3) {` - but with realistic numbers instead of `3`)



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] damccorm commented on a diff in pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
damccorm commented on code in PR #23157:
URL: https://github.com/apache/beam/pull/23157#discussion_r970792292


##########
.github/workflows/monitor_self_hosted_runners.yml:
##########
@@ -0,0 +1,54 @@
+# 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.
+
+name: Monitor Self-Hosted Runners Status
+on:
+  schedule:
+    - cron: "0 */12 * * *"
+  workflow_dispatch:
+jobs:
+  monitor-runners:
+    name: Monitor Self-hosted Runners Status
+    runs-on: ubuntu-latest
+    steps:
+    - name: Set up Cloud SDK
+      uses: google-github-actions/setup-gcloud@v0
+    - name: Set up node
+      uses: actions/setup-node@v3
+      with:
+        node-version: 16
+    - name: Setup checkout
+      uses: actions/checkout@v3
+    - name: Setup GCP account
+      run: |
+            echo "${{ secrets.GCP_PLAYGROUND_SA_KEY }}" | base64 -d > /tmp/gcp_access.json
+            which gcloud
+            gcloud auth activate-service-account --project=apache-beam-testing --key-file=/tmp/gcp_access.json
+    - name: Exporting ID
+      run: echo "IDENTITY_TOKEN=$(gcloud auth print-identity-token)" >> $GITHUB_ENV
+            
+    - name: Run monitor script
+      run: |
+        npm install
+        node sendRunnersReport.js
+      working-directory: 'scripts/ci/self-hosted-runners-report' 
+      env:
+        ISSUE_REPORT_SENDER_EMAIL_ADDRESS: "${{ secrets.ISSUE_REPORT_SENDER_EMAIL_ADDRESS }}"
+        ISSUE_REPORT_SENDER_EMAIL_PASSWORD: ${{ secrets.ISSUE_REPORT_SENDER_EMAIL_PASSWORD }}
+        ISSUE_REPORT_RECIPIENT_EMAIL_ADDRESS: "dev@beam.apache.org"
+        ISSUE_REPORT_SENDER_EMAIL_SERVICE: "gmail"
+        ENDPOINT: "https://us-central1-apache-beam-testing.cloudfunctions.net/monitorRunnersStatus" #we suggest adding this ENDPOINT as a repo secret too

Review Comment:
   Cool, lets keep it public then and remove the comment



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [beam] elink21 commented on a diff in pull request #23157: [GitHub Actions] - Adding Monitor Self-hosted Runners Workflow

Posted by GitBox <gi...@apache.org>.
elink21 commented on code in PR #23157:
URL: https://github.com/apache/beam/pull/23157#discussion_r970141595


##########
.github/workflows/monitor_self_hosted_runners.yml:
##########
@@ -0,0 +1,54 @@
+# 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.
+
+name: Monitor Self-Hosted Runners Status
+on:
+  schedule:
+    - cron: "0 */12 * * *"
+  workflow_dispatch:
+jobs:
+  monitor-runners:
+    name: Monitor Self-hosted Runners Status
+    runs-on: ubuntu-latest
+    steps:
+    - name: Set up Cloud SDK
+      uses: google-github-actions/setup-gcloud@v0
+    - name: Set up node
+      uses: actions/setup-node@v3
+      with:
+        node-version: 16
+    - name: Setup checkout
+      uses: actions/checkout@v3
+    - name: Setup GCP account
+      run: |
+            echo "${{ secrets.GCP_PLAYGROUND_SA_KEY }}" | base64 -d > /tmp/gcp_access.json
+            which gcloud
+            gcloud auth activate-service-account --project=apache-beam-testing --key-file=/tmp/gcp_access.json
+    - name: Exporting ID
+      run: echo "IDENTITY_TOKEN=$(gcloud auth print-identity-token)" >> $GITHUB_ENV
+            
+    - name: Run monitor script
+      run: |
+        npm install
+        node sendRunnersReport.js
+      working-directory: 'scripts/ci/self-hosted-runners-report' 
+      env:
+        ISSUE_REPORT_SENDER_EMAIL_ADDRESS: "${{ secrets.ISSUE_REPORT_SENDER_EMAIL_ADDRESS }}"
+        ISSUE_REPORT_SENDER_EMAIL_PASSWORD: ${{ secrets.ISSUE_REPORT_SENDER_EMAIL_PASSWORD }}
+        ISSUE_REPORT_RECIPIENT_EMAIL_ADDRESS: "dev@beam.apache.org"
+        ISSUE_REPORT_SENDER_EMAIL_SERVICE: "gmail"
+        ENDPOINT: "https://us-central1-apache-beam-testing.cloudfunctions.net/monitorRunnersStatus" #we suggest adding this ENDPOINT as a repo secret too

Review Comment:
   The Cloud Function requires authentication for invocation and it's configured to only allow calls within the same VPC so keeping it public shouldn't affect security.



-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org