Repository navigation
Add "simple" hosting style - #2285
Conversation
|
let the record show that writing powershell and bash scripts you Really don't want to run locally, while also sick, is "hard" |
|
Alright I need to tidy up the commits and add some docs but this seems to be working well now. Some testing of the fallback behaviour is merited, in particular I saw some mysterious behaviour in CI where the download would fail but in a way that the download command considered a success. Not sure if that was a transient effect of my work or a legit issue (wouldn't reproduce locally -- not that surprising with how complex that curl/wget selection stuff is). |
86d3c24 to
5818e5e
Compare
| } = mac_pkg_config?; | ||
| Some(PkgInstallerLayer { | ||
| common: CommonInstallerLayer::default(), | ||
| identifier, | ||
| install_location, | ||
| }) | ||
| if install_location.is_some() || identifier.is_some() { | ||
| Some(PkgInstallerLayer { | ||
| common: CommonInstallerLayer::default(), | ||
| identifier, | ||
| install_location, | ||
| }) | ||
| } else { | ||
| None | ||
| } |
There was a problem hiding this comment.
This is a completely drive-by fix I ended up doing while debugging some apparent bitrot in the tests (as written it would always enable the pkg installer)
| .PARAMETER ArtifactDownloadUrl | ||
| The URL of the directory where artifacts can be fetched from | ||
|
|
There was a problem hiding this comment.
This parameter was always shadowed by the subsequent code, so I removed it as useless (other env-vars do the same thing).
| $app_version = '{{ app_version }}' | ||
| if ($env:{{ env_vars.ghe_base_url_env_var }}) { | ||
| if ($env:{{ env_vars.download_url_env_var }}) { | ||
| $ArtifactDownloadUrls = @($env:{{ env_vars.download_url_env_var }}) | ||
| } elseif ($env:INSTALLER_DOWNLOAD_URL) { | ||
| $ArtifactDownloadUrls = @($env:INSTALLER_DOWNLOAD_URL) | ||
| } elseif ($env:{{ env_vars.ghe_base_url_env_var }}) { | ||
| $installer_base_url = $env:{{ env_vars.ghe_base_url_env_var }} | ||
| $ArtifactDownloadUrls = @("$installer_base_url{{ hosting.github.artifact_download_path }}") | ||
| } elseif ($env:{{ env_vars.github_base_url_env_var }}) { | ||
| $installer_base_url = $env:{{ env_vars.github_base_url_env_var }} | ||
| $ArtifactDownloadUrls = @("$installer_base_url{{ hosting.github.artifact_download_path }}") | ||
| } else { | ||
| $installer_base_url = "{{ hosting.github.artifact_base_url }}" | ||
| } | ||
| if ($env:{{ env_vars.download_url_env_var }}) { | ||
| $ArtifactDownloadUrl = $env:{{ env_vars.download_url_env_var }} | ||
| } elseif ($env:INSTALLER_DOWNLOAD_URL) { | ||
| $ArtifactDownloadUrl = $env:INSTALLER_DOWNLOAD_URL | ||
| } else { | ||
| $ArtifactDownloadUrl = "$installer_base_url{{ hosting.github.artifact_download_path }}" | ||
| $ArtifactDownloadUrls = @({% for url in base_urls -%} | ||
| "{{ url }}"{{ ", " if not loop.last else "" }} | ||
| {%- endfor %}) |
There was a problem hiding this comment.
This code concerned me for a bit, because it turns out the shell installers don't actually use base_url anymore after various features. However I was able to rearrange the conditions the preserve the same defacto behaviour for overridden env-vars, while still defaulting to the new cascading list of options.
|
Not convinced I actually fixed the pkg thing, it seems to hauntedly come and go on my machine which is... distressing. |
|
The |
mistydemeo
left a comment
There was a problem hiding this comment.
The implementation makes sense to me, but I wonder if we want to be labelling this as a "mirror". Maybe we just want to promote a static host to a first-class non-mirror hosting source, like GitHub releases? I can imagine something like this being used to host primary artifacts, or the only artifacts without GH releases.
|
Yeah I was trying to find a good term for "static file server", and mirror felt the best, but I agree it's weird when it's the primary (which is the expected/intended case). |
6344514 to
572b54a
Compare
|
Arg, sorry about introducing a merge conflict with the |
mistydemeo
left a comment
There was a problem hiding this comment.
Looks good, though I haven't had a chance to test yet.
| pub repo: String, | ||
| } | ||
|
|
||
| /// Github Hosting |
| {%- if cond is defined %} | ||
| if {{ cond }} | ||
| url "{{ inner.base_url }}/{{ frag.id }}" | ||
| {#- FIXME: implement support for fallback URLs #} |
There was a problem hiding this comment.
I'm happy to do this in a followup PR.
572b54a to
8c73625
Compare
This is an alternative to #2250 that more thoroughly applies the URL by treating it like a hosting style. This makes the config... much more gross, but ensures the proper value is propagated, and lays groundwork for a potential
mirror-upload-url(right now astral plans to do this via a custom job).It does this primarily by introducing a
simple-download-url = "https://static.mysite.com/{tag}"value. Priority between the sources can be specified by usinghosting = ["simple", "github"]vshosting = ["github", "simple"]. One can also specify to only use the mirror withhosting = ["simple"]. If no ordering is specified, both are used and the mirror is preferred.This PR intends to implement only support for this in the shell and powershell installers, so notably it punts on:
I'm still testing the shell/powershell changes.