Skip to content

Commit a24a868

Browse files
cp: --skip-check flag in integrity checks (#18453)
1 parent d848ce8 commit a24a868

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

cmd/utils/app/snapshots_cmd.go

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,11 @@ var snapshotCommand = cli.Command{
348348
log.Info("[integrity] snapshots are publishable")
349349
return nil
350350
},
351-
Description: "run slow validation of files. use --check to run single",
351+
Description: "run slow validation of files. use --check to run multiple/single",
352352
Flags: joinFlags([]cli.Flag{
353353
&utils.DataDirFlag,
354-
&cli.StringFlag{Name: "check", Usage: fmt.Sprintf("one of: %s", integrity.AllChecks)},
354+
&cli.StringFlag{Name: "check", Usage: fmt.Sprintf("comma separated list from: %s", integrity.AllChecks)},
355+
&cli.StringFlag{Name: "skip-check", Usage: fmt.Sprintf("comma separated list from: %s", integrity.AllChecks)},
355356
&cli.BoolFlag{Name: "failFast", Value: true, Usage: "to stop after 1st problem or print WARN log and continue check"},
356357
&cli.Uint64Flag{Name: "fromStep", Value: 0, Usage: "skip files before given step"},
357358
}),
@@ -905,6 +906,26 @@ func doIntegrity(cliCtx *cli.Context) error {
905906
requestedChecks = integrity.AllChecks
906907
}
907908

909+
skipChecks := cliCtx.String("skip-check")
910+
if len(skipChecks) > 0 {
911+
var finalChecks []integrity.Check
912+
for skipCheck := range strings.SplitSeq(skipChecks, ",") {
913+
found := false
914+
for _, chk := range requestedChecks {
915+
if chk == integrity.Check(skipCheck) {
916+
found = true
917+
logger.Info("[integrity] skipping check", "check", chk)
918+
break
919+
}
920+
}
921+
if !found {
922+
finalChecks = append(finalChecks, integrity.Check(skipCheck))
923+
}
924+
}
925+
926+
requestedChecks = finalChecks
927+
}
928+
908929
failFast := cliCtx.Bool("failFast")
909930
fromStep := cliCtx.Uint64("fromStep")
910931
dirs := datadir.New(cliCtx.String(utils.DataDirFlag.Name))

0 commit comments

Comments
 (0)