-
Notifications
You must be signed in to change notification settings - Fork 22
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
Enterprise hosting support #53
Conversation
This PR is very much a WIP, there are a bunch of things to do before it is ready (code cleanup, duplication, etc.) but we need to verify that it is working before all and at the moment I don't have any ability to do it. Let's hope the community can share some feedback |
@mattia Thanks a lot for opening this PR! I think it would be great to have this functionality in Tartelet. I'll make sure to review it once I have the time 😊 |
throw VirtualMachineResourcesServiceEphemeralError.invalidRunnerURL | ||
} | ||
// SEE https://docs.github.com/en/[email protected]/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-registration-token-for-an-enterprise | ||
return baseURL.appending(path: enterpriseName, directoryHint: .notDirectory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be checked, from my understating of the API the base URL should be set on your instance URL (and that's what I have done in code), but in the example link they hardcode github.com
. If anyone can confirm/update me on this, please let me know
Any update? |
Hi @hoon-prestolabs! Unfortunately I don't have any news regarding this. The basic functionality is implemented and should work fine but I'm leaving the PR in draft because I don't want to propose this change without a feedback from users with this configuration. |
3fd34eb
to
567b8a6
Compare
(rebased the branch on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again, thank you for opening this PR and thank you for your patience. I apologize for the delay in responding.
I have added a few comments to the code changes. Some of the comments include required changes, such as ensuring texts are localized, and others include suggestions for improvements.
My main concern with merging these changes right now is that I am unable to test them myself, as I do not have access to an enterprise GitHub setup. I am also concerned about whether the new Version setting allows users to select an invalid combination of settings.
For example, is it valid to select the "github self hosted" and "organization" settings as shown in the screenshot below?
And is it valid to select the "github.com" and "enterprise" settings as shown below?
It is crucial that users cannot select an invalid combination of settings. However, since I have limited knowledge of GitHub's enterprise offerings, I am uncertain if this is achievable.
I am happy to continue with this PR if someone can verify that all combinations of settings are valid and that Tartelet exhibits the expected behavior.
@@ -12,6 +12,8 @@ struct GitHubPrivateKeyPicker: View { | |||
L10n.Settings.Github.PrivateKey.Scopes.organization | |||
case .repo: | |||
L10n.Settings.Github.PrivateKey.Scopes.repository | |||
case .enterpriseServer: | |||
"Check permissions: `manage_runners:enterprise`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text needs to be localized and formatted similar to the other texts listing required permissions.
|
||
if viewModel.version == .enterprise { | ||
TextField( | ||
"Self hosted URL", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text needs to be localized and accessed through the L10n constant.
TextField( | ||
"Self hosted URL", | ||
text: $viewModel.selfHostedRaw, | ||
prompt: Text("Github Service raw value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text needs to be localized and accessed through the L10n constant.
@@ -41,6 +56,13 @@ struct GitHubSettingsView: View { | |||
prompt: Text(L10n.Settings.Github.RepositoryName.prompt) | |||
) | |||
.disabled(!viewModel.isSettingsEnabled) | |||
case .enterpriseServer: | |||
TextField( | |||
"Enterprise name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text needs to be localized and accessed through the L10n constant.
@@ -77,6 +99,19 @@ private extension GitHubRunnerScope { | |||
L10n.Settings.RunnerScope.organization | |||
case .repo: | |||
L10n.Settings.RunnerScope.repository | |||
case .enterpriseServer: | |||
"Enterprise" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text needs to be localized and accessed through the L10n constant.
case dotCom | ||
case enterprise(URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These enum cases don't seem to be used. Can we remove them and simplify this enum?
case .dotCom: | ||
return "github.com" | ||
case .enterprise: | ||
return "github self hosted" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unfamiliar with enterprise GitHub setups and self-hosting so please correct me if I'm wrong but the enterprise
enum case seems to refer to GitHub Enterprise Server. Would it make sense to rename the case and the title to be more explicit about this and avoid confusion with the enterprise runner scope?
let runnerScope = tuple.0 | ||
let organizationName = tuple.1 | ||
let ownerName = tuple.2 | ||
let repositoryName = tuple.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a good opportunity to use tuple destructuring.
let runnerScope = tuple.0 | |
let organizationName = tuple.1 | |
let ownerName = tuple.2 | |
let repositoryName = tuple.3 | |
let (runnerScope, organizationName, ownerName, repositoryName) = tuple |
@@ -14,6 +14,21 @@ struct GitHubSettingsView: View { | |||
var body: some View { | |||
Form { | |||
Section { | |||
Picker("Version", selection: $viewModel.version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text needs to be localized and accessed through the L10n constant.
ForEach(GitHubServiceVersion.Kind.allCases, id: \.self) { scope in | ||
Text(scope.title) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to turn this picker into a segmented control to align with the Runner Scope setting?
} | |
} | |
.pickerStyle(.segmented) |
Hm i tried out the pr branch and at first it seemed to work well however when starting against a github enterprise server i got following error which i could not trace town yet:
|
Hi! This branch was a crude attempt, given that I didn't have (and still don't have) access to a GitHub Enterprise server to test against. Given that the community didn't show interested in this feature and that the main branch has made progress I'm not inclined to try to rebase and fix all merge conflicts. I will wait a bit for feedback but unless a lot of people chime in and provide support for this I will close PR |
Thanks for the hint indeed it seemed i was missing the protocol and in addition the api path so usually: |
Add the ability to specify an GitHub Enterprise Server URL so that users can use custom instances of self-hosted GitHub. The runner type
enterprise
is added so enterprises hosted on GitHub Cloud can add runners to the whole enterpriseFixes #27