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

GITHUB_SERVER_URL does not preserve URI prefix #1242

Closed
Reverier-Xu opened this issue Mar 25, 2023 · 9 comments · May be fixed by #1305
Closed

GITHUB_SERVER_URL does not preserve URI prefix #1242

Reverier-Xu opened this issue Mar 25, 2023 · 9 comments · May be fixed by #1305

Comments

@Reverier-Xu
Copy link

Hi, I'm trying to deploy Gitea and setup its integrated runners which is compatible with GitHub Actions.

The git server is running under a uri prefix:

https://example.com/**service_prefix**/<USER>/<REPO>

I notice the code you implemented below:

// src/url-helper.ts
...
export function getFetchUrl(settings: IGitSourceSettings): string {
  assert.ok(
    settings.repositoryOwner,
    'settings.repositoryOwner must be defined'
  )
  assert.ok(settings.repositoryName, 'settings.repositoryName must be defined')
  const serviceUrl = getServerUrl(settings.githubServerUrl)
  const encodedOwner = encodeURIComponent(settings.repositoryOwner)
  const encodedName = encodeURIComponent(settings.repositoryName)
  if (settings.sshKey) {
    return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`
  }

  // "origin" is SCHEME://HOSTNAME[:PORT]
  return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`
}
...

it seems that you just construct repo url with serviceUrl.origin, the uri prefix has been ignored.

Is there any particular reason for doing so? If not, I'd like to be able to make a pull request to change its behavior.

@frankli0324
Copy link

frankli0324 commented Apr 10, 2023

this could be useful not only on a custom deployment of git server+runner, consider the scenario when a project requires a repo hosted on another server, and needs to check that repo side by side

@apnorton
Copy link

apnorton commented Jul 4, 2023

Can confirm that PR #1305 worked for me in resolving the issue with a gitea instance and a service prefix; now just for it to be merged...

@joshmgross
Copy link
Member

We're currently only prioritizing issues for GitHub Actions, which is the primary use case for all of our first-party actions. We don't test compatibility with third-party solutions and thus can't maintain or support any features created exclusively for those third-parties.

This action is open source so you're welcome to fork it and modify it however you wish to support these sort of scenarios.

@joshmgross joshmgross closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2023
@OdinVex
Copy link

OdinVex commented Oct 20, 2023

We're currently only prioritizing issues for GitHub Actions, which is the primary use case for all of our first-party actions. We don't test compatibility with third-party solutions and thus can't maintain or support any features created exclusively for those third-parties.

This action is open source so you're welcome to fork it and modify it however you wish to support these sort of scenarios.

That's a rather lame and pathetic anti-competitive and anti-consumer attitude. This is why people are developing alternatives to GitHub, Microsoft ruins everything it touches. I bet some people still remember Embrace, Extend, Extinguish.

@apnorton
Copy link

apnorton commented Oct 21, 2023

@joshmgross Is it possible to reconsider? This issue will present a problem in any GitHub Enterprise setup where there is a further path following the domain (e.g. if an on-prem installation of GitHub enterprise was hosted behind a reverse proxy at devops.companyname[.]com/github/, this first-party github action will fail); it is not an issue limited to actions for third party solutions. (As far as I can tell from the docs, it is valid to host GitHub Enterprise behind a reverse proxy.)

edit to add: Or, alternatively, do you accept pull requests? I'd be happy to put in the effort to make this work, but I'm not sure if your invitation to fork was also one to contribute vs if this is only managed by official staff.

@OdinVex
Copy link

OdinVex commented Oct 21, 2023

@joshmgross Is it possible to reconsider? This issue will present a problem in any GitHub Enterprise setup where there is a further path following the domain (e.g. if an on-prem installation of GitHub enterprise was hosted behind a reverse proxy at devops.companyname[.]com/github/, this first-party github action will fail); it is not an issue limited to actions for third party solutions. (As far as I can tell from the docs, it is valid to host GitHub Enterprise behind a reverse proxy.)

edit to add: Or, alternatively, do you accept pull requests? I'd be happy to put in the effort to make this work, but I'm not sure if your invitation to fork was also one to contribute vs if this is only managed by official staff.

Work was already done, they just don't want to play friendly with the FOSS community. It's about keeping FOSS-alternatives down. This is sort of a slant on EEE except to steer people to GitHub and away from FOSS if people can't write universally-acceptable Actions scripts, etc. Love the 'Microsoft <3 Linux' shtick. *eyeroll*

@andrewakim
Copy link

👋 Hey everyone - I'm a PM for Actions and just want to add to what @joshmgross said. We won't be able to prioritize it for now but we'll add it to our feature request backlog so that I can dig in to the GHES use cases at some point. In the interim, forking and modifying the action is probably the fastest way to get you what you need. Thanks!

@apnorton
Copy link

Sounds good; thanks for at least considering it. 🙂

@OdinVex
Copy link

OdinVex commented Oct 21, 2023

I feel like snow has been blown up our ends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants