fix: auto-bootstrap root.json and create bin dir on first run#2709
fix: auto-bootstrap root.json and create bin dir on first run#2709yahonda wants to merge 5 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2709 +/- ##
==========================================
- Coverage 42.32% 42.31% -0.01%
==========================================
Files 424 424
Lines 47146 47155 +9
==========================================
Hits 19951 19951
- Misses 24496 24504 +8
- Partials 2699 2700 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
7a31234 to
22ab2e7
Compare
86ccffc to
02ea91f
Compare
pingcap#2496 added a getenforce-based SELinux status probe in addition to the config-file check. On hosts without the SELinux userspace tools (most Debian/Ubuntu systems, including the integration-test containers), getenforce is missing, so CheckSELinuxStatus failed. With --apply that failed check triggers the SELinux fix, which runs sed -i 's/.../' /etc/selinux/config && setenforce 0 but /etc/selinux/config does not exist on those hosts, so the command errors with 'sed: can't read /etc/selinux/config: No such file or directory' and the whole check/apply run aborts. This breaks the cluster and dm integration tests on master. Treat a getenforce execution error as 'SELinux disabled' (the host has no SELinux), matching the lenient pre-pingcap#2496 behavior, instead of a failure. Enforcing still fails and Permissive still warns. The configuration is still validated independently by CheckSELinuxConf. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pingcap#2498 added a persistent THP disable via grubby --update-kernel=ALL --args="transparent_hugepage=never" to the THP check auto-fix. grubby is a RHEL-family tool and is not present on Debian/Ubuntu (including the integration-test containers), so with --apply the fix aborts with 'grubby: command not found' (exit 127) and the whole check/apply run fails. Guard the grubby invocation with 'command -v grubby' so the persistent kernel argument is still set where grubby exists, but is skipped on hosts without it. The runtime THP setting (echo never > .../enabled) still applies everywhere. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
When tiup is installed via mise (https://mise.jdx.dev, a polyglot tool version manager similar to asdf) with: mise install github:pingcap/tiup mise use -g github:pingcap/tiup the install.sh script is not executed, which means: 1. ~/.tiup/bin/ directory is not created 2. root.json is not downloaded from the mirror This leaves the installation incomplete and requires the user to manually run 'tiup mirror set' before any tiup command works. This patch fixes both issues: - ResetMirror now ensures the bin directory exists before writing root.json - InitEnv automatically bootstraps root.json from the default mirror if it's missing, so no manual 'tiup mirror set' is needed In the future, we would like to register tiup in the mise registry so that users can simply run: mise install tiup mise use tiup This fix is a prerequisite for that, as it removes the need for any post-install initialization steps.
…mment After aliasing the pingcap/errors import to perrs (to free the name for the stdlib errors used by errors.Is), the package-level ErrInstallFirst sentinel silently switched to stdlib errors.New. Use perrs.New to preserve the prior behavior. Also reword the bootstrap comment: a present-but-corrupt root.json never yields ErrLoadManifest, so the os.Stat guard actually covers the exists-but-unreadable case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
02ea91f to
c9a6c2b
Compare
What problem does this PR solve?
When tiup is installed via mise (https://mise.jdx.dev, a polyglot tool version manager similar to asdf) with:
the install.sh script is not executed, which means:
This leaves the installation incomplete and requires the user to manually run 'tiup mirror set' before any tiup command works.
What is changed and how it works?
This PR fixes both issues:
In the future, we would like to register tiup in the mise registry so that users can simply run:
This fix is a prerequisite for that, as it removes the need for any post-install initialization steps.
Check List
Tests
Code changes
Side effects
Related changes