Commit 435a46ae authored by Hayley Swimelar's avatar Hayley Swimelar
Browse files

feat(registry): import-command: remove single repository option

parent ba781624
Loading
Loading
Loading
Loading
+0 −9
Changes for docs-gitlab/database-import-tool.md: 0 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -51,15 +51,6 @@ be ran while the registry is in full operation, although this could impact the
performance of the registry and the import may not capture any images which
are added while the dry run is in progress.

#### Repository

The `--repository` option allow the user to pass the path to a particular
repository to be imported. This option enables the user to import a subset of
repositories via repeated calls to the import command, passing in a new
repository path each time.

Note: The `--dangling-blobs` option is ignored when this option is specified.

#### Pre Import
The `--pre-import` option will only import immutable registry data. When running
with this flag, it is not necessary to switch the registry to read-only mode.
+1 −17
Changes for registry/root.go: 1 added line, 17 removed lines.
Original line number Diff line number Diff line
@@ -55,13 +55,12 @@ func init() {
	DBCmd.AddCommand(MigrateCmd)

	DBCmd.AddCommand(ImportCmd)
	ImportCmd.Flags().StringVarP(&repoPath, "repository", "r", "", "import a specific repository (all by default)")
	ImportCmd.Flags().BoolVarP(&dryRun, "dry-run", "d", false, "do not commit changes to the database")
	ImportCmd.Flags().BoolVarP(&requireEmptyDatabase, "require-empty-database", "e", false, "abort import if the database is not empty")
	ImportCmd.Flags().BoolVarP(&rowCount, "row-count", "c", false, "count and log number of rows across relevant database tables on (pre)import completion")
	ImportCmd.Flags().BoolVarP(&preImport, "pre-import", "p", false, "import immutable repository-scoped data to speed up a following import")
	ImportCmd.Flags().BoolVarP(&preImport, "step-one", "1", false, "perform step one of a multi-step import: alias for `pre-import`")
	ImportCmd.Flags().BoolVarP(&importAllRepos, "all-repositories", "R", false, "import all repository-scoped data")
	ImportCmd.Flags().BoolVarP(&importAllRepos, "all-repositories", "r", false, "import all repository-scoped data")
	ImportCmd.Flags().BoolVarP(&importAllRepos, "step-two", "2", false, "perform step two of a multi-step import: alias for `all-repositories`")
	ImportCmd.Flags().BoolVarP(&importCommonBlobs, "common-blobs", "B", false, "import all blob metadata from common storage")
	ImportCmd.Flags().BoolVarP(&importCommonBlobs, "step-three", "3", false, "perform step three of a multi-step import: alias for `common-blobs`")
@@ -78,7 +77,6 @@ var (
	force                bool
	maxNumMigrations     *int
	removeUntagged       bool
	repoPath             string
	showVersion          bool
	skipPostDeployment   bool
	upToDateCheck        bool
@@ -445,7 +443,6 @@ var ImportCmd = &cobra.Command{
	Short: "Import filesystem metadata into the database",
	Long: "Import filesystem metadata into the database.\n" +
		"Untagged manifests are not imported.\n " +
		"Individual repositories may be imported via the --repository option.\n " +
		"This tool can not be used with the parallelwalk storage configuration enabled.",
	Run: func(cmd *cobra.Command, args []string) {
		config, err := resolveConfiguration(args)
@@ -519,18 +516,6 @@ var ImportCmd = &cobra.Command{

		p := datastore.NewImporter(db, registry, opts...)

		// Single repository commands.
		if repoPath != "" {
			switch {
			case preImport:
				err = p.PreImport(ctx, repoPath)
			case importCommonBlobs:
				err = errors.New("--common-blobs is not supported with the `--repository` flag")
			default:
				err = p.Import(ctx, repoPath)
			}
			// Full registry commands.
		} else {
		switch {
		case preImport:
			err = p.PreImportAll(ctx)
@@ -541,7 +526,6 @@ var ImportCmd = &cobra.Command{
		default:
			err = p.FullImport(ctx)
		}
		}

		if err != nil {
			fmt.Fprintf(os.Stderr, "failed to import metadata: %v", err)