Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLab Runner Support #4

Merged
merged 10 commits into from
Mar 7, 2023
Merged

Conversation

ast3150
Copy link
Contributor

@ast3150 ast3150 commented Feb 7, 2023

Adds support for GitLab Runner provisioning on hosted GitLab instances

  • Adds a gitlab provisioner option
  • Adds a GitLabRunnerProvisioner and related types

The GitLab Runner Provisioner will automatically register a runner on a given self-hosted GitLab instance when the VM is started, and de-register the runner when the VM is shutdown.

Usage

  1. Set the provisioner to gitlab and provide the relevant configurations:
provisioner:
  type: gitlab
  config:
     name: "my-runner"
     url: "https://gitlab.yourcompany.net/"
     registrationToken: "your-runner-registration-token"
     tagList: "some-tags,comma-separated"
  1. Provide the gitlab-runner-darwin-arm64 binary in the VM bundle "Resources" folder, as downloaded from GitLab Releases
  2. Set up the GitLab Runner binary in the start.command launch item. Example:
resources="/Volumes/My Shared Files/Resources/"

# Set up GitLab Runner
runner_exec_file="$resources/gitlab-runner-darwin-arm64"
token_file="$resources/RUNNER_TOKEN"
endpoint_file="$resources/RUNNER_ENDPOINT_URL"

sudo mkdir -p /usr/local/bin
sudo mv "$runner_exec_file" /usr/local/bin/gitlab-runner
sudo chmod +x /usr/local/bin/gitlab-runner

# Bypass Apple security measures: Can't be opened because Apple cannot check it for malicious software
sudo xattr -d com.apple.quarantine /usr/local/bin/gitlab-runner

# Run the Runner
token=$(cat "$token_file")
endpoint=$(cat "$endpoint_file")

/usr/local/bin/gitlab-runner run-single -u $endpoint -t $token --executor shell --env "FF_RESOLVE_FULL_TLS_CHAIN=1" --max-builds 1

# Shut down the VM after build is completed
sudo shutdown -r now

@ast3150 ast3150 marked this pull request as ready for review February 7, 2023 22:43
Copy link
Member

@Marcocanc Marcocanc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! 🚀
Could you please also do the following:

  • Add the script to the VM Resources folder
  • Mention The GitLab Provisioner in the Readme

Cilicon/Config/GitLabProvisionerConfig.swift Outdated Show resolved Hide resolved
Cilicon/Config/GitLabProvisionerConfig.swift Outdated Show resolved Hide resolved
Cilicon/Config/ProvisionerConfig.swift Outdated Show resolved Hide resolved
Cilicon/Provisioner/GitLab Runner/GitLabService.swift Outdated Show resolved Hide resolved
Cilicon/Provisioner/GitLab Runner/GitLabService.swift Outdated Show resolved Hide resolved
@Marcocanc
Copy link
Member

We currently don't have automated tests for Cilicon. I will test that the rest still functions as expected soon and then merge + create a new release.

@Marcocanc Marcocanc merged commit 35b80cc into traderepublic:main Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants