Skip to content

Commit 5d17c51

Browse files
committed
Add options to disable runner updates
1 parent e6bcb76 commit 5d17c51

File tree

8 files changed

+29
-1
lines changed

8 files changed

+29
-1
lines changed

Packages/Settings/Sources/SettingsData/AppStorageSettingsStore.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public final class AppStorageSettingsStore: SettingsStore {
1111
static let numberOfVirtualMachines = "numberOfVirtualMachines"
1212
static let startVirtualMachinesOnLaunch = "startVirtualMachinesOnLaunch"
1313
static let gitHubPrivateKeyName = "gitHubPrivateKeyName"
14+
static let gitHubRunnerDisableUpdates = "gitHubRunnerDisableUpdates"
1415
static let gitHubRunnerLabels = "gitHubRunnerLabels"
1516
static let gitHubRunnerGroup = "gitHubRunnerGroup"
1617
static let githubRunnerScope = "githubRunnerScope"
@@ -91,6 +92,17 @@ public final class AppStorageSettingsStore: SettingsStore {
9192
}
9293
}
9394
}
95+
public var gitHubRunnerDisableUpdates: Bool {
96+
get {
97+
access(keyPath: \.gitHubRunnerDisableUpdates)
98+
return userDefaults.bool(forKey: AppStorageKey.gitHubRunnerDisableUpdates)
99+
}
100+
set {
101+
withMutation(keyPath: \.gitHubRunnerDisableUpdates) {
102+
userDefaults.setValue(newValue, forKey: AppStorageKey.gitHubRunnerDisableUpdates)
103+
}
104+
}
105+
}
94106
public var gitHubRunnerLabels: String {
95107
get {
96108
access(keyPath: \.gitHubRunnerLabels)

Packages/Settings/Sources/SettingsDomain/SettingsStore.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ public protocol SettingsStore: AnyObject {
88
var numberOfVirtualMachines: Int { get set }
99
var startVirtualMachinesOnLaunch: Bool { get set }
1010
var gitHubPrivateKeyName: String? { get set }
11+
var gitHubRunnerDisableUpdates: Bool { get set }
1112
var gitHubRunnerLabels: String { get set }
1213
var gitHubRunnerGroup: String { get set }
1314
var githubRunnerScope: GitHubRunnerScope { get set }

Packages/Settings/Sources/SettingsUI/Internal/GitHubRunnerSettings/GitHubRunnerSettingsView.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ struct GitHubRunnerSettingsView<SettingsStoreType: SettingsStore & Observable>:
2626
)
2727
.disabled(!isSettingsEnabled)
2828
}
29+
Section {
30+
Toggle(
31+
L10n.Settings.GithubRunner.disableUpdates,
32+
isOn: $settingsStore.gitHubRunnerDisableUpdates
33+
)
34+
.disabled(!isSettingsEnabled)
35+
}
2936
}
3037
.formStyle(.grouped)
3138
}

Packages/Settings/Sources/SettingsUI/Internal/L10n.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ internal enum L10n {
8585
}
8686
}
8787
internal enum GithubRunner {
88+
/// Auto-update
89+
internal static let disableUpdates = L10n.tr("Localizable", "settings.github_runner.disableUpdates", fallback: "Disable runner auto-update")
8890
/// Group
8991
internal static let group = L10n.tr("Localizable", "settings.github_runner.group", fallback: "Group")
9092
/// Labels

Packages/Settings/Sources/SettingsUI/Internal/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"settings.github.create_app" = "Create GitHub App";
4242

4343
"settings.github_runner" = "Runner";
44+
"settings.github_runner.disableUpdates" = "Disable runner auto-update";
4445
"settings.github_runner.labels" = "Labels";
4546
"settings.github_runner.labels.prompt" = "comma,separated,list";
4647
"settings.github_runner.labels.footer" = "Comma-separated list of labels.";

Packages/VirtualMachine/Sources/VirtualMachineDomain/GitHubActionsRunner/GitHubActionsRunnerConfiguration.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import GitHubDomain
22

33
public protocol GitHubActionsRunnerConfiguration {
4+
var runnerDisableUpdates: Bool { get }
45
var runnerScope: GitHubRunnerScope { get }
56
var runnerLabels: String { get }
67
var runnerGroup: String { get }

Packages/VirtualMachine/Sources/VirtualMachineDomain/GitHubActionsRunner/GitHubActionsRunnerSSHConnectionHandler.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ cd \\$ACTIONS_RUNNER_DIRECTORY
107107
--name "\(virtualMachine.name)"\\\\
108108
--runnergroup "\(configuration.runnerGroup)"\\\\
109109
--work "_work"\\\\
110-
--token "\(runnerToken.rawValue)"
110+
--token "\(runnerToken.rawValue)"\\\\
111+
\(configuration.runnerDisableUpdates ? "--disableUpdates" : "")
111112
./run.sh
112113
EOF
113114
""")

Tartelet/Sources/SettingsGitHubActionsRunnerConfiguration.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ struct SettingsGitHubActionsRunnerConfiguration<
66
SettingsStoreType: SettingsStore
77
>: GitHubActionsRunnerConfiguration {
88
let settingsStore: SettingsStoreType
9+
var runnerDisableUpdates: Bool {
10+
settingsStore.gitHubRunnerDisableUpdates
11+
}
912
var runnerScope: GitHubRunnerScope {
1013
settingsStore.githubRunnerScope
1114
}

0 commit comments

Comments
 (0)