[ews-build] Cancel build and similar operations should have authentication
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2019 03:57:11 +0000 (03:57 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2019 03:57:11 +0000 (03:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196520

Reviewed by Dewei Zhu.

* BuildSlaveSupport/ews-build/master.cfg: Configure authentication using admin's username and password from
environment variables.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243854 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/ews-build/master.cfg
Tools/ChangeLog

index d6a89d3..924aa21 100644 (file)
@@ -1,5 +1,8 @@
 import os
 import socket
 import os
 import socket
+import sys
+
+from buildbot.plugins import util
 
 import loadConfig
 from events import Events
 
 import loadConfig
 from events import Events
@@ -16,6 +19,21 @@ c['www']['ui_default_config'] = {
     'Workers.showWorkerBuilders': True,
 }
 
     'Workers.showWorkerBuilders': True,
 }
 
+if not is_test_mode_enabled:
+    admin_username = os.getenv('EWS_ADMIN_USERNAME')
+    admin_password = os.getenv('EWS_ADMIN_PASSWORD')
+    if not admin_username or not admin_password:
+        print('Environment variables for admin username/password not found. Please ensure these variables are set.')
+        sys.exit(1)
+    # See https://docs.buildbot.net/current/manual/configuration/www.html#example-configs
+    authz = util.Authz(
+        allowRules=[util.AnyControlEndpointMatcher(role="admin")],
+        roleMatchers=[util.RolesFromEmails(admin=[admin_username])]
+    )
+    auth = util.UserPasswordAuth({admin_username: admin_password})
+    c['www']['auth'] = auth
+    c['www']['authz'] = authz
+
 c['protocols'] = {'pb': {'port': 17000}}
 
 c['projectName'] = 'WebKit EWS'
 c['protocols'] = {'pb': {'port': 17000}}
 
 c['projectName'] = 'WebKit EWS'
index cd1a0f1..80c7234 100644 (file)
@@ -1,5 +1,15 @@
 2019-04-03  Aakash Jain  <aakash_jain@apple.com>
 
 2019-04-03  Aakash Jain  <aakash_jain@apple.com>
 
+        [ews-build] Cancel build and similar operations should have authentication
+        https://bugs.webkit.org/show_bug.cgi?id=196520
+
+        Reviewed by Dewei Zhu.
+
+        * BuildSlaveSupport/ews-build/master.cfg: Configure authentication using admin's username and password from
+        environment variables.
+
+2019-04-03  Aakash Jain  <aakash_jain@apple.com>
+
         [ews-build] Do not trigger queues which are not in production yet
         https://bugs.webkit.org/show_bug.cgi?id=196581
 
         [ews-build] Do not trigger queues which are not in production yet
         https://bugs.webkit.org/show_bug.cgi?id=196581