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

tiup mirror init while mirror set to empty directory creates broken mirror #1305

Open
kolbe opened this issue Apr 14, 2021 · 1 comment
Open
Labels
type/bug Categorizes issue as related to a bug.

Comments

@kolbe
Copy link
Contributor

kolbe commented Apr 14, 2021

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

If the mirror is set to an empty directory, and tiup mirror init is executed, a mirror is created with an invalid definition that cannot be used.

  1. What did you expect to see?

If the mirror is set to an empty directory, tiup mirror init should probably fail with an error.

  1. What did you see instead?
$ unset TIUP_HOME TIUP_MIRRORS
rm -rf tiup-mirror tiup-home
mkdir -p tiup-home/bin
curl -sSL https://tiup-mirrors.pingcap.com/root.json > tiup-home/bin/root.json
export TIUP_HOME=$PWD/tiup-home
$ /Users/kolbe/Devel/go/bin/tiup mirror init tiup-mirror
/Users/kolbe/Devel/go/bin/tiup mirror genkey
/Users/kolbe/Devel/go/bin/tiup mirror grant kolbe
Private key has been writeen to /Users/kolbe/tiup-home/keys/private.json
The --name is not specified, using kolbe as default
Error: introduce a fresher via the internet is not allowd, please set you mirror to a local one
$ export TIUP_MIRRORS=/Users/kolbe/tiup-mirror
$ /Users/kolbe/Devel/go/bin/tiup mirror grant kolbe
WARNING: both mirror config()
and TIUP_MIRRORS(/Users/kolbe/tiup-mirror) have been set.
Setting mirror to TIUP_MIRRORS(/Users/kolbe/tiup-mirror)
The --name is not specified, using kolbe as default
$ rm -r tiup-mirror
$ mkdir tiup-mirror
$ /Users/kolbe/Devel/go/bin/tiup mirror init tiup-mirror
$ /Users/kolbe/Devel/go/bin/tiup mirror publish tidb-server 5.0.0-master-nightly ~/Devel/git/pingcap/tidb/tidb-server.tgz bin/tidb-server
uploading /Users/kolbe/Devel/git/pingcap/tidb/tidb-server.tgz with 44467921 bytes, sha256: 9b34ccb9841629d114f2c3edc008a798daec9ceb3af03d7ab39b1ec7c2b2b5e1 ...
Error: read manifest from mirror(/Users/kolbe/tiup-mirror) failed: not enough signatures (0) for threshold 1 in timestamp.json

Here are the steps to resolve:

unset TIUP_MIRRORS
 tiup mirror set https://tiup-mirrors.pingcap.com
remove your existing mirror directory
 tiup mirror init
 tiup mirror set
 tiup mirror grant
tiup mirror publish
$ unset TIUP_MIRRORS
$ /Users/kolbe/Devel/go/bin/tiup mirror set https://tiup-mirrors.pingcap.com
WARN: adding root certificate via internet: https://tiup-mirrors.pingcap.com/root.json
You can revoke this by remove /Users/kolbe/tiup-home/bin/7b8e153f2e2d0928.root.json
Set mirror to https://tiup-mirrors.pingcap.com success
$ rm -r tiup-mirror/
$ /Users/kolbe/Devel/go/bin/tiup mirror init $PWD/tiup-mirror
$ /Users/kolbe/Devel/go/bin/tiup mirror set $PWD/tiup-mirror
Set mirror to /Users/kolbe/tiup-mirror success
$ /Users/kolbe/Devel/go/bin/tiup mirror grant kolbe
The --name is not specified, using kolbe as default
$ /Users/kolbe/Devel/go/bin/tiup mirror publish tidb-server 5.0.0-master-nightly ~/Devel/git/pingcap/tidb/tidb-server.tgz bin/tidb-server
uploading /Users/kolbe/Devel/git/pingcap/tidb/tidb-server.tgz with 44467921 bytes, sha256: 9b34ccb9841629d114f2c3edc008a798daec9ceb3af03d7ab39b1ec7c2b2b5e1 ...
Creating component tidb-server
  1. What version of TiUP are you using (tiup --version)?
    Built using go get github.com/pingcap/tiup.
$ /Users/kolbe/Devel/go/bin/tiup --version
1.4.1 tiup
Go Version: go1.16.3
Git Ref: Unknown
GitHash: Unknown```
@kolbe kolbe added the type/bug Categorizes issue as related to a bug. label Apr 14, 2021
@AstroProfundis
Copy link
Contributor

Could you help test if #1302 fixed the error message issue? The tiup mirror init and tiup mirror set commands no longer require an existing working mirror available in that PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Categorizes issue as related to a bug.
Projects
None yet
Development

No branches or pull requests

2 participants