graalvm / setup-graalvm

GitHub Action for setting up GraalVM distributions.
https://www.graalvm.org
Universal Permissive License v1.0
195 stars 28 forks source link

fail to invoke `getLatestRelease` in github enterprise #26

Closed 10000-ki closed 1 year ago

10000-ki commented 1 year ago

https://github.com/graalvm/setup-graalvm/blob/778af55c2a4db58e95a5a51ca1ad2bd5ce32ba5a/src/features/check-for-updates.ts#L16

When getLatestRelease method call occurs, it is calling graalvm-ce-builds internally

const baseUrl = process.env['GITHUB_API_URL'] || 'https://api.github.com'

but process.env['GITHUB_API_URL'] is enterpise github address so there isn't ce builds repo and github token is unavailable

now i use check-for-update option false

- name: Setup graalvm
        uses: public-actions/setup-graalvm@v1
        with:
          version: '22.3.0'
          java-version: '17'
          components: 'native-image'
          check-for-updates: false

Is there a reason why the github token value is necessary?

If you don't need a token, I think I can fix it easily

fniephaus commented 1 year ago

Thanks for raising this! I'm afraid we don't have access to a GitHub Enterprise instance that we can use for testing, but if you can help us make that work, that'd be great.

but process.env['GITHUB_API_URL'] is enterpise github address

Maybe we should be using const baseUrl = 'https://api.github.com'? Or don't GitHub Enterprise instances always have access to the internet? Maybe we should just disable check-for-update when running on GitHub Enterprise?

10000-ki commented 1 year ago

Or don't GitHub Enterprise instances always have access to the internet?

Action in Github Enterprise can not access gralvm-ce-builds repo via api because api.github.com token is unavailable

maybe base url in github enterprise is https://oss.${company-domain}/api/v3/

so

Maybe we should just disable check-for-update when running on GitHub Enterprise?

I think the solution you said it would be easiest now

like this

if (enableCheckForUpdates && isNotGithubEnterprise) {
    await checkForUpdates(graalvmVersion, javaVersion)
}

if you don't mind i test above code in our company(naver) enterpise github and push pull request

But, it would be nice to get the version information from somewhere other than gralvm-ce-builds repo and manage it

fniephaus commented 1 year ago

because api.github.com token is unavailable

The token is optional and helps prevent API rate limitations. So technically, it should work without the token if internet access is available.

But, it would be nice to get the version information from somewhere other than

Do you mean from somewhere else on the internet or from your GitHub Enterprise instance? Why?

10000-ki commented 1 year ago

The token is optional and helps prevent API rate limitations. So technically, it should work without the token if internet access is available.

oh i see..

If the version check logic is important, fork gralvm-ce-builds repo in our enterpise github maybe it will work

Do you mean from somewhere else on the internet or from your GitHub Enterprise instance? Why?

I thought it would be more convenient if I could manage it without API calls

fniephaus commented 1 year ago

Please try again and let us know if it's working for you now. Thanks!