Open source of the build infrastructure used by Stadia Games & Entertainment

Overview

SG&E Monorepo

This repository contains the open sourcing of the infrastructure developed by Stadia Games & Entertainment (SG&E) to run its operations. This entails part of the build system setup, the CICD system and a number of tools developed for internal use, some experimental in nature, some saw more widespread use. No game projects or game-related technologies are present in this repository.

This system is not being worked on anymore, so it will not have any support. We are open sourcing for contribution purposes mostly. Note that the system also has limited documentation.

This is not an officially supported Google product.

NOTE: This is not a working system as it is published here. Several key setup pieces, like the Bazel setup, the toolchains, the vendored dependencies are not present. It is likely to be a non-trivial amount of work to get it up and running again.

Requirements

SG&E was running on a custom environment that was different from normal Google operations. The reasons for these were various, but a big driver was to have the ability to tailor the infra to the specific needs of making video games.

Overall we strived to maintain the feel and good practices of Google's own tooling, which informed the kind of tooling and design paradigms we chose. In that vein, we determined the following requirements for our infrastructure:

  • Windows based: game developers, especially non-programmers, heavily rely on windows based tooling, so it makes sense to natively support that platform.

  • Monorepo: We determined that the benefits in maintenance and verifyability outweighed the costs of a monorepo, so we decided to have all of our code and assets in one single repository.

  • Hermetic: All dependencies must be checked in into de monorepo. This heavily decreases the maintenance burden, as builds (locally or on CI) do not depend on the machine's environment to work. This comes with the burden to have to vendor (check-in) all the third party dependendies into the monorepo. (NOTE: these dependencies are not present in this github repository, they would have to be re-vendored as needed).

Build System: Bazel & sgeb

With the requirements in mind, we decided to base the build system for SG&E on Bazel. This is because it is a polyglot (multi-language) build system designed to work on monorepos: Google's internal version of Bazel powers the largest repository of the world.

While Bazel is very extensible and supports many targets, there are certain projects that it is not reasonable or feasable to build with Bazel. The clearest example of this are the game engines, which normally have their own build orchestrator: Unreal has UnrealBuildTool and Unity drives it's own build internally as a black box.

Since we wanted to support one single build system regardless of the target and support all the possible targets, we decided to create a layer on top of Bazel that would cover all the cases: SG&E Build, or sgeb. The code for sgeb can be found in build/cicd/sgeb.

sgeb is a Bazel-like system in terms of its interface (BUILDUNIT files vs BUILD files that Bazel uses) that can delegates the build of a sgeb target to an underlying tool that knows how to do it. If it's a normal Bazel target (like a Go program), sgeb will delegate to Bazel. But if it is a more uncommon target, programmers are able to write custom programs that know how to build that target. sgeb will then build and invoke this builder for them. Builders are meant to build targets that already have their special way of building that it is not reasonable to port to Bazel. For all other cases Bazel should be used. In the game engine examples, there would be an unreal_builder that drives the Unreal build and an unity_builder that drives the Unity builds. These builders are sgeb targets themselves, meaning that can be written in any language that sgeb supports. In practice, they are all Go programs. Builders can be found in build/builders.

NOTE: This open source version was modified to build with the normal Go flow (go build), with some caveats. See the build scripts and repobuilder for more details. While the tooling builds, most of the functionality will not work as it expects a valid Bazel WORKSPACE and several other setups (eg. MONOREPO). It also has heavy assumptions of running in a Perforce depot.

You can see more documentation on this on docs/sgeb.md.

CICD

Most of the infrastructure was written in Go, using protobuf for configuration. Our strategy for CICD was to have a single binary that had a simple plugin architecture to drive common use cases (presubmit, building, etc.). The goal was to maintain as much logic as possible within the monorepo and not rely in external CICD platforms for configuration.

The code for the cicd code can be found in build/cicd. The program that was run on CI machines is found in build/cicd/cirunner.

You can see more documentation on this on docs/sgep.md.

How to run

It is important to note that the way the project builds in this github repository is not the same that was used in SG&E. This is because Bazel is not used for driving the build in this case, in order to simplify distribution. Instead we modifying the source to be able to be built with the normal Go toolchain (eg. go build).

Keep in mind that there are some caveats, that Bazel and our vendored monorepo took care for use:

  • Some targets (like the p4lib) use cgo to link against C++ libraries. You wil need to compile and provide those libraries yourself, as they are not included in this repository. You can check on the source of each Go package what libraries they are. IMPORTANT: Compile these dependencies with a GNU toolchain (MinGW), as that is the toolchain that Go uses. There seems to be ABI incompatibilities with the MSVC toolchain.

  • Go has no concept of generating protobuf stubs, so these need to be generated before doing a normal build. This will require you to install the protoc compiler. We added a simple script to help with building the stubs, but it will require some PATH modification to work. This file can be found in build_protos.bat.

  • Our setup uses some marker files to find the monorepo. In particular Bazel uses its WORKSPACE file, which should have the correct mapping for all the dependencies (either vendored or otherwise). The CICD system uses an empty MONOREPO file to mark the monorepo. The WORKSPACE and the MONOREPO file should be side to side. This separation came because there are multiple WORKSPACES due to the way we vendored.

Third party

As the last section showed, some third party code and libraries would be needed to build. You can see in each individual package or code where the code is expected to be but overall they conform to the following:

third_party/
  lib/
    ... all pre-compiled libraries ...
  ...
  
  ...

As an example, the p4api would be installed into third_party/p4api.

You might also like...
Blunder is an open-source UCI compatible chess engine.

A UCI compatible chess engine written in Golang

an API to handle the deck and cards to be used in any game like Poker and Blackjack.

Card Games REST API in GO Simple RESTful API for Card games. with database implementation Quick Start # Install mux router cd /main go get -u github.c

A chess GUI build using the Fyne toolkit.
A chess GUI build using the Fyne toolkit.

Chess The subject of my current live stream series. A simple chess UI built with Fyne. Thanks to: Chess Go library by Logan Spears github.com/notnil/c

build and animate objects according to verlet physics. pure golang library
build and animate objects according to verlet physics. pure golang library

verlet build and animate objects according to verlet physics. pure golang library Examples depend on pixel library, see requirements to build them: wo

GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes. GoReplay is an open-source tool for capturing and replaying live HTTP traffic into a test environment in order to continuously test your system with real data. It can be used to increase confidence in code deployments, configuration changes and infrastructure changes.
Keeps track of Steam Deck Verifications. On first run, it reports all games with their respective Steam Deck Verification status. On subsequent runs, the tool will report newly tested and updated games.

Keeps track of Steam Deck Verifications. On first run, it reports all games with their respective Steam Deck Verification status. On subsequent runs, the tool will report newly tested and updated games.

Nintendo Entertainment System (NES) and Famicom emulator written in Go
Nintendo Entertainment System (NES) and Famicom emulator written in Go

go6502 Nintendo Entertainment System (NES) and Famicom emulator written in Go Dependencies go get -u github.com/go-gl/gl go get -u github.com/go-gl/gl

This project is designed to be an open source implementation for streaming desktop games using WebRTC
This project is designed to be an open source implementation for streaming desktop games using WebRTC

The aim of this project is develop a WebRTC screenshare designed for streaming video games and accepting remote inputs. There will be ansible instruct

An open-source project for managing OpenStack resources and OpenStack infrastructure in a Kubernetes cluster

kupenStack Kubernetes-Native OpenStack A Sandbox Project. Have you used OpenStack before? If so, then for you KupenStack is magic ✨ that lets you use

SigNoz helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc. 🔥 🖥.   👉  Open source Application Performance Monitoring (APM) & Observability tool
SigNoz helps developers monitor their applications & troubleshoot problems, an open-source alternative to DataDog, NewRelic, etc. 🔥 🖥. 👉 Open source Application Performance Monitoring (APM) & Observability tool

Monitor your applications and troubleshoot problems in your deployed applications, an open-source alternative to DataDog, New Relic, etc. Documentatio

An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers
An open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developersAn open-source, distributed, cloud-native CD (Continuous Delivery) product designed for developers

Developer-oriented Continuous Delivery Product ⁣ English | 简体中文 Table of Contents Zadig Table of Contents What is Zadig Quick start How to use? How to

💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps.
💨 A real time messaging system to build a scalable in-app notifications, multiplayer games, chat apps in web and mobile apps.

Beaver A Real Time Messaging Server. Beaver is a real-time messaging server. With beaver you can easily build scalable in-app notifications, realtime

This is an open source project for commonly used functions for the Go programming language.

Common Functions This is an open source project for commonly used functions for the Go programming language. This package need = go 1.3 Code Conventi

Hybridnet is an open source container networking solution, integrated with Kubernetes and used officially by following well-known PaaS platforms

Hybridnet What is Hybridnet? Hybridnet is an open source container networking solution, integrated with Kubernetes and used officially by following we

KintoHub is an open source build and deployment platform designed with a developer-friendly interface for Kubernetes.
KintoHub is an open source build and deployment platform designed with a developer-friendly interface for Kubernetes.

What is Kintohub? KintoHub is an open source build and deployment platform designed with a developer-friendly interface for Kubernetes. Build your cod

An open source programming language that makes it easy to build simple
An open source programming language that makes it easy to build simple

The Go Programming Language Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. Gopher ima

The open source, end-to-end computer vision platform. Label, build, train, tune, deploy and automate in a unified platform that runs on any cloud and on-premises.
The open source, end-to-end computer vision platform. Label, build, train, tune, deploy and automate in a unified platform that runs on any cloud and on-premises.

End-to-end computer vision platform Label, build, train, tune, deploy and automate in a unified platform that runs on any cloud and on-premises. onepa

Comments
  • Security Policy violation Binary Artifacts

    Security Policy violation Binary Artifacts

    This issue was automatically created by Allstar.

    Security Policy Violation Project is out of compliance with Binary Artifacts policy: binaries present in source code

    Rule Description Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

    Remediation Steps To remediate, remove the generated executable artifacts from the repository.

    Artifacts Found

    • build/cicd/cirunner/windows/cirunner.exe
    • build/sge_sync/bin/sge-sync.exe
    • environment/data/StackdriverMonitoring-GCM-46.exe
    • environment/data/UE4PrereqSetup_x64.exe
    • environment/data/vc_redist.x64.exe
    • environment/data/vs_buildtools.exe
    • tools/ebert/p4_linux/p4
    • tools/ebert/p4_linux/p4broker
    • tools/ebert/p4_linux/p4d
    • tools/ebert/p4_linux/p4p

    Additional Information This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


    Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

    This issue will auto resolve when the policy is in compliance.

    Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

    allstar 
    opened by allstar-app[bot] 95
Owner
Google
Google ❤️ Open Source
Google
This project is designed to be an open source implementation for streaming desktop games using WebRTC

The aim of this project is develop a WebRTC screenshare designed for streaming video games and accepting remote inputs. There will be ansible instruct

Akilan Selvacoumar 20 Oct 6, 2022
Dedicated Game Server Hosting and Scaling for Multiplayer Games on Kubernetes

Agones is a library for hosting, running and scaling dedicated game servers on Kubernetes. Agones, is derived from the Greek word agōn which roughly t

GoogleForGames 5k Jan 6, 2023
Tetra3D is a 3D software renderer written in Go and Ebiten and made for games.

Tetra3D Tetra3D Docs Support If you want to support development, feel free to check out my itch.io / Steam / Patreon. I also have a Discord server her

SolarLune 287 Dec 20, 2022
Awesome 2D Maze-based games to play with kids in family and with friends on rich console UI. developed into Go.

gomazes Have fun time with kids and family and friends at playing awesome 2D maze-based games while feeling like a programmer on the computer console/

Jerome Amon 1 Dec 23, 2021
Tetris in Go, as a test in using Go for small games

Tetris in Go This is an attempt at implementing Tetris in Go in a way which has

Vlad-Ștefan Harbuz 1 May 8, 2022
Using finite projective planes to make card (maybe video) games

pairwise What it is Using finite projective plane to generate card (maybe video) games. Running Run with go run . Right now uses Go 1.17 but 1.18 just

null 0 Jan 24, 2022
Tcell-game-template - A small template repository for simple tcell based games

tcell game template This is a template repository used for making small terminal

Marcel Schramm 0 Jan 22, 2022
Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Engo 1.6k Dec 26, 2022
An open source re-implementation of Diablo 2

OpenDiablo2 Join us on Discord! Development Live stream Support us on Patreon We are also working on a toolset: https://github.com/OpenDiablo2/HellSpa

OpenDiablo2 10.4k Jan 8, 2023
An open-source re-implementation of Pokémon Red

This project is open source re-implementation of Pokémon Red.

Akatsuki 213 Dec 6, 2022