tiup icon indicating copy to clipboard operation
tiup copied to clipboard

Enhancement: TIUP_MIRRORS should be temporary runtime effected

Open cyliu0 opened this issue 3 years ago • 5 comments

Feature Request

Is your feature request related to a problem? Please describe:

We can set mirror via the tiup mirror set and environment variable TIUP_MIRRORS. But the environment variable TIUP_MIRRORS also will be a permanent impact on tiup. This is not a typical way to use environment variables. When I use an environment variable, I'd assume that this is a temporary runtime setup.

We must use tiup mirror set to restore the location after we use TIUP_MIRRORS. And if I forgot to restore the mirror location, I cannot update the manifest following the official mirror anymore. This could be a little bit tricky for users. And it might cost us some OnCall work as well.

Describe the feature you'd like:

I'd like to use the TIUP_MIRRORS with runtime effected. While TIUP_MIRRORS is empty, tiup should use the default location. For different mirror locations, it should be isolated from each other. With this feature, tiup will be much easier to use and test. And there will be no such confusion like above any more.

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

cyliu0 avatar Aug 04 '20 04:08 cyliu0

@lonng PTAL

cyliu0 avatar Aug 04 '20 04:08 cyliu0

@cyliu0 Thanks for this suggestion. It's a good idea to distinguish the environment variable and tiup mirror set subcommand. I think we can change the behavior according to your suggestion.

lonng avatar Aug 04 '20 07:08 lonng

@lonng I think we should deprecate TIUP_MIRRORS after we introduced tiup mirror set. It's just for compatibility. Next step we should remove this env instead of change it's behavior.

lucklove avatar Oct 19 '20 07:10 lucklove

@lucklove It's better to keep it in 1.x and remove it at 2.x.

lonng avatar Oct 19 '20 13:10 lonng

I think keeping TIUP_MIRRORS would be good for this:

tiup mirror clone /tmp/mirror --full
tiup mirror set /tmp/mirror
tiup install ...
TIUP_MIRROR="https://tiup-mirrors.pingcap.com/" tiup mirror clone /tmp/mirror --full

Here TIUP_MIRROR should temporarily override the setting. So installs etc use the local mirror while tiup mirror clone can clone from the remote mirror. Another option would be to add something like --from="https://tiup-mirrors.pingcap.com/" to tiup mirror clone. Cloning multiple times is needed to update a cloned repository after new versions are released etc.

Cloning might be needed due to bandwidth restrictions, (partly) offline operation, etc.

dveeden avatar Jan 04 '22 13:01 dveeden