Proposed: Macos cicd setup.

Metadata

  • Status: Proposed
  • Deciders: V-Sekai Core Team
  • Tags: Documentation, Automation, GoCD, Continuous Integration

The Backdrop

V-Sekai, a community-driven project aimed at developing social VR functionality for the Godot Engine, is experiencing growing pains due to increased contributions and complexity. There’s an apparent need to streamline development processes and ensure reliable automation in build and deployment workflows.

The Challenge

The current manual setup of development environments, especially continuous integration (CI) agents, is time-consuming and error-prone. The process lacks documentation, which creates barriers for new contributors and limits the scalability of the existing CI infrastructure.

The Strategy

To address these challenges, we propose to document the process thoroughly and automate the setup of GoCD agents, particularly for macOS environments, to facilitate smoother onboarding and reduce setup discrepancies.

GoCD Agent Setup and Automatic Startup on Boot for macOS

Here’s a step-by-step guide to setting up a GoCD agent service and configuring it to automatically start up on boot on a Mac.

Initial System Boot and Account Setup

  1. Boot your freshly reset or newly bought Mac.
  2. Proceed with the initial setup, creating a user account as prompted by the macOS setup wizard.

Preparing GoCD Agent

cd go-agent-20.5.0
sudo xattr -d -r com.apple.quarantine .

Single Sign-On Handling

  1. Handle Single Sign-On (SSO) if necessary.

Xcode Installation

  1. Log in with your Apple ID and download Xcode from the App Store.

Installing Homebrew and Command Line Tools

  1. Install Homebrew and the command line developer tools.

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Installing GoCD Agent

  1. Install the GoCD agent via Homebrew or download from the GoCD website.

Configuring GoCD Agent

  1. Edit wrapper-properties.conf to configure your GoCD server URL and additional preferences.

Change GoCD Agent Server URL

  1. Update the server URL to https://ci.v-sekai.cloud/go.

Automating Startup

  1. Create a launch daemon for automatic startup on boot using the following commands:

    sudo tee /Library/LaunchDaemons/com.gocd.agent.plist <<EOF
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.gocd.agent</string>
        <key>ProgramArguments</key>
        <array>
            <string>/Users/fire/go-agent-23.5.0/bin/go-agent</string>
            <string>start</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
    </dict>
    </plist>
    EOF
    sudo launchctl load /Library/LaunchDaemons/com.gocd.agent.plist
    sudo launchctl list | grep com.gocd.agent
  2. Replace /Users/fire/go-agent-23.5.0 with the actual path where the binary resides.

  3. Verify that the agent starts upon boot.

Your GoCD agent should now automatically start up whenever your Mac boots up.

The Upside

Automating the setup of the GoCD agents substantially minimizes the potential for human error during configuration. It also speeds up the onboarding process for new developers and maintains consistency across multiple setups.

The Downside

The main downside is the initial investment in time and resources required to document and test the automation scripts. Additionally, there is a reliance on macOS-specific services, which could alienate potential contributors who do not have access to a Mac.

The Road Not Taken

Alternatively, we considered using different CI services, like GitHub Actions or GitLab CI, but decided against it due to GoCD’s robustness and flexibility fitting V-Sekai’s needs more closely.

The Infrequent Use Case

We recognize that not all contributors will require a local GoCD agent setup. However, for those involved in CI pipeline management or requiring a mirrored development environment, this will be invaluable.

In Core and Done by Us?

This proposal suggests that the task be managed internally by the core V-Sekai team to maintain control over critical infrastructure components.

Further Reading

  1. V-Sekai · GitHub - Official GitHub account for the V-Sekai development community.
  2. V-Sekai/v-sekai-game - GitHub repository for the V-Sekai game.

AI assistant Aria assisted with this article.