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

Cache & reuse previously downloaded SDK #15

Closed
rkeithhill opened this issue Sep 14, 2019 · 3 comments
Closed

Cache & reuse previously downloaded SDK #15

rkeithhill opened this issue Sep 14, 2019 · 3 comments
Labels
enhancement New feature or request triaged

Comments

@rkeithhill
Copy link

This is an enhancement request for install-script.ps1/.sh.

Can we get a new parameter to request that this script only download the selected SDK if it can't find a find previously downloaded SDK in the temp directory (or wherever it places the SDK archive upon download)?

I know a lot build machines these days start with a fresh image but that isn't the case for our build machines. There really is no need to re-download a several hundred MB file just to overwrite the very same file. Seems like this could also save bandwidth on Microsoft's Azure servers.

@rkeithhill rkeithhill changed the title Enh request: Update dotnet-install script to cache and use downloaded SDK Enh request: Update dotnet-install script to cache and use previously downloaded SDK Sep 14, 2019
@johnbeisner johnbeisner self-assigned this Sep 17, 2019
@johnbeisner johnbeisner removed their assignment Dec 23, 2019
@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@bekir-ozturk bekir-ozturk transferred this issue from dotnet/sdk May 19, 2020
@bekir-ozturk bekir-ozturk added the enhancement New feature or request label May 26, 2020
@donJoseLuis
Copy link
Contributor

The need tracked in this issue should be evaluated against other re-engineering requirements. Moving to the re-engineering project.

@donJoseLuis donJoseLuis changed the title Enh request: Update dotnet-install script to cache and use previously downloaded SDK Cache & reuse previously downloaded SDK May 28, 2020
@bekir-ozturk
Copy link
Contributor

Hi,

The scripts are being put into "maintenance mode". This means that the scripts and their ecosystem (i.e. website and feeds) will continue to be monitored, but no new features will be delivered. We are still committed to maintaining the scripts’ high availability and we will quickly respond to any incidents.

As part of this effort, we are closing the issues that aren't planned to be delivered. Unfortunately, this issue is one of those that didn't make the cut, and therefore will be closed.
If you think this is a must-fix issue before maintenance mode begins, please feel free to comment.

Thanks

@rubensa
Copy link

rubensa commented Nov 26, 2021

Ouch!! I was looking for this feature to be implemented so you could mount a volume in Docker containers with previously downloaded dotnet bundles :(

grendello added a commit to grendello/xamarin-android that referenced this issue May 23, 2022
Context: dotnet/install-scripts#15
Context: https://dot.net/v1/dotnet-install.sh
Context: https://dot.net/v1/dotnet-install.ps1

We've been installing dotnet versions using the Unix shell and Windows
powershell scripts, which work fine.  However, they do not cache the
downloaded archive and therefore we end up re-downloading the same
archive over and over again on CI servers as well as locally.
Additionally, if one finds themselves without internet connection,
there's no way to install the required version of dotnet.

The installation scripts don't provide a way to cache the payloads and
they appear to be in maintenance mode, so there's rather no chance to
add caching support to them.

Instead of relying on the scripts, we can do the downloading and
installation ourselves, which lets us take the first step towards fully
"offline" builds (and smaller downloads on CI servers).

With this commit, we will cache both the scripts and the payloads and we
will perform the installation ourselves.  Scripts are still used to
obtain the download URL(s) for dotnet and as a fallback should our
attempt to download dotnet archives fail.
grendello added a commit to grendello/xamarin-android that referenced this issue May 24, 2022
Context: dotnet/install-scripts#15
Context: https://dot.net/v1/dotnet-install.sh
Context: https://dot.net/v1/dotnet-install.ps1

We've been installing dotnet versions using the Unix shell and Windows
powershell scripts, which work fine.  However, they do not cache the
downloaded archive and therefore we end up re-downloading the same
archive over and over again on CI servers as well as locally.
Additionally, if one finds themselves without internet connection,
there's no way to install the required version of dotnet.

The installation scripts don't provide a way to cache the payloads and
they appear to be in maintenance mode, so there's rather no chance to
add caching support to them.

Instead of relying on the scripts, we can do the downloading and
installation ourselves, which lets us take the first step towards fully
"offline" builds (and smaller downloads on CI servers).

With this commit, we will cache both the scripts and the payloads and we
will perform the installation ourselves.  Scripts are still used to
obtain the download URL(s) for dotnet and as a fallback should our
attempt to download dotnet archives fail.
jonpryor pushed a commit to dotnet/android that referenced this issue May 25, 2022
Context: dotnet/install-scripts#15
Context: https://dot.net/v1/dotnet-install.sh
Context: https://dot.net/v1/dotnet-install.ps1

We've been installing dotnet versions using the [`dotnet-install`][0]
scripts for Unix & Windows.  However, they do not cache the
downloaded archive, and therefore we end up re-downloading the same
archive over and over again.

Additionally, if one finds themselves without an internet connection,
there's no way to easily install the required version of dotnet.

The installation scripts don't provide a way to cache the payloads
and they appear to be in maintenance mode (dotnet/install-scripts#15),
so there doesn't appear to be a chance to add caching support to them.

Fortunately, we can "ask" the scripts what they're downloading:

	% curl -o dotnet-install.sh 'https://dot.net/v1/dotnet-install.sh'
	% ./dotnet-install.sh --version 7.0.100-preview.5.22273.1 --verbose --dry-run  \
	| grep 'dotnet-install: URL'

This returns a list of URLs, which may or may not exist:

	dotnet-install: URL #0 - primary: https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.100-preview.5.22273.1/dotnet-sdk-7.0.100-preview.5.22273.1-osx-x64.tar.gz
	dotnet-install: URL #1 - legacy: https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.100-preview.5.22273.1/dotnet-dev-osx-x64.7.0.100-preview.5.22273.1.tar.gz
	dotnet-install: URL #2 - primary: https://dotnetbuilds.azureedge.net/public/Sdk/7.0.100-preview.5.22273.1/dotnet-sdk-7.0.100-preview.5.22273.1-osx-x64.tar.gz
	dotnet-install: URL #3 - legacy: https://dotnetbuilds.azureedge.net/public/Sdk/7.0.100-preview.5.22273.1/dotnet-dev-osx-x64.7.0.100-preview.5.22273.1.tar.gz

We now parse this output, extract the URLs, then download and cache
the URL contents into `$(AndroidToolchainCacheDirectory)`.

When we need to install .NET, we just extract the cached archive
into the appropriate directory.

If no `dotnet-install: URL…` messages are generated, then we run
the `dotnet-install` script as we previously did.

This process lets us take a first step towards fully "offline" builds,
along with smaller downloads on CI servers.

[0]: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
simonrozsival pushed a commit to simonrozsival/xamarin-android that referenced this issue May 31, 2022
Context: dotnet/install-scripts#15
Context: https://dot.net/v1/dotnet-install.sh
Context: https://dot.net/v1/dotnet-install.ps1

We've been installing dotnet versions using the [`dotnet-install`][0]
scripts for Unix & Windows.  However, they do not cache the
downloaded archive, and therefore we end up re-downloading the same
archive over and over again.

Additionally, if one finds themselves without an internet connection,
there's no way to easily install the required version of dotnet.

The installation scripts don't provide a way to cache the payloads
and they appear to be in maintenance mode (dotnet/install-scripts#15),
so there doesn't appear to be a chance to add caching support to them.

Fortunately, we can "ask" the scripts what they're downloading:

	% curl -o dotnet-install.sh 'https://dot.net/v1/dotnet-install.sh'
	% ./dotnet-install.sh --version 7.0.100-preview.5.22273.1 --verbose --dry-run  \
	| grep 'dotnet-install: URL'

This returns a list of URLs, which may or may not exist:

	dotnet-install: URL #0 - primary: https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.100-preview.5.22273.1/dotnet-sdk-7.0.100-preview.5.22273.1-osx-x64.tar.gz
	dotnet-install: URL #1 - legacy: https://dotnetcli.azureedge.net/dotnet/Sdk/7.0.100-preview.5.22273.1/dotnet-dev-osx-x64.7.0.100-preview.5.22273.1.tar.gz
	dotnet-install: URL #2 - primary: https://dotnetbuilds.azureedge.net/public/Sdk/7.0.100-preview.5.22273.1/dotnet-sdk-7.0.100-preview.5.22273.1-osx-x64.tar.gz
	dotnet-install: URL #3 - legacy: https://dotnetbuilds.azureedge.net/public/Sdk/7.0.100-preview.5.22273.1/dotnet-dev-osx-x64.7.0.100-preview.5.22273.1.tar.gz

We now parse this output, extract the URLs, then download and cache
the URL contents into `$(AndroidToolchainCacheDirectory)`.

When we need to install .NET, we just extract the cached archive
into the appropriate directory.

If no `dotnet-install: URL…` messages are generated, then we run
the `dotnet-install` script as we previously did.

This process lets us take a first step towards fully "offline" builds,
along with smaller downloads on CI servers.

[0]: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triaged
Projects
None yet
Development

No branches or pull requests

5 participants