Repository navigation
Self-hosted and configurable runners - #31
Open
Interlap01 wants to merge 8 commits into
Open
Interlap01 wants to merge 8 commits into
Interlap01 wants to merge 8 commits into
Conversation
builder.json takes "runner" as a string or an array of labels at the top level and in a profile. The resolved runner travels in the profile dispatch input, which is now also sent when only a runner is configured. Codemagic instance_type and Bitrise machine_type_id/stack join the provider config.
ios-build.yml takes runs-on from the profile input's runner, else the default init renders; tag builds always use the rendered default. ios-share.yml renders the top-level runner. Setup Xcode runs only on GitHub-hosted runners (a self-hosted one keeps its selected Xcode and gets a check), brew installs only missing tools, earlier outputs are cleared, and Cleanup signing restores the keychain search list and removes every provisioning profile the job installed.
init --provider codemagic|bitrise takes --runner (instance_type or machine_type_id) and, for Bitrise, --stack. Unknown machine types are kept with a warning; values that are not plain names are refused before anything is written.
init --runner takes one label or a comma list, stores it as the top-level runner in builder.json (left out, the saved one is kept), and renders it into ios-build.yml and ios-share.yml. A label that is neither macos-* nor self-hosted gets a warning. pkg exposes the renderers.
The GitHub runner the dispatch resolves to, or the Codemagic instance type, or the Bitrise machine type and stack.
The machine fields push CIConfig past gocritic's hugeParam limit, so NewCodemagic, NewBitrise (internal and pkg), ProviderFiles and WriteProviderFiles take *config.CIConfig.
A Windows checkout with core.autocrlf embeds the templates with CRLF endings, so the line matches that included the LF found nothing. Match the runs-on lines without their ending, and keep a \r on the provider machine lines (and the inserted Bitrise stack) when the template has one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
builder.jsontakesrunneras a label or label list ("macos-15",["self-hosted", "macOS", "ARM64"]), at the top level and per profile.builder init --runnersets it (one label or a comma list).ios-build.ymlnow hasruns-on: ${{ fromJSON(inputs.profile || '{}').runner || <default> }}. The CLI sends the profile's runner (else the top-level one) inside the existingprofileinput, so no new dispatch input is needed. When only a runner is configured, the input goes with an empty name, which the workflow treats as no profile.initrenders the top-level runner as the default. Tag-triggered builds andios-share.ymlhave no profile input, so they use the rendered runner.instance_typeand Bitrisemachine_type_id/stackcome fromcodemagic.instance_type,bitrise.machine_type_idandbitrise.stack, set byinit --provider ... --runner/--stack. An unknown machine type is kept and prints a warning. A value that is not a plain name is refused.setup-xcoderuns only on GitHub-hosted runners. A self-hosted runner gets aCheck Xcodestep instead.brew installruns only when the tool is missing (XcodeGen, CocoaPods).Cleanup signingrestores the search list, deletes the keychain and removes every provisioning profile the job installed. It uses fixed$RUNNER_TEMPpaths, so it also works when signing failed partway.ios buildbanner prints the runner.Why
Every template hardcoded its machine (
macos-latest,mac_mini_m2,g2.mac.medium). The GitHub template also assumed a fresh VM: it replaced the user keychain search list, left provisioning profiles behind, and switched Xcode with sudo.How tested
go test -race ./...andgo vet ./...pass;gofmt -l .reports nothing.golangci-lintcould not run locally: the installed binary was built with Go 1.25 and panics on the Go 1.26 standard library.--runnerparsing and validationsetup-xcodegating and thebrewguardCleanup signingstep, run against a fakesecurity(search list restored, keychain deleted, only the job's profiles removed)inputsis an allowed context inruns-on. Nothing was run against real repositories or CI services.Left out
ios share: they have no profile input, so they use the runnerinitrendered.runs-on: {group: ..., labels: ...}).runner.sh(Codemagic/Bitrise) was not changed: those services run on fresh VMs.