Compare commits
	
		
			No commits in common. "043a1b6ffa9779b577e220cfe22aa92d8c146ac0" and "edb56e96dc3a88255950f030c013ee8bcaf9ebf3" have entirely different histories.
		
	
	
		
			043a1b6ffa
			...
			edb56e96dc
		
	
		
					 7 changed files with 47 additions and 155 deletions
				
			
		
							
								
								
									
										11
									
								
								Dockerfile
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								Dockerfile
									
										
									
									
									
								
							|  | @ -1,11 +0,0 @@ | ||||||
| # Use the published buildbot/buildbot-master image as the base |  | ||||||
| FROM buildbot/buildbot-master:master |  | ||||||
| 
 |  | ||||||
| # Install buildbot-prometheus in the existing virtual environment |  | ||||||
| RUN /buildbot_venv/bin/pip3 install buildbot-prometheus |  | ||||||
| 
 |  | ||||||
| # Set the working directory to where the buildbot files are expected |  | ||||||
| WORKDIR /buildbot |  | ||||||
| 
 |  | ||||||
| # Keep the existing command to start buildbot |  | ||||||
| CMD ["dumb-init", "/usr/src/buildbot/start_buildbot.sh"] |  | ||||||
|  | @ -119,17 +119,4 @@ def fetch_authorization(environment: str): | ||||||
|         roleMatchers=file_based_group_username_role_matchers, |         roleMatchers=file_based_group_username_role_matchers, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     my_authz = buildbot.plugins.util.Authz( |  | ||||||
|         allowRules=[ |  | ||||||
|             buildbot.plugins.util.AnyControlEndpointMatcher( |  | ||||||
|                 role="Developers" |  | ||||||
|             ),  # Organization teams |  | ||||||
|         ], |  | ||||||
|         roleMatchers=[ |  | ||||||
|             buildbot.plugins.util.RolesFromGroups( |  | ||||||
|                 groupPrefix="test-org/" |  | ||||||
|             )  # Gitea organization |  | ||||||
|         ], |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     return my_authz |     return my_authz | ||||||
|  |  | ||||||
|  | @ -2,9 +2,9 @@ | ||||||
| # SPDX-FileCopyrightText: 2011-2024 Blender Authors | # SPDX-FileCopyrightText: 2011-2024 Blender Authors | ||||||
| # <pep8 compliant> | # <pep8 compliant> | ||||||
| 
 | 
 | ||||||
|  | # import buildbot.plugins | ||||||
| import os | import os | ||||||
| from buildbot.www.oauth2 import OAuth2Auth | from buildbot.www.oauth2 import OAuth2Auth | ||||||
| import buildbot.plugins |  | ||||||
| from urllib.parse import urljoin | from urllib.parse import urljoin | ||||||
| 
 | 
 | ||||||
| # Buildbot admin with access to everything. | # Buildbot admin with access to everything. | ||||||
|  | @ -29,8 +29,8 @@ gitea_client_secret = os.environ.get("GITEA_CLIENT_SECRET", default="") | ||||||
| 
 | 
 | ||||||
| def get_authentication(environment: str): | def get_authentication(environment: str): | ||||||
|     class GiteaAuth(OAuth2Auth): |     class GiteaAuth(OAuth2Auth): | ||||||
|         name = "Gitea" |         name = "projects.blender.org" | ||||||
|         faIcon = "fa-gitea" |         faIcon = "fa-cogs" | ||||||
| 
 | 
 | ||||||
|         AUTH_URL = "login/oauth/authorize" |         AUTH_URL = "login/oauth/authorize" | ||||||
|         TOKEN_URL = "login/oauth/access_token" |         TOKEN_URL = "login/oauth/access_token" | ||||||
|  | @ -42,32 +42,10 @@ def get_authentication(environment: str): | ||||||
|             self.tokenUri = urljoin(endpoint, self.TOKEN_URL) |             self.tokenUri = urljoin(endpoint, self.TOKEN_URL) | ||||||
| 
 | 
 | ||||||
|         def getUserInfoFromOAuthClient(self, c): |         def getUserInfoFromOAuthClient(self, c): | ||||||
|             user_info = self.get(c, "/api/v1/user") |             return self.get(c, "/api/v1/user") | ||||||
| 
 | 
 | ||||||
|             orgs = self.get(c, "/api/v1/user/orgs") |     # class LocalEnvAuth(buildbot.plugins.util.CustomAuth): | ||||||
|             org_groups = [org["username"] for org in orgs] |     #     def check_credentials(self, user, password): | ||||||
|  |     #         return user.decode() == "admin" and password.decode() == "admin" | ||||||
| 
 | 
 | ||||||
|             teams = self.get(c, "/api/v1/user/teams") |     return GiteaAuth(gitea_endpoint, gitea_client_id, gitea_client_secret) | ||||||
|             team_groups = [ |  | ||||||
|                 f"{team['organization']['username']}/{team['name']}" for team in teams |  | ||||||
|             ]  # Format: org/team |  | ||||||
| 
 |  | ||||||
|             groups = org_groups + team_groups |  | ||||||
| 
 |  | ||||||
|             user_data = { |  | ||||||
|                 "full_name": user_info.get("full_name", user_info.get("username")), |  | ||||||
|                 "email": user_info.get("email"), |  | ||||||
|                 "username": user_info.get("username"), |  | ||||||
|                 "groups": groups, |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             return user_data |  | ||||||
| 
 |  | ||||||
|     class LocalEnvAuth(buildbot.plugins.util.CustomAuth): |  | ||||||
|         def check_credentials(self, user, password): |  | ||||||
|             return user.decode() == "admin" and password.decode() == "admin" |  | ||||||
| 
 |  | ||||||
|     if gitea_endpoint and gitea_client_id and gitea_client_secret: |  | ||||||
|         return GiteaAuth(gitea_endpoint, gitea_client_id, gitea_client_secret) |  | ||||||
|     else: |  | ||||||
|         return LocalEnvAuth() |  | ||||||
|  |  | ||||||
|  | @ -85,12 +85,6 @@ def setup() -> Dict[str, Any]: | ||||||
|     else: |     else: | ||||||
|         c["services"] = [] |         c["services"] = [] | ||||||
| 
 | 
 | ||||||
|     c["services"].append( |  | ||||||
|         buildbot.plugins.reporters.Prometheus( |  | ||||||
|             port=int(os.environ.get("BUILDBOT_PROMETHEUS_PORT", default=9100)) |  | ||||||
|         ) |  | ||||||
|     ) |  | ||||||
| 
 |  | ||||||
|     ####### PROJECT IDENTITY |     ####### PROJECT IDENTITY | ||||||
| 
 | 
 | ||||||
|     # the 'title' string will appear at the top of this buildbot installation's |     # the 'title' string will appear at the top of this buildbot installation's | ||||||
|  | @ -105,48 +99,57 @@ def setup() -> Dict[str, Any]: | ||||||
|     # buildbot cannot figure out without some help. |     # buildbot cannot figure out without some help. | ||||||
|     c["buildbotURL"] = os.environ.get("BUILDBOT_WEB_URL", "http://localhost:8010/") |     c["buildbotURL"] = os.environ.get("BUILDBOT_WEB_URL", "http://localhost:8010/") | ||||||
| 
 | 
 | ||||||
|     # Initialize |     # Minimalistic config to activate new web UI | ||||||
|     c["www"] = {} |     c["www"] = dict( | ||||||
| 
 |         port=os.environ.get("BUILDBOT_WEB_PORT", 8010), | ||||||
|     # Port |         plugins=dict(waterfall_view={}, console_view={}, grid_view={}), | ||||||
|     c["www"]["port"] = os.environ.get("BUILDBOT_WEB_PORT", 8010) |         theme={ | ||||||
| 
 |             "bb-sidebar-background-color": "#1F2226",  # Eerie Black 2 | ||||||
|     # Plugins |             "bb-sidebar-header-background-color": "#202327",  # Eerie Black | ||||||
|     c["www"]["plugins"] = dict( |             "bb-sidebar-header-text-color": "#9fa3a8",  # Dim Gray (Lighter gray for text) | ||||||
|         waterfall_view={}, |             "bb-sidebar-title-text-color": "#9fa3a8",  # Dim Gray (Titles) | ||||||
|         console_view={}, |             "bb-sidebar-footer-background-color": "#292d32",  # Jet | ||||||
|         grid_view={}, |             "bb-sidebar-button-text-color": "#9fa3a8",  # Dim Gray (Button text) | ||||||
|  |             "bb-sidebar-button-hover-background-color": "#292d32",  # Jet (Button hover background) | ||||||
|  |             "bb-sidebar-button-hover-text-color": "#3dabf5",  # Light blue for hover text | ||||||
|  |             "bb-sidebar-button-current-background-color": "#292d32",  # Jet (Current button background) | ||||||
|  |             "bb-sidebar-button-current-text-color": "#3dabf5",  # Light blue for current button text | ||||||
|  |             "bb-sidebar-stripe-hover-color": "#3695D5",  # Celestial Blue | ||||||
|  |             "bb-sidebar-stripe-current-color": "#084F7E",  # Indigo Dye | ||||||
|  |         }, | ||||||
|     ) |     ) | ||||||
| 
 | 
 | ||||||
|     # Theme |  | ||||||
|     c["www"]["theme"] = { |  | ||||||
|         "bb-sidebar-background-color": "#1F2226",  # Eerie Black 2 |  | ||||||
|         "bb-sidebar-header-background-color": "#202327",  # Eerie Black |  | ||||||
|         "bb-sidebar-header-text-color": "#9fa3a8",  # Dim Gray (Lighter gray for text) |  | ||||||
|         "bb-sidebar-title-text-color": "#9fa3a8",  # Dim Gray (Titles) |  | ||||||
|         "bb-sidebar-footer-background-color": "#292d32",  # Jet |  | ||||||
|         "bb-sidebar-button-text-color": "#9fa3a8",  # Dim Gray (Button text) |  | ||||||
|         "bb-sidebar-button-hover-background-color": "#292d32",  # Jet (Button hover background) |  | ||||||
|         "bb-sidebar-button-hover-text-color": "#3dabf5",  # Light blue for hover text |  | ||||||
|         "bb-sidebar-button-current-background-color": "#292d32",  # Jet (Current button background) |  | ||||||
|         "bb-sidebar-button-current-text-color": "#3dabf5",  # Light blue for current button text |  | ||||||
|         "bb-sidebar-stripe-hover-color": "#3695D5",  # Celestial Blue |  | ||||||
|         "bb-sidebar-stripe-current-color": "#084F7E",  # Indigo Dye |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     # Database |     # Database | ||||||
|     c["db"] = { |     c["db"] = { | ||||||
|         "db_url": os.environ.get("BUILDBOT_DB_URL", "sqlite://").format(**os.environ) |         "db_url": os.environ.get("BUILDBOT_DB_URL", "sqlite://").format(**os.environ) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     # Share usage data |  | ||||||
|     c["buildbotNetUsageData"] = None |     c["buildbotNetUsageData"] = None | ||||||
| 
 | 
 | ||||||
|     # Authentication |     # Authentication | ||||||
|     c["www"]["auth"] = conf.auth.fetch_authentication(environment) |     c["www"]["auth"] = conf.auth.fetch_authentication(environment) | ||||||
| 
 | 
 | ||||||
|     # Authorization |     # Authorization | ||||||
|     c["www"]["authz"] = conf.auth.fetch_authorization(environment) |     # c["www"]["authz"] = conf.auth.fetch_authorization(environment) | ||||||
|  |     c["www"]["authz"] = buildbot.plugins.util.Authz( | ||||||
|  |         allowRules=[ | ||||||
|  |             buildbot.plugins.util.AnyControlEndpointMatcher( | ||||||
|  |                 role="Admins" | ||||||
|  |             ),  # Organization teams | ||||||
|  |         ], | ||||||
|  |         roleMatchers=[ | ||||||
|  |             buildbot.plugins.util.RolesFromGroups( | ||||||
|  |                 groupPrefix="test-org/" | ||||||
|  |             )  # Gitea organization | ||||||
|  |         ], | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     # Disable UI - does not work | ||||||
|  |     c["www"]["plugins"] = { | ||||||
|  |         "waterfall_view": False, | ||||||
|  |         "console_view": False, | ||||||
|  |         "grid_view": False, | ||||||
|  |     } | ||||||
| 
 | 
 | ||||||
|     # UI Defaults |     # UI Defaults | ||||||
|     c["www"]["ui_default_config"] = { |     c["www"]["ui_default_config"] = { | ||||||
|  |  | ||||||
|  | @ -1,8 +1,6 @@ | ||||||
| services: | services: | ||||||
|   buildbot-master: |   buildbot-master: | ||||||
|     # image: 'buildbot/buildbot-master:${BUILDBOT_IMAGE_TAG:-v4.1.0}' |     image: 'buildbot/buildbot-master:${BUILDBOT_IMAGE_TAG:-v4.1.0}' | ||||||
|     build: |  | ||||||
|       context: . |  | ||||||
|     env_file: .env |     env_file: .env | ||||||
|     hostname: buildbot-master |     hostname: buildbot-master | ||||||
|     restart: unless-stopped |     restart: unless-stopped | ||||||
|  | @ -18,7 +16,6 @@ services: | ||||||
|       - 'POSTGRES_USER=${POSTGRES_USER:-buildbot}' |       - 'POSTGRES_USER=${POSTGRES_USER:-buildbot}' | ||||||
|       - 'POSTGRES_DB=${POSTGRES_DB:-buildbot}' |       - 'POSTGRES_DB=${POSTGRES_DB:-buildbot}' | ||||||
|       - 'BUILDBOT_DB_URL=postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@postgresql/{POSTGRES_DB}' |       - 'BUILDBOT_DB_URL=postgresql+psycopg2://{POSTGRES_USER}:{POSTGRES_PASSWORD}@postgresql/{POSTGRES_DB}' | ||||||
|       - 'BUILDBOT_PROMETHEUS_PORT=9100' |  | ||||||
|     healthcheck: |     healthcheck: | ||||||
|       test: |       test: | ||||||
|         - CMD |         - CMD | ||||||
|  | @ -75,12 +72,6 @@ services: | ||||||
|       retries: 10 |       retries: 10 | ||||||
|     networks: |     networks: | ||||||
|       buildbot: null |       buildbot: null | ||||||
|   prometheus: |  | ||||||
|     image: prom/prometheus |  | ||||||
|     volumes: |  | ||||||
|       - './prometheus.yml:/etc/prometheus/prometheus.yml' |  | ||||||
|     ports: |  | ||||||
|       - '9090:9090' |  | ||||||
| volumes: | volumes: | ||||||
|   buildbot-db: {} |   buildbot-db: {} | ||||||
| networks: | networks: | ||||||
|  |  | ||||||
|  | @ -1,7 +0,0 @@ | ||||||
| global: |  | ||||||
|   scrape_interval: 60s |  | ||||||
| scrape_configs: |  | ||||||
|   - job_name: buildbot |  | ||||||
|     static_configs: |  | ||||||
|     - targets: |  | ||||||
|         - buildbot-master:9100 |  | ||||||
|  | @ -1,49 +0,0 @@ | ||||||
| terraform { |  | ||||||
|   required_providers { |  | ||||||
|     libvirt = { |  | ||||||
|       source = "dmacvicar/libvirt" |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| provider "libvirt" { |  | ||||||
|   uri = "qemu:///system" |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| resource "libvirt_volume" "win11-ltsc-cloudbase-init" { |  | ||||||
|   name = "win11-ltsc-cloudbase-init.qcow2" |  | ||||||
|   pool = "default" # List storage pools using virsh pool-list |  | ||||||
|   source = "win11-ltsc-original.qcow2" |  | ||||||
|   format = "qcow2" |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| resource "libvirt_domain" "win11-ltsc-cloudbase-init" { |  | ||||||
|   name   = "win11-ltsc-cloudbase-init" |  | ||||||
|   memory = "8192" |  | ||||||
|   vcpu   = 4 |  | ||||||
| 
 |  | ||||||
|   network_interface { |  | ||||||
|     network_name = "default" # List networks with virsh net-list |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   disk { |  | ||||||
|     volume_id = "${libvirt_volume.win11-ltsc-cloudbase-init.id}" |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   console { |  | ||||||
|     type = "pty" |  | ||||||
|     target_type = "serial" |  | ||||||
|     target_port = "0" |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   graphics { |  | ||||||
|     type = "spice" |  | ||||||
|     listen_type = "address" |  | ||||||
|     autoport = true |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| # Output Server IP |  | ||||||
| output "ip" { |  | ||||||
|   value = "${libvirt_domain.centos7.network_interface.0.addresses.0}" |  | ||||||
| } |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue