diff --git a/README.md b/README.md index 5271d60f0..128776546 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ The project's first goal is to reach WebUI parity. ❌ Distribution -❌ GC +✅ gc Manage Garbage Collection ❌ Job Service Dashboard diff --git a/cmd/harbor/root/cmd.go b/cmd/harbor/root/cmd.go index 630c75b52..b75bf926c 100644 --- a/cmd/harbor/root/cmd.go +++ b/cmd/harbor/root/cmd.go @@ -22,6 +22,7 @@ import ( "github.com/goharbor/harbor-cli/cmd/harbor/root/configurations" "github.com/goharbor/harbor-cli/cmd/harbor/root/context" "github.com/goharbor/harbor-cli/cmd/harbor/root/cve" + "github.com/goharbor/harbor-cli/cmd/harbor/root/gc" "github.com/goharbor/harbor-cli/cmd/harbor/root/instance" "github.com/goharbor/harbor-cli/cmd/harbor/root/jobservice" "github.com/goharbor/harbor-cli/cmd/harbor/root/labels" @@ -208,6 +209,10 @@ harbor help cmd.GroupID = "system" root.AddCommand(cmd) + cmd = gc.GC() + cmd.GroupID = "system" + root.AddCommand(cmd) + // Utils cmd = versionCommand() cmd.GroupID = "utils" diff --git a/cmd/harbor/root/gc/cmd.go b/cmd/harbor/root/gc/cmd.go new file mode 100644 index 000000000..65f2ab9ab --- /dev/null +++ b/cmd/harbor/root/gc/cmd.go @@ -0,0 +1,55 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import "github.com/spf13/cobra" + +func GC() *cobra.Command { + cmd := &cobra.Command{ + Use: "gc", + Short: "Manage Garbage Collection in Harbor", + Long: `Use this command to manage registry-wide Garbage Collection (GC) in your Harbor instance. + +Garbage Collection cleans up deleted or orphaned blobs/tags in the registry to free up storage space. +This command supports listing execution history, viewing logs, showing schedule configuration, stopping running jobs, and triggering manual runs.`, + Example: ` # View Garbage Collection execution history + harbor gc history + + # Get the current Garbage Collection schedule + harbor gc schedule + + # Trigger Garbage Collection run immediately + harbor gc trigger --delete-untagged --dry-run=false + + # View execution logs for a GC run + harbor gc log 12 + + # Stop a running Garbage Collection run + harbor gc stop 12 + + # Update the automatic Garbage Collection schedule + harbor gc update-schedule daily --delete-untagged`, + } + + cmd.AddCommand( + HistoryGCOperation(), + ScheduleGCOperation(), + TriggerGCOperation(), + LogGCOperation(), + StopGCOperation(), + UpdateGCScheduleCommand(), + ) + + return cmd +} diff --git a/cmd/harbor/root/gc/gc_test.go b/cmd/harbor/root/gc/gc_test.go new file mode 100644 index 000000000..c1fd9004a --- /dev/null +++ b/cmd/harbor/root/gc/gc_test.go @@ -0,0 +1,91 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "testing" + + "github.com/goharbor/harbor-cli/pkg/testutil" +) + +func TestHistoryGCOperation_Errors(t *testing.T) { + tests := []struct { + name string + flags []string + expectError bool + }{ + { + name: "negative page size", + flags: []string{"--page-size", "-1"}, + expectError: true, + }, + { + name: "page size too large", + flags: []string{"--page-size", "101"}, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := testutil.TestCmd(t, HistoryGCOperation, tt.flags...) + + if tt.expectError && err == nil { + t.Fatalf("expected error but got nil") + } + + if !tt.expectError && err != nil { + t.Fatalf("unexpected error: %v", err) + } + }) + } +} + +func TestUpdateGCScheduleCommand_Errors(t *testing.T) { + tests := []struct { + name string + flags []string + expectError bool + }{ + { + name: "invalid schedule type", + flags: []string{"invalid-type"}, + expectError: true, + }, + { + name: "custom type without cron", + flags: []string{"custom"}, + expectError: true, + }, + { + name: "custom type with invalid cron fields", + flags: []string{"custom", "--cron", "* * * * *"}, + expectError: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := testutil.TestCmd(t, UpdateGCScheduleCommand, tt.flags...) + + if tt.expectError && err == nil { + t.Fatalf("expected error but got nil") + } + + if !tt.expectError && err != nil { + t.Fatalf("unexpected error: %v", err) + } + }) + } +} diff --git a/cmd/harbor/root/gc/history.go b/cmd/harbor/root/gc/history.go new file mode 100644 index 000000000..068486e7c --- /dev/null +++ b/cmd/harbor/root/gc/history.go @@ -0,0 +1,78 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "fmt" + + "github.com/goharbor/harbor-cli/pkg/api" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/goharbor/harbor-cli/pkg/views/gc/list" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func HistoryGCOperation() *cobra.Command { + var opts api.ListFlags + + cmd := &cobra.Command{ + Use: "history", + Short: "Get GC execution history", + Long: `Retrieve the execution history of registry-wide Garbage Collection jobs.`, + Example: ` harbor gc history --page 1 --page-size 10`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + if opts.Page < 1 { + return fmt.Errorf("page number must be greater than or equal to 1") + } + if opts.PageSize < 0 { + return fmt.Errorf("page size must be greater than or equal to 0") + } + if opts.PageSize > 100 { + return fmt.Errorf("page size should be less than or equal to 100") + } + + logrus.Debug("Fetching Garbage Collection execution history") + history, err := api.ListGCHistory(opts) + if err != nil { + return fmt.Errorf("failed to list GC history: %v", utils.ParseHarborErrorMsg(err)) + } + + if len(history) == 0 { + fmt.Println("No Garbage Collection execution history found") + return nil + } + + formatFlag := viper.GetString("output-format") + if formatFlag != "" { + err = utils.PrintFormat(history, formatFlag) + if err != nil { + return err + } + } else { + list.ListGCHistory(history) + } + return nil + }, + } + + flags := cmd.Flags() + flags.Int64VarP(&opts.Page, "page", "", 1, "Page number") + flags.Int64VarP(&opts.PageSize, "page-size", "", 10, "Size of per page") + flags.StringVarP(&opts.Q, "query", "q", "", "Query string to query resources") + flags.StringVarP(&opts.Sort, "sort", "", "", "Sort the resource list in ascending or descending order") + + return cmd +} diff --git a/cmd/harbor/root/gc/log.go b/cmd/harbor/root/gc/log.go new file mode 100644 index 000000000..a6eb012d6 --- /dev/null +++ b/cmd/harbor/root/gc/log.go @@ -0,0 +1,56 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "fmt" + "strconv" + + "github.com/goharbor/harbor-cli/pkg/api" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +func LogGCOperation() *cobra.Command { + cmd := &cobra.Command{ + Use: "log [gc-id]", + Short: "Get GC execution log", + Long: `Retrieve the execution log of a specific Garbage Collection run by its ID.`, + Example: ` harbor gc log 12`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + gcID, err := strconv.ParseInt(args[0], 10, 64) + if err != nil { + return fmt.Errorf("invalid GC execution ID: %v", args[0]) + } + + logrus.Debugf("Fetching Garbage Collection execution log for ID: %d", gcID) + logs, err := api.GetGCLog(gcID) + if err != nil { + return fmt.Errorf("failed to get GC log: %v", utils.ParseHarborErrorMsg(err)) + } + + if logs == "" { + fmt.Printf("No logs found for Garbage Collection run ID: %d\n", gcID) + return nil + } + + fmt.Println(logs) + return nil + }, + } + + return cmd +} diff --git a/cmd/harbor/root/gc/schedule.go b/cmd/harbor/root/gc/schedule.go new file mode 100644 index 000000000..b621eaa09 --- /dev/null +++ b/cmd/harbor/root/gc/schedule.go @@ -0,0 +1,55 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "fmt" + + "github.com/goharbor/harbor-cli/pkg/api" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/goharbor/harbor-cli/pkg/views/gc/view" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +func ScheduleGCOperation() *cobra.Command { + cmd := &cobra.Command{ + Use: "schedule", + Short: "Get the current GC schedule", + Long: `Retrieve the configuration and schedule parameters for automatic Garbage Collection.`, + Example: ` harbor gc schedule`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + logrus.Debug("Fetching Garbage Collection schedule") + schedule, err := api.GetGCSchedule() + if err != nil { + return fmt.Errorf("failed to get GC schedule: %v", utils.ParseHarborErrorMsg(err)) + } + + formatFlag := viper.GetString("output-format") + if formatFlag != "" { + err = utils.PrintFormat(schedule, formatFlag) + if err != nil { + return err + } + } else { + view.ViewGCSchedule(schedule) + } + return nil + }, + } + + return cmd +} diff --git a/cmd/harbor/root/gc/stop.go b/cmd/harbor/root/gc/stop.go new file mode 100644 index 000000000..9aeee7581 --- /dev/null +++ b/cmd/harbor/root/gc/stop.go @@ -0,0 +1,51 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "fmt" + "strconv" + + "github.com/goharbor/harbor-cli/pkg/api" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +func StopGCOperation() *cobra.Command { + cmd := &cobra.Command{ + Use: "stop [gc-id]", + Short: "Stop a running GC execution", + Long: `Stop a currently running Garbage Collection job by its run ID.`, + Example: ` harbor gc stop 12`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + gcID, err := strconv.ParseInt(args[0], 10, 64) + if err != nil { + return fmt.Errorf("invalid GC execution ID: %v", args[0]) + } + + logrus.Debugf("Stopping Garbage Collection run ID: %d", gcID) + err = api.StopGC(gcID) + if err != nil { + return fmt.Errorf("failed to stop GC run: %v", utils.ParseHarborErrorMsg(err)) + } + + fmt.Printf("Successfully requested stopping Garbage Collection run ID: %d\n", gcID) + return nil + }, + } + + return cmd +} diff --git a/cmd/harbor/root/gc/trigger.go b/cmd/harbor/root/gc/trigger.go new file mode 100644 index 000000000..7b3454179 --- /dev/null +++ b/cmd/harbor/root/gc/trigger.go @@ -0,0 +1,60 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "fmt" + + "github.com/goharbor/harbor-cli/pkg/api" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/goharbor/harbor-cli/pkg/views/gc/update" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +func TriggerGCOperation() *cobra.Command { + var deleteUntagged bool + var dryRun bool + var interactive bool + + cmd := &cobra.Command{ + Use: "trigger", + Short: "Trigger Garbage Collection immediately", + Long: `Start a manual Garbage Collection job immediately in Harbor registry.`, + Example: ` harbor gc trigger --delete-untagged --dry-run=false`, + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + if interactive { + logrus.Debug("Opening interactive form for triggering GC") + update.EditGCSchedule(nil, &deleteUntagged, &dryRun, false) + } + + logrus.Debugf("Triggering manual GC (delete_untagged: %t, dry_run: %t)", deleteUntagged, dryRun) + err := api.TriggerGC(deleteUntagged, dryRun) + if err != nil { + return fmt.Errorf("failed to trigger GC: %v", utils.ParseHarborErrorMsg(err)) + } + + fmt.Println("Garbage Collection triggered successfully") + return nil + }, + } + + flags := cmd.Flags() + flags.BoolVar(&deleteUntagged, "delete-untagged", false, "Delete untagged artifacts") + flags.BoolVar(&dryRun, "dry-run", false, "Simulate the GC process without deleting actual blobs") + flags.BoolVarP(&interactive, "interactive", "i", false, "Trigger Garbage Collection interactively") + + return cmd +} diff --git a/cmd/harbor/root/gc/update_schedule.go b/cmd/harbor/root/gc/update_schedule.go new file mode 100644 index 000000000..d09314c90 --- /dev/null +++ b/cmd/harbor/root/gc/update_schedule.go @@ -0,0 +1,126 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package gc + +import ( + "errors" + "fmt" + "strings" + + "github.com/goharbor/harbor-cli/pkg/api" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/goharbor/harbor-cli/pkg/views/gc/update" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" + "golang.org/x/text/cases" + "golang.org/x/text/language" +) + +var validScheduleTypes = map[string]bool{ + "None": true, + "Hourly": true, + "Daily": true, + "Weekly": true, + "Custom": true, +} + +func UpdateGCScheduleCommand() *cobra.Command { + var cron string + var deleteUntagged bool + var dryRun bool + var interactive bool + + cmd := &cobra.Command{ + Use: "update-schedule [schedule-type: none|hourly|daily|weekly|custom]", + Short: "Update automatic GC schedule", + Long: `Configure or update the automatic Garbage Collection schedule for the registry. + +Available schedule types: + - none: Disable scheduled Garbage Collection + - hourly: Run GC every hour + - daily: Run GC once per day + - weekly: Run GC once per week + - custom: Define a custom schedule using a cron expression + +For custom schedules, Harbor requires a 6-field cron expression in the format: + seconds minutes hours day-of-month month day-of-week + +Examples: + # Disable automatic Garbage Collection + harbor gc update-schedule none + + # Configure daily Garbage Collection deleting untagged artifacts + harbor gc update-schedule daily --delete-untagged + + # Configure custom schedule (e.g. daily at 3:00 AM) in dry-run mode + harbor gc update-schedule custom --cron "0 0 3 * * *" --dry-run`, + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + scheduleType := cases.Title(language.English).String(strings.ToLower(args[0])) + + if !validScheduleTypes[scheduleType] { + return fmt.Errorf("invalid schedule type: %s. Valid types are: none, hourly, daily, weekly, custom", args[0]) + } + + if interactive { + promptCron := (scheduleType == "Custom") + update.EditGCSchedule(&cron, &deleteUntagged, &dryRun, promptCron) + } + + logrus.Debugf("Updating GC schedule to type: %s", scheduleType) + + if scheduleType == "Custom" { + if cron == "" && !interactive { + return fmt.Errorf("cron expression is required for custom schedule type. Use --cron or --interactive") + } + if err := validateCron(cron); err != nil { + return err + } + } + + err := api.UpdateGCSchedule(scheduleType, cron, deleteUntagged, dryRun) + if err != nil { + return fmt.Errorf("failed to update GC schedule: %v", utils.ParseHarborErrorMsg(err)) + } + + fmt.Printf("Successfully updated Garbage Collection schedule to %s\n", scheduleType) + return nil + }, + } + + flags := cmd.Flags() + flags.StringVar(&cron, "cron", "", "Cron expression for custom schedule (include in double quotes)") + flags.BoolVar(&deleteUntagged, "delete-untagged", false, "Delete untagged artifacts") + flags.BoolVar(&dryRun, "dry-run", false, "Simulate the GC process without deleting actual blobs") + flags.BoolVarP(&interactive, "interactive", "i", false, "Update GC schedule interactively") + + return cmd +} + +func validateCron(cron string) error { + if cron == "" { + return errors.New("cron expression cannot be empty") + } + fields := strings.Fields(cron) + if len(fields) < 6 { + if len(fields) == 5 { + return fmt.Errorf("harbor requires 6-field cron format (including seconds). Try: '0 %s'", cron) + } + return fmt.Errorf("harbor requires 6-field cron format (seconds minute hour day month weekday)") + } + if len(fields) > 6 { + return fmt.Errorf("too many fields in cron expression, expected 6 but got %d", len(fields)) + } + return nil +} diff --git a/doc/cli-docs/harbor-artifact-delete.md b/doc/cli-docs/harbor-artifact-delete.md index 72bfc679b..03d35789e 100644 --- a/doc/cli-docs/harbor-artifact-delete.md +++ b/doc/cli-docs/harbor-artifact-delete.md @@ -1,6 +1,6 @@ --- title: harbor artifact delete -weight: 35 +weight: 75 --- ## harbor artifact delete diff --git a/doc/cli-docs/harbor-artifact-label-list.md b/doc/cli-docs/harbor-artifact-label-list.md index f68bdcbea..1ed5700f9 100644 --- a/doc/cli-docs/harbor-artifact-label-list.md +++ b/doc/cli-docs/harbor-artifact-label-list.md @@ -1,6 +1,6 @@ --- title: harbor artifact label list -weight: 30 +weight: 10 --- ## harbor artifact label list diff --git a/doc/cli-docs/harbor-artifact-label.md b/doc/cli-docs/harbor-artifact-label.md index 1b095bd18..ba9ed984f 100644 --- a/doc/cli-docs/harbor-artifact-label.md +++ b/doc/cli-docs/harbor-artifact-label.md @@ -1,6 +1,6 @@ --- title: harbor artifact label -weight: 70 +weight: 90 --- ## harbor artifact label diff --git a/doc/cli-docs/harbor-artifact-list.md b/doc/cli-docs/harbor-artifact-list.md index da73c9e31..ac06db7a8 100644 --- a/doc/cli-docs/harbor-artifact-list.md +++ b/doc/cli-docs/harbor-artifact-list.md @@ -1,6 +1,6 @@ --- title: harbor artifact list -weight: 20 +weight: 95 --- ## harbor artifact list diff --git a/doc/cli-docs/harbor-artifact-scan-start.md b/doc/cli-docs/harbor-artifact-scan-start.md index 316f1a744..f8136a3a3 100644 --- a/doc/cli-docs/harbor-artifact-scan-start.md +++ b/doc/cli-docs/harbor-artifact-scan-start.md @@ -1,6 +1,6 @@ --- title: harbor artifact scan start -weight: 80 +weight: 60 --- ## harbor artifact scan start diff --git a/doc/cli-docs/harbor-artifact-scan-stop.md b/doc/cli-docs/harbor-artifact-scan-stop.md index 958554274..1b45636c3 100644 --- a/doc/cli-docs/harbor-artifact-scan-stop.md +++ b/doc/cli-docs/harbor-artifact-scan-stop.md @@ -1,6 +1,6 @@ --- title: harbor artifact scan stop -weight: 10 +weight: 25 --- ## harbor artifact scan stop diff --git a/doc/cli-docs/harbor-artifact-scan.md b/doc/cli-docs/harbor-artifact-scan.md index 4a9be3c8f..9d3781c2d 100644 --- a/doc/cli-docs/harbor-artifact-scan.md +++ b/doc/cli-docs/harbor-artifact-scan.md @@ -1,6 +1,6 @@ --- title: harbor artifact scan -weight: 60 +weight: 55 --- ## harbor artifact scan diff --git a/doc/cli-docs/harbor-artifact-tags-create.md b/doc/cli-docs/harbor-artifact-tags-create.md index df28690f1..9e9598e5e 100644 --- a/doc/cli-docs/harbor-artifact-tags-create.md +++ b/doc/cli-docs/harbor-artifact-tags-create.md @@ -1,6 +1,6 @@ --- title: harbor artifact tags create -weight: 65 +weight: 95 --- ## harbor artifact tags create diff --git a/doc/cli-docs/harbor-artifact-tags-delete.md b/doc/cli-docs/harbor-artifact-tags-delete.md index 56f8d8870..3ef161af0 100644 --- a/doc/cli-docs/harbor-artifact-tags-delete.md +++ b/doc/cli-docs/harbor-artifact-tags-delete.md @@ -1,6 +1,6 @@ --- title: harbor artifact tags delete -weight: 80 +weight: 15 --- ## harbor artifact tags delete diff --git a/doc/cli-docs/harbor-artifact-tags-list.md b/doc/cli-docs/harbor-artifact-tags-list.md index 5f46989c4..9467ed743 100644 --- a/doc/cli-docs/harbor-artifact-tags-list.md +++ b/doc/cli-docs/harbor-artifact-tags-list.md @@ -1,6 +1,6 @@ --- title: harbor artifact tags list -weight: 90 +weight: 45 --- ## harbor artifact tags list diff --git a/doc/cli-docs/harbor-artifact-tags.md b/doc/cli-docs/harbor-artifact-tags.md index 8ddf78667..6feff37df 100644 --- a/doc/cli-docs/harbor-artifact-tags.md +++ b/doc/cli-docs/harbor-artifact-tags.md @@ -1,6 +1,6 @@ --- title: harbor artifact tags -weight: 85 +weight: 75 --- ## harbor artifact tags diff --git a/doc/cli-docs/harbor-artifact.md b/doc/cli-docs/harbor-artifact.md index 011cd4aa6..a2c9d169e 100644 --- a/doc/cli-docs/harbor-artifact.md +++ b/doc/cli-docs/harbor-artifact.md @@ -1,6 +1,6 @@ --- title: harbor artifact -weight: 35 +weight: 80 --- ## harbor artifact diff --git a/doc/cli-docs/harbor-config-apply.md b/doc/cli-docs/harbor-config-apply.md index 04b3f9b78..affd843c5 100644 --- a/doc/cli-docs/harbor-config-apply.md +++ b/doc/cli-docs/harbor-config-apply.md @@ -1,6 +1,6 @@ --- title: harbor config apply -weight: 85 +weight: 80 --- ## harbor config apply diff --git a/doc/cli-docs/harbor-config-view.md b/doc/cli-docs/harbor-config-view.md index ec9ac47fc..75e0ea955 100644 --- a/doc/cli-docs/harbor-config-view.md +++ b/doc/cli-docs/harbor-config-view.md @@ -1,6 +1,6 @@ --- title: harbor config view -weight: 95 +weight: 10 --- ## harbor config view diff --git a/doc/cli-docs/harbor-config.md b/doc/cli-docs/harbor-config.md index c5b07db2e..0d4c7f0e5 100644 --- a/doc/cli-docs/harbor-config.md +++ b/doc/cli-docs/harbor-config.md @@ -1,6 +1,6 @@ --- title: harbor config -weight: 80 +weight: 20 --- ## harbor config diff --git a/doc/cli-docs/harbor-context-get.md b/doc/cli-docs/harbor-context-get.md index ceb6fdc1e..64cc3700c 100644 --- a/doc/cli-docs/harbor-context-get.md +++ b/doc/cli-docs/harbor-context-get.md @@ -1,6 +1,6 @@ --- title: harbor context get -weight: 85 +weight: 40 --- ## harbor context get diff --git a/doc/cli-docs/harbor-context-list.md b/doc/cli-docs/harbor-context-list.md index da744cd30..b4f2d7a13 100644 --- a/doc/cli-docs/harbor-context-list.md +++ b/doc/cli-docs/harbor-context-list.md @@ -1,6 +1,6 @@ --- title: harbor context list -weight: 25 +weight: 55 --- ## harbor context list diff --git a/doc/cli-docs/harbor-context-switch.md b/doc/cli-docs/harbor-context-switch.md index cee8741cc..91ca92a30 100644 --- a/doc/cli-docs/harbor-context-switch.md +++ b/doc/cli-docs/harbor-context-switch.md @@ -1,6 +1,6 @@ --- title: harbor context switch -weight: 50 +weight: 80 --- ## harbor context switch diff --git a/doc/cli-docs/harbor-context-update.md b/doc/cli-docs/harbor-context-update.md index a2d34766b..69cfbce4d 100644 --- a/doc/cli-docs/harbor-context-update.md +++ b/doc/cli-docs/harbor-context-update.md @@ -1,6 +1,6 @@ --- title: harbor context update -weight: 10 +weight: 30 --- ## harbor context update diff --git a/doc/cli-docs/harbor-context.md b/doc/cli-docs/harbor-context.md index 0991da535..ef264dd77 100644 --- a/doc/cli-docs/harbor-context.md +++ b/doc/cli-docs/harbor-context.md @@ -1,6 +1,6 @@ --- title: harbor context -weight: 30 +weight: 65 --- ## harbor context diff --git a/doc/cli-docs/harbor-cve-allowlist-add.md b/doc/cli-docs/harbor-cve-allowlist-add.md index f756800f5..f8ba21510 100644 --- a/doc/cli-docs/harbor-cve-allowlist-add.md +++ b/doc/cli-docs/harbor-cve-allowlist-add.md @@ -1,6 +1,6 @@ --- title: harbor cve allowlist add -weight: 60 +weight: 25 --- ## harbor cve-allowlist add diff --git a/doc/cli-docs/harbor-cve-allowlist-list.md b/doc/cli-docs/harbor-cve-allowlist-list.md index 6cc31a21a..fc31741a1 100644 --- a/doc/cli-docs/harbor-cve-allowlist-list.md +++ b/doc/cli-docs/harbor-cve-allowlist-list.md @@ -1,6 +1,6 @@ --- title: harbor cve allowlist list -weight: 60 +weight: 55 --- ## harbor cve-allowlist list diff --git a/doc/cli-docs/harbor-cve-allowlist.md b/doc/cli-docs/harbor-cve-allowlist.md index 459778b8e..e0220c904 100644 --- a/doc/cli-docs/harbor-cve-allowlist.md +++ b/doc/cli-docs/harbor-cve-allowlist.md @@ -1,6 +1,6 @@ --- title: harbor cve allowlist -weight: 70 +weight: 90 --- ## harbor cve-allowlist diff --git a/doc/cli-docs/harbor-gc-history.md b/doc/cli-docs/harbor-gc-history.md new file mode 100644 index 000000000..74b53c5e5 --- /dev/null +++ b/doc/cli-docs/harbor-gc-history.md @@ -0,0 +1,46 @@ +--- +title: harbor gc history +weight: 60 +--- +## harbor gc history + +### Description + +##### Get GC execution history + +### Synopsis + +Retrieve the execution history of registry-wide Garbage Collection jobs. + +```sh +harbor gc history [flags] +``` + +### Examples + +```sh + harbor gc history --page 1 --page-size 10 +``` + +### Options + +```sh + -h, --help help for history + --page int Page number (default 1) + --page-size int Size of per page (default 10) + -q, --query string Query string to query resources + --sort string Sort the resource list in ascending or descending order +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor + diff --git a/doc/cli-docs/harbor-gc-log.md b/doc/cli-docs/harbor-gc-log.md new file mode 100644 index 000000000..89523b61b --- /dev/null +++ b/doc/cli-docs/harbor-gc-log.md @@ -0,0 +1,42 @@ +--- +title: harbor gc log +weight: 65 +--- +## harbor gc log + +### Description + +##### Get GC execution log + +### Synopsis + +Retrieve the execution log of a specific Garbage Collection run by its ID. + +```sh +harbor gc log [gc-id] [flags] +``` + +### Examples + +```sh + harbor gc log 12 +``` + +### Options + +```sh + -h, --help help for log +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor + diff --git a/doc/cli-docs/harbor-gc-schedule.md b/doc/cli-docs/harbor-gc-schedule.md new file mode 100644 index 000000000..bdc206231 --- /dev/null +++ b/doc/cli-docs/harbor-gc-schedule.md @@ -0,0 +1,42 @@ +--- +title: harbor gc schedule +weight: 40 +--- +## harbor gc schedule + +### Description + +##### Get the current GC schedule + +### Synopsis + +Retrieve the configuration and schedule parameters for automatic Garbage Collection. + +```sh +harbor gc schedule [flags] +``` + +### Examples + +```sh + harbor gc schedule +``` + +### Options + +```sh + -h, --help help for schedule +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor + diff --git a/doc/cli-docs/harbor-gc-stop.md b/doc/cli-docs/harbor-gc-stop.md new file mode 100644 index 000000000..579308c71 --- /dev/null +++ b/doc/cli-docs/harbor-gc-stop.md @@ -0,0 +1,42 @@ +--- +title: harbor gc stop +weight: 50 +--- +## harbor gc stop + +### Description + +##### Stop a running GC execution + +### Synopsis + +Stop a currently running Garbage Collection job by its run ID. + +```sh +harbor gc stop [gc-id] [flags] +``` + +### Examples + +```sh + harbor gc stop 12 +``` + +### Options + +```sh + -h, --help help for stop +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor + diff --git a/doc/cli-docs/harbor-gc-trigger.md b/doc/cli-docs/harbor-gc-trigger.md new file mode 100644 index 000000000..20ff3ff8b --- /dev/null +++ b/doc/cli-docs/harbor-gc-trigger.md @@ -0,0 +1,45 @@ +--- +title: harbor gc trigger +weight: 55 +--- +## harbor gc trigger + +### Description + +##### Trigger Garbage Collection immediately + +### Synopsis + +Start a manual Garbage Collection job immediately in Harbor registry. + +```sh +harbor gc trigger [flags] +``` + +### Examples + +```sh + harbor gc trigger --delete-untagged --dry-run=false +``` + +### Options + +```sh + --delete-untagged Delete untagged artifacts + --dry-run Simulate the GC process without deleting actual blobs + -h, --help help for trigger + -i, --interactive Trigger Garbage Collection interactively +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor + diff --git a/doc/cli-docs/harbor-gc-update-schedule.md b/doc/cli-docs/harbor-gc-update-schedule.md new file mode 100644 index 000000000..7f821b657 --- /dev/null +++ b/doc/cli-docs/harbor-gc-update-schedule.md @@ -0,0 +1,60 @@ +--- +title: harbor gc update schedule +weight: 50 +--- +## harbor gc update-schedule + +### Description + +##### Update automatic GC schedule + +### Synopsis + +Configure or update the automatic Garbage Collection schedule for the registry. + +Available schedule types: + - none: Disable scheduled Garbage Collection + - hourly: Run GC every hour + - daily: Run GC once per day + - weekly: Run GC once per week + - custom: Define a custom schedule using a cron expression + +For custom schedules, Harbor requires a 6-field cron expression in the format: + seconds minutes hours day-of-month month day-of-week + +Examples: + # Disable automatic Garbage Collection + harbor gc update-schedule none + + # Configure daily Garbage Collection deleting untagged artifacts + harbor gc update-schedule daily --delete-untagged + + # Configure custom schedule (e.g. daily at 3:00 AM) in dry-run mode + harbor gc update-schedule custom --cron "0 0 3 * * *" --dry-run + +```sh +harbor gc update-schedule [schedule-type: none|hourly|daily|weekly|custom] [flags] +``` + +### Options + +```sh + --cron string Cron expression for custom schedule (include in double quotes) + --delete-untagged Delete untagged artifacts + --dry-run Simulate the GC process without deleting actual blobs + -h, --help help for update-schedule + -i, --interactive Update GC schedule interactively +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor + diff --git a/doc/cli-docs/harbor-gc.md b/doc/cli-docs/harbor-gc.md new file mode 100644 index 000000000..f1c66fb7d --- /dev/null +++ b/doc/cli-docs/harbor-gc.md @@ -0,0 +1,63 @@ +--- +title: harbor gc +weight: 85 +--- +## harbor gc + +### Description + +##### Manage Garbage Collection in Harbor + +### Synopsis + +Use this command to manage registry-wide Garbage Collection (GC) in your Harbor instance. + +Garbage Collection cleans up deleted or orphaned blobs/tags in the registry to free up storage space. +This command supports listing execution history, viewing logs, showing schedule configuration, stopping running jobs, and triggering manual runs. + +### Examples + +```sh + # View Garbage Collection execution history + harbor gc history + + # Get the current Garbage Collection schedule + harbor gc schedule + + # Trigger Garbage Collection run immediately + harbor gc trigger --delete-untagged --dry-run=false + + # View execution logs for a GC run + harbor gc log 12 + + # Stop a running Garbage Collection run + harbor gc stop 12 + + # Update the automatic Garbage Collection schedule + harbor gc update-schedule daily --delete-untagged +``` + +### Options + +```sh + -h, --help help for gc +``` + +### Options inherited from parent commands + +```sh + -c, --config string config file (default is $HOME/.config/harbor-cli/config.yaml) + -o, --output-format string Output format. One of: json|yaml|csv + -v, --verbose verbose output +``` + +### SEE ALSO + +* [harbor](harbor.md) - Official Harbor CLI +* [harbor gc history](harbor-gc-history.md) - Get GC execution history +* [harbor gc log](harbor-gc-log.md) - Get GC execution log +* [harbor gc schedule](harbor-gc-schedule.md) - Get the current GC schedule +* [harbor gc stop](harbor-gc-stop.md) - Stop a running GC execution +* [harbor gc trigger](harbor-gc-trigger.md) - Trigger Garbage Collection immediately +* [harbor gc update-schedule](harbor-gc-update-schedule.md) - Update automatic GC schedule + diff --git a/doc/cli-docs/harbor-health.md b/doc/cli-docs/harbor-health.md index a3e8733ef..d13a22e85 100644 --- a/doc/cli-docs/harbor-health.md +++ b/doc/cli-docs/harbor-health.md @@ -1,6 +1,6 @@ --- title: harbor health -weight: 80 +weight: 25 --- ## harbor health diff --git a/doc/cli-docs/harbor-info.md b/doc/cli-docs/harbor-info.md index cbe7ba7bb..fe920b6d2 100644 --- a/doc/cli-docs/harbor-info.md +++ b/doc/cli-docs/harbor-info.md @@ -1,6 +1,6 @@ --- title: harbor info -weight: 65 +weight: 5 --- ## harbor info diff --git a/doc/cli-docs/harbor-instance-delete.md b/doc/cli-docs/harbor-instance-delete.md index ffe8dc771..1f7f9de3d 100644 --- a/doc/cli-docs/harbor-instance-delete.md +++ b/doc/cli-docs/harbor-instance-delete.md @@ -1,6 +1,6 @@ --- title: harbor instance delete -weight: 35 +weight: 5 --- ## harbor instance delete diff --git a/doc/cli-docs/harbor-instance-list.md b/doc/cli-docs/harbor-instance-list.md index 2f80cec9c..1c7f475a9 100644 --- a/doc/cli-docs/harbor-instance-list.md +++ b/doc/cli-docs/harbor-instance-list.md @@ -1,6 +1,6 @@ --- title: harbor instance list -weight: 95 +weight: 65 --- ## harbor instance list diff --git a/doc/cli-docs/harbor-label-delete.md b/doc/cli-docs/harbor-label-delete.md index 2e0b29d4e..debfe474e 100644 --- a/doc/cli-docs/harbor-label-delete.md +++ b/doc/cli-docs/harbor-label-delete.md @@ -1,6 +1,6 @@ --- title: harbor label delete -weight: 30 +weight: 85 --- ## harbor label delete diff --git a/doc/cli-docs/harbor-label-list.md b/doc/cli-docs/harbor-label-list.md index 963da0138..23edfb183 100644 --- a/doc/cli-docs/harbor-label-list.md +++ b/doc/cli-docs/harbor-label-list.md @@ -1,6 +1,6 @@ --- title: harbor label list -weight: 15 +weight: 20 --- ## harbor label list diff --git a/doc/cli-docs/harbor-label.md b/doc/cli-docs/harbor-label.md index 8421084b4..db641d931 100644 --- a/doc/cli-docs/harbor-label.md +++ b/doc/cli-docs/harbor-label.md @@ -1,6 +1,6 @@ --- title: harbor label -weight: 65 +weight: 5 --- ## harbor label diff --git a/doc/cli-docs/harbor-ldap-import.md b/doc/cli-docs/harbor-ldap-import.md index c82c70d9c..18a8dad96 100644 --- a/doc/cli-docs/harbor-ldap-import.md +++ b/doc/cli-docs/harbor-ldap-import.md @@ -1,6 +1,6 @@ --- title: harbor ldap import -weight: 15 +weight: 25 --- ## harbor ldap import diff --git a/doc/cli-docs/harbor-ldap-ping.md b/doc/cli-docs/harbor-ldap-ping.md index 7acc2ca3d..09d9b5f32 100644 --- a/doc/cli-docs/harbor-ldap-ping.md +++ b/doc/cli-docs/harbor-ldap-ping.md @@ -1,6 +1,6 @@ --- title: harbor ldap ping -weight: 90 +weight: 25 --- ## harbor ldap ping diff --git a/doc/cli-docs/harbor-ldap.md b/doc/cli-docs/harbor-ldap.md index 8698ce4ad..7517219a9 100644 --- a/doc/cli-docs/harbor-ldap.md +++ b/doc/cli-docs/harbor-ldap.md @@ -1,6 +1,6 @@ --- title: harbor ldap -weight: 20 +weight: 45 --- ## harbor ldap diff --git a/doc/cli-docs/harbor-logs.md b/doc/cli-docs/harbor-logs.md index 5b88db6f2..f5ea74b79 100644 --- a/doc/cli-docs/harbor-logs.md +++ b/doc/cli-docs/harbor-logs.md @@ -1,6 +1,6 @@ --- title: harbor logs -weight: 30 +weight: 25 --- ## harbor logs diff --git a/doc/cli-docs/harbor-project-config-list.md b/doc/cli-docs/harbor-project-config-list.md index 4a01da0d5..c3163c4fd 100644 --- a/doc/cli-docs/harbor-project-config-list.md +++ b/doc/cli-docs/harbor-project-config-list.md @@ -1,6 +1,6 @@ --- title: harbor project config list -weight: 85 +weight: 95 --- ## harbor project config list diff --git a/doc/cli-docs/harbor-project-config-update.md b/doc/cli-docs/harbor-project-config-update.md index e33602121..d772b35c7 100644 --- a/doc/cli-docs/harbor-project-config-update.md +++ b/doc/cli-docs/harbor-project-config-update.md @@ -1,6 +1,6 @@ --- title: harbor project config update -weight: 10 +weight: 30 --- ## harbor project config update diff --git a/doc/cli-docs/harbor-project-config.md b/doc/cli-docs/harbor-project-config.md index d4f678ddc..4348c0d1c 100644 --- a/doc/cli-docs/harbor-project-config.md +++ b/doc/cli-docs/harbor-project-config.md @@ -1,6 +1,6 @@ --- title: harbor project config -weight: 45 +weight: 20 --- ## harbor project config diff --git a/doc/cli-docs/harbor-project-create.md b/doc/cli-docs/harbor-project-create.md index f7b89711a..3c5a4269b 100644 --- a/doc/cli-docs/harbor-project-create.md +++ b/doc/cli-docs/harbor-project-create.md @@ -1,6 +1,6 @@ --- title: harbor project create -weight: 80 +weight: 60 --- ## harbor project create diff --git a/doc/cli-docs/harbor-project-delete.md b/doc/cli-docs/harbor-project-delete.md index cd6e08b74..5d73048bd 100644 --- a/doc/cli-docs/harbor-project-delete.md +++ b/doc/cli-docs/harbor-project-delete.md @@ -1,6 +1,6 @@ --- title: harbor project delete -weight: 100 +weight: 55 --- ## harbor project delete diff --git a/doc/cli-docs/harbor-project-list.md b/doc/cli-docs/harbor-project-list.md index 306c184f8..07c7fb08a 100644 --- a/doc/cli-docs/harbor-project-list.md +++ b/doc/cli-docs/harbor-project-list.md @@ -1,6 +1,6 @@ --- title: harbor project list -weight: 85 +weight: 80 --- ## harbor project list diff --git a/doc/cli-docs/harbor-project-logs.md b/doc/cli-docs/harbor-project-logs.md index 6955fa3d5..f995adf57 100644 --- a/doc/cli-docs/harbor-project-logs.md +++ b/doc/cli-docs/harbor-project-logs.md @@ -1,6 +1,6 @@ --- title: harbor project logs -weight: 90 +weight: 85 --- ## harbor project logs diff --git a/doc/cli-docs/harbor-project-member-create.md b/doc/cli-docs/harbor-project-member-create.md index 1c7b8950c..5380baf9d 100644 --- a/doc/cli-docs/harbor-project-member-create.md +++ b/doc/cli-docs/harbor-project-member-create.md @@ -1,6 +1,6 @@ --- title: harbor project member create -weight: 15 +weight: 75 --- ## harbor project member create diff --git a/doc/cli-docs/harbor-project-member-delete.md b/doc/cli-docs/harbor-project-member-delete.md index 283791709..42b9eaead 100644 --- a/doc/cli-docs/harbor-project-member-delete.md +++ b/doc/cli-docs/harbor-project-member-delete.md @@ -1,6 +1,6 @@ --- title: harbor project member delete -weight: 30 +weight: 40 --- ## harbor project member delete diff --git a/doc/cli-docs/harbor-project-member-update.md b/doc/cli-docs/harbor-project-member-update.md index 955d91a08..dc9fe7973 100644 --- a/doc/cli-docs/harbor-project-member-update.md +++ b/doc/cli-docs/harbor-project-member-update.md @@ -1,6 +1,6 @@ --- title: harbor project member update -weight: 20 +weight: 60 --- ## harbor project member update diff --git a/doc/cli-docs/harbor-project-member.md b/doc/cli-docs/harbor-project-member.md index be86d4c6f..343230d61 100644 --- a/doc/cli-docs/harbor-project-member.md +++ b/doc/cli-docs/harbor-project-member.md @@ -1,6 +1,6 @@ --- title: harbor project member -weight: 70 +weight: 50 --- ## harbor project member diff --git a/doc/cli-docs/harbor-project-robot-create.md b/doc/cli-docs/harbor-project-robot-create.md index 191d3b5ca..931548460 100644 --- a/doc/cli-docs/harbor-project-robot-create.md +++ b/doc/cli-docs/harbor-project-robot-create.md @@ -1,6 +1,6 @@ --- title: harbor project robot create -weight: 15 +weight: 30 --- ## harbor project robot create diff --git a/doc/cli-docs/harbor-project-robot-delete.md b/doc/cli-docs/harbor-project-robot-delete.md index 42b466fec..65f22385f 100644 --- a/doc/cli-docs/harbor-project-robot-delete.md +++ b/doc/cli-docs/harbor-project-robot-delete.md @@ -1,6 +1,6 @@ --- title: harbor project robot delete -weight: 5 +weight: 25 --- ## harbor project robot delete diff --git a/doc/cli-docs/harbor-project-robot-list.md b/doc/cli-docs/harbor-project-robot-list.md index c7582e9e5..c4cf68134 100644 --- a/doc/cli-docs/harbor-project-robot-list.md +++ b/doc/cli-docs/harbor-project-robot-list.md @@ -1,6 +1,6 @@ --- title: harbor project robot list -weight: 35 +weight: 5 --- ## harbor project robot list diff --git a/doc/cli-docs/harbor-project-robot-refresh.md b/doc/cli-docs/harbor-project-robot-refresh.md index f6e1bc9c9..6c3324006 100644 --- a/doc/cli-docs/harbor-project-robot-refresh.md +++ b/doc/cli-docs/harbor-project-robot-refresh.md @@ -1,6 +1,6 @@ --- title: harbor project robot refresh -weight: 25 +weight: 90 --- ## harbor project robot refresh diff --git a/doc/cli-docs/harbor-project-robot-update.md b/doc/cli-docs/harbor-project-robot-update.md index af8156065..d66d69d06 100644 --- a/doc/cli-docs/harbor-project-robot-update.md +++ b/doc/cli-docs/harbor-project-robot-update.md @@ -1,6 +1,6 @@ --- title: harbor project robot update -weight: 55 +weight: 50 --- ## harbor project robot update diff --git a/doc/cli-docs/harbor-project-robot-view.md b/doc/cli-docs/harbor-project-robot-view.md index 0607780be..7667f0fb6 100644 --- a/doc/cli-docs/harbor-project-robot-view.md +++ b/doc/cli-docs/harbor-project-robot-view.md @@ -1,6 +1,6 @@ --- title: harbor project robot view -weight: 50 +weight: 70 --- ## harbor project robot view diff --git a/doc/cli-docs/harbor-project-robot.md b/doc/cli-docs/harbor-project-robot.md index 4caf12b8c..8c008cc23 100644 --- a/doc/cli-docs/harbor-project-robot.md +++ b/doc/cli-docs/harbor-project-robot.md @@ -1,6 +1,6 @@ --- title: harbor project robot -weight: 40 +weight: 15 --- ## harbor project robot diff --git a/doc/cli-docs/harbor-project-search.md b/doc/cli-docs/harbor-project-search.md index 918eb744d..7c7d8a830 100644 --- a/doc/cli-docs/harbor-project-search.md +++ b/doc/cli-docs/harbor-project-search.md @@ -1,6 +1,6 @@ --- title: harbor project search -weight: 20 +weight: 25 --- ## harbor project search diff --git a/doc/cli-docs/harbor-project-view.md b/doc/cli-docs/harbor-project-view.md index 39dee3b09..721cf56e4 100644 --- a/doc/cli-docs/harbor-project-view.md +++ b/doc/cli-docs/harbor-project-view.md @@ -1,6 +1,6 @@ --- title: harbor project view -weight: 95 +weight: 75 --- ## harbor project view diff --git a/doc/cli-docs/harbor-quota-list.md b/doc/cli-docs/harbor-quota-list.md index ddeeb5010..0373e9adc 100644 --- a/doc/cli-docs/harbor-quota-list.md +++ b/doc/cli-docs/harbor-quota-list.md @@ -1,6 +1,6 @@ --- title: harbor quota list -weight: 85 +weight: 45 --- ## harbor quota list diff --git a/doc/cli-docs/harbor-quota-update.md b/doc/cli-docs/harbor-quota-update.md index 96669df1a..0c005b417 100644 --- a/doc/cli-docs/harbor-quota-update.md +++ b/doc/cli-docs/harbor-quota-update.md @@ -1,6 +1,6 @@ --- title: harbor quota update -weight: 70 +weight: 30 --- ## harbor quota update diff --git a/doc/cli-docs/harbor-quota-view.md b/doc/cli-docs/harbor-quota-view.md index 15a6a5706..ef1099b13 100644 --- a/doc/cli-docs/harbor-quota-view.md +++ b/doc/cli-docs/harbor-quota-view.md @@ -1,6 +1,6 @@ --- title: harbor quota view -weight: 30 +weight: 15 --- ## harbor quota view diff --git a/doc/cli-docs/harbor-quota.md b/doc/cli-docs/harbor-quota.md index a98b3cd3c..1c87c543a 100644 --- a/doc/cli-docs/harbor-quota.md +++ b/doc/cli-docs/harbor-quota.md @@ -1,6 +1,6 @@ --- title: harbor quota -weight: 30 +weight: 75 --- ## harbor quota diff --git a/doc/cli-docs/harbor-registry-create.md b/doc/cli-docs/harbor-registry-create.md index 7b9d9ffdd..13fb6c0b5 100644 --- a/doc/cli-docs/harbor-registry-create.md +++ b/doc/cli-docs/harbor-registry-create.md @@ -1,6 +1,6 @@ --- title: harbor registry create -weight: 110 +weight: 40 --- ## harbor registry create diff --git a/doc/cli-docs/harbor-registry-delete.md b/doc/cli-docs/harbor-registry-delete.md index ae56ffe5c..5bd05dcfb 100644 --- a/doc/cli-docs/harbor-registry-delete.md +++ b/doc/cli-docs/harbor-registry-delete.md @@ -1,6 +1,6 @@ --- title: harbor registry delete -weight: 140 +weight: 65 --- ## harbor registry delete diff --git a/doc/cli-docs/harbor-registry-list.md b/doc/cli-docs/harbor-registry-list.md index 17a5303c1..3dc68a391 100644 --- a/doc/cli-docs/harbor-registry-list.md +++ b/doc/cli-docs/harbor-registry-list.md @@ -1,6 +1,6 @@ --- title: harbor registry list -weight: 115 +weight: 55 --- ## harbor registry list diff --git a/doc/cli-docs/harbor-registry-update.md b/doc/cli-docs/harbor-registry-update.md index 07f990043..7859d4cb8 100644 --- a/doc/cli-docs/harbor-registry-update.md +++ b/doc/cli-docs/harbor-registry-update.md @@ -1,6 +1,6 @@ --- title: harbor registry update -weight: 125 +weight: 40 --- ## harbor registry update diff --git a/doc/cli-docs/harbor-registry-view.md b/doc/cli-docs/harbor-registry-view.md index d29f0e94e..82a583f72 100644 --- a/doc/cli-docs/harbor-registry-view.md +++ b/doc/cli-docs/harbor-registry-view.md @@ -1,6 +1,6 @@ --- title: harbor registry view -weight: 130 +weight: 95 --- ## harbor registry view diff --git a/doc/cli-docs/harbor-registry.md b/doc/cli-docs/harbor-registry.md index e16c341a1..639ed475a 100644 --- a/doc/cli-docs/harbor-registry.md +++ b/doc/cli-docs/harbor-registry.md @@ -1,6 +1,6 @@ --- title: harbor registry -weight: 105 +weight: 95 --- ## harbor registry diff --git a/doc/cli-docs/harbor-replication-executions-view.md b/doc/cli-docs/harbor-replication-executions-view.md index b7c6e3bec..5a3cbb0e7 100644 --- a/doc/cli-docs/harbor-replication-executions-view.md +++ b/doc/cli-docs/harbor-replication-executions-view.md @@ -1,6 +1,6 @@ --- title: harbor replication executions view -weight: 65 +weight: 10 --- ## harbor replication executions view diff --git a/doc/cli-docs/harbor-replication-executions.md b/doc/cli-docs/harbor-replication-executions.md index a9a80d12e..6e79c6eb1 100644 --- a/doc/cli-docs/harbor-replication-executions.md +++ b/doc/cli-docs/harbor-replication-executions.md @@ -1,6 +1,6 @@ --- title: harbor replication executions -weight: 70 +weight: 20 --- ## harbor replication executions diff --git a/doc/cli-docs/harbor-replication-log.md b/doc/cli-docs/harbor-replication-log.md index 683e1a85e..3fe62483d 100644 --- a/doc/cli-docs/harbor-replication-log.md +++ b/doc/cli-docs/harbor-replication-log.md @@ -1,6 +1,6 @@ --- title: harbor replication log -weight: 10 +weight: 55 --- ## harbor replication log diff --git a/doc/cli-docs/harbor-replication-policies-create.md b/doc/cli-docs/harbor-replication-policies-create.md index b5df52c3c..25c10a46f 100644 --- a/doc/cli-docs/harbor-replication-policies-create.md +++ b/doc/cli-docs/harbor-replication-policies-create.md @@ -1,6 +1,6 @@ --- title: harbor replication policies create -weight: 85 +weight: 20 --- ## harbor replication policies create diff --git a/doc/cli-docs/harbor-replication-policies-delete.md b/doc/cli-docs/harbor-replication-policies-delete.md index bd563df42..65648d8e8 100644 --- a/doc/cli-docs/harbor-replication-policies-delete.md +++ b/doc/cli-docs/harbor-replication-policies-delete.md @@ -1,6 +1,6 @@ --- title: harbor replication policies delete -weight: 55 +weight: 30 --- ## harbor replication policies delete diff --git a/doc/cli-docs/harbor-replication-policies-update.md b/doc/cli-docs/harbor-replication-policies-update.md index f7e82aa0d..e0514bd9c 100644 --- a/doc/cli-docs/harbor-replication-policies-update.md +++ b/doc/cli-docs/harbor-replication-policies-update.md @@ -1,6 +1,6 @@ --- title: harbor replication policies update -weight: 5 +weight: 50 --- ## harbor replication policies update diff --git a/doc/cli-docs/harbor-replication-policies-view.md b/doc/cli-docs/harbor-replication-policies-view.md index 4e961710a..b7b193872 100644 --- a/doc/cli-docs/harbor-replication-policies-view.md +++ b/doc/cli-docs/harbor-replication-policies-view.md @@ -1,6 +1,6 @@ --- title: harbor replication policies view -weight: 20 +weight: 85 --- ## harbor replication policies view diff --git a/doc/cli-docs/harbor-replication-policies.md b/doc/cli-docs/harbor-replication-policies.md index 40187dc21..b1f9e548f 100644 --- a/doc/cli-docs/harbor-replication-policies.md +++ b/doc/cli-docs/harbor-replication-policies.md @@ -1,6 +1,6 @@ --- title: harbor replication policies -weight: 50 +weight: 45 --- ## harbor replication policies diff --git a/doc/cli-docs/harbor-replication-start.md b/doc/cli-docs/harbor-replication-start.md index 882079d99..9f51d7de8 100644 --- a/doc/cli-docs/harbor-replication-start.md +++ b/doc/cli-docs/harbor-replication-start.md @@ -1,6 +1,6 @@ --- title: harbor replication start -weight: 35 +weight: 55 --- ## harbor replication start diff --git a/doc/cli-docs/harbor-replication-stop.md b/doc/cli-docs/harbor-replication-stop.md index ba867c854..908bc0559 100644 --- a/doc/cli-docs/harbor-replication-stop.md +++ b/doc/cli-docs/harbor-replication-stop.md @@ -1,6 +1,6 @@ --- title: harbor replication stop -weight: 70 +weight: 15 --- ## harbor replication stop diff --git a/doc/cli-docs/harbor-repo-delete.md b/doc/cli-docs/harbor-repo-delete.md index ccd6dadc9..cb8eefdef 100644 --- a/doc/cli-docs/harbor-repo-delete.md +++ b/doc/cli-docs/harbor-repo-delete.md @@ -1,6 +1,6 @@ --- title: harbor repo delete -weight: 160 +weight: 5 --- ## harbor repo delete diff --git a/doc/cli-docs/harbor-repo-list.md b/doc/cli-docs/harbor-repo-list.md index 4b01d4469..b803c77b1 100644 --- a/doc/cli-docs/harbor-repo-list.md +++ b/doc/cli-docs/harbor-repo-list.md @@ -1,6 +1,6 @@ --- title: harbor repo list -weight: 150 +weight: 50 --- ## harbor repo list diff --git a/doc/cli-docs/harbor-repo-search.md b/doc/cli-docs/harbor-repo-search.md index 99cd8b2e8..6df99a774 100644 --- a/doc/cli-docs/harbor-repo-search.md +++ b/doc/cli-docs/harbor-repo-search.md @@ -1,6 +1,6 @@ --- title: harbor repo search -weight: 30 +weight: 10 --- ## harbor repo search diff --git a/doc/cli-docs/harbor-repo-view.md b/doc/cli-docs/harbor-repo-view.md index 7c7a8d06a..8dfec8bec 100644 --- a/doc/cli-docs/harbor-repo-view.md +++ b/doc/cli-docs/harbor-repo-view.md @@ -1,6 +1,6 @@ --- title: harbor repo view -weight: 55 +weight: 70 --- ## harbor repo view diff --git a/doc/cli-docs/harbor-robot-delete.md b/doc/cli-docs/harbor-robot-delete.md index 8d601c7b2..9e7a6c0bc 100644 --- a/doc/cli-docs/harbor-robot-delete.md +++ b/doc/cli-docs/harbor-robot-delete.md @@ -1,6 +1,6 @@ --- title: harbor robot delete -weight: 10 +weight: 35 --- ## harbor robot delete diff --git a/doc/cli-docs/harbor-robot-list.md b/doc/cli-docs/harbor-robot-list.md index fe7ba2033..507403c6f 100644 --- a/doc/cli-docs/harbor-robot-list.md +++ b/doc/cli-docs/harbor-robot-list.md @@ -1,6 +1,6 @@ --- title: harbor robot list -weight: 65 +weight: 60 --- ## harbor robot list diff --git a/doc/cli-docs/harbor-robot-refresh.md b/doc/cli-docs/harbor-robot-refresh.md index 09ed536f3..d5332b342 100644 --- a/doc/cli-docs/harbor-robot-refresh.md +++ b/doc/cli-docs/harbor-robot-refresh.md @@ -1,6 +1,6 @@ --- title: harbor robot refresh -weight: 40 +weight: 55 --- ## harbor robot refresh diff --git a/doc/cli-docs/harbor-robot-view.md b/doc/cli-docs/harbor-robot-view.md index 4fa87d5ca..0e520fed0 100644 --- a/doc/cli-docs/harbor-robot-view.md +++ b/doc/cli-docs/harbor-robot-view.md @@ -1,6 +1,6 @@ --- title: harbor robot view -weight: 25 +weight: 40 --- ## harbor robot view diff --git a/doc/cli-docs/harbor-robot.md b/doc/cli-docs/harbor-robot.md index d5e9773c7..860e91084 100644 --- a/doc/cli-docs/harbor-robot.md +++ b/doc/cli-docs/harbor-robot.md @@ -1,6 +1,6 @@ --- title: harbor robot -weight: 75 +weight: 50 --- ## harbor robot diff --git a/doc/cli-docs/harbor-scan-all-metrics.md b/doc/cli-docs/harbor-scan-all-metrics.md index 5275cc1ea..e30138999 100644 --- a/doc/cli-docs/harbor-scan-all-metrics.md +++ b/doc/cli-docs/harbor-scan-all-metrics.md @@ -1,6 +1,6 @@ --- title: harbor scan all metrics -weight: 50 +weight: 85 --- ## harbor scan-all metrics diff --git a/doc/cli-docs/harbor-scan-all-run.md b/doc/cli-docs/harbor-scan-all-run.md index 403114615..577834e5b 100644 --- a/doc/cli-docs/harbor-scan-all-run.md +++ b/doc/cli-docs/harbor-scan-all-run.md @@ -1,6 +1,6 @@ --- title: harbor scan all run -weight: 80 +weight: 20 --- ## harbor scan-all run diff --git a/doc/cli-docs/harbor-scan-all-stop.md b/doc/cli-docs/harbor-scan-all-stop.md index 5f6b5ca85..581cd27b5 100644 --- a/doc/cli-docs/harbor-scan-all-stop.md +++ b/doc/cli-docs/harbor-scan-all-stop.md @@ -1,6 +1,6 @@ --- title: harbor scan all stop -weight: 40 +weight: 5 --- ## harbor scan-all stop diff --git a/doc/cli-docs/harbor-scan-all-update-schedule.md b/doc/cli-docs/harbor-scan-all-update-schedule.md index bc11300c6..272dfd9ec 100644 --- a/doc/cli-docs/harbor-scan-all-update-schedule.md +++ b/doc/cli-docs/harbor-scan-all-update-schedule.md @@ -1,6 +1,6 @@ --- title: harbor scan all update schedule -weight: 50 +weight: 75 --- ## harbor scan-all update-schedule diff --git a/doc/cli-docs/harbor-scan-all-view-schedule.md b/doc/cli-docs/harbor-scan-all-view-schedule.md index 2acccf80e..81d439ec2 100644 --- a/doc/cli-docs/harbor-scan-all-view-schedule.md +++ b/doc/cli-docs/harbor-scan-all-view-schedule.md @@ -1,6 +1,6 @@ --- title: harbor scan all view schedule -weight: 35 +weight: 40 --- ## harbor scan-all view-schedule diff --git a/doc/cli-docs/harbor-scan-all.md b/doc/cli-docs/harbor-scan-all.md index 0fd847ef2..b18260d34 100644 --- a/doc/cli-docs/harbor-scan-all.md +++ b/doc/cli-docs/harbor-scan-all.md @@ -1,6 +1,6 @@ --- title: harbor scan all -weight: 85 +weight: 75 --- ## harbor scan-all diff --git a/doc/cli-docs/harbor-scanner-create.md b/doc/cli-docs/harbor-scanner-create.md index 2e19a26e1..4b974bee4 100644 --- a/doc/cli-docs/harbor-scanner-create.md +++ b/doc/cli-docs/harbor-scanner-create.md @@ -1,6 +1,6 @@ --- title: harbor scanner create -weight: 95 +weight: 55 --- ## harbor scanner create diff --git a/doc/cli-docs/harbor-scanner-delete.md b/doc/cli-docs/harbor-scanner-delete.md index 4f90d4364..7502fc8eb 100644 --- a/doc/cli-docs/harbor-scanner-delete.md +++ b/doc/cli-docs/harbor-scanner-delete.md @@ -1,6 +1,6 @@ --- title: harbor scanner delete -weight: 45 +weight: 95 --- ## harbor scanner delete diff --git a/doc/cli-docs/harbor-scanner-list.md b/doc/cli-docs/harbor-scanner-list.md index 59cfa60a7..5231ad825 100644 --- a/doc/cli-docs/harbor-scanner-list.md +++ b/doc/cli-docs/harbor-scanner-list.md @@ -1,6 +1,6 @@ --- title: harbor scanner list -weight: 50 +weight: 90 --- ## harbor scanner list diff --git a/doc/cli-docs/harbor-scanner-set-default.md b/doc/cli-docs/harbor-scanner-set-default.md index fde114c6d..cf1a2975b 100644 --- a/doc/cli-docs/harbor-scanner-set-default.md +++ b/doc/cli-docs/harbor-scanner-set-default.md @@ -1,6 +1,6 @@ --- title: harbor scanner set default -weight: 25 +weight: 15 --- ## harbor scanner set-default diff --git a/doc/cli-docs/harbor-scanner-update.md b/doc/cli-docs/harbor-scanner-update.md index bed4edbbf..bc024b4ca 100644 --- a/doc/cli-docs/harbor-scanner-update.md +++ b/doc/cli-docs/harbor-scanner-update.md @@ -1,6 +1,6 @@ --- title: harbor scanner update -weight: 90 +weight: 5 --- ## harbor scanner update diff --git a/doc/cli-docs/harbor-scanner-view.md b/doc/cli-docs/harbor-scanner-view.md index 71c43ac7f..b661221f4 100644 --- a/doc/cli-docs/harbor-scanner-view.md +++ b/doc/cli-docs/harbor-scanner-view.md @@ -1,6 +1,6 @@ --- title: harbor scanner view -weight: 95 +weight: 60 --- ## harbor scanner view diff --git a/doc/cli-docs/harbor-scanner.md b/doc/cli-docs/harbor-scanner.md index f8bd58b2a..f55dcfe71 100644 --- a/doc/cli-docs/harbor-scanner.md +++ b/doc/cli-docs/harbor-scanner.md @@ -1,6 +1,6 @@ --- title: harbor scanner -weight: 70 +weight: 90 --- ## harbor scanner diff --git a/doc/cli-docs/harbor-schedule-list.md b/doc/cli-docs/harbor-schedule-list.md index eecd2dac7..495a40bcf 100644 --- a/doc/cli-docs/harbor-schedule-list.md +++ b/doc/cli-docs/harbor-schedule-list.md @@ -1,6 +1,6 @@ --- title: harbor schedule list -weight: 70 +weight: 55 --- ## harbor schedule list diff --git a/doc/cli-docs/harbor-schedule.md b/doc/cli-docs/harbor-schedule.md index 6ac0644a1..fe8472c43 100644 --- a/doc/cli-docs/harbor-schedule.md +++ b/doc/cli-docs/harbor-schedule.md @@ -1,6 +1,6 @@ --- title: harbor schedule -weight: 25 +weight: 80 --- ## harbor schedule diff --git a/doc/cli-docs/harbor-tag-immutable-create.md b/doc/cli-docs/harbor-tag-immutable-create.md index 89d65a775..9cf87b3af 100644 --- a/doc/cli-docs/harbor-tag-immutable-create.md +++ b/doc/cli-docs/harbor-tag-immutable-create.md @@ -1,6 +1,6 @@ --- title: harbor tag immutable create -weight: 70 +weight: 65 --- ## harbor tag immutable create diff --git a/doc/cli-docs/harbor-tag-immutable-delete.md b/doc/cli-docs/harbor-tag-immutable-delete.md index d9833f449..c861ea22f 100644 --- a/doc/cli-docs/harbor-tag-immutable-delete.md +++ b/doc/cli-docs/harbor-tag-immutable-delete.md @@ -1,6 +1,6 @@ --- title: harbor tag immutable delete -weight: 30 +weight: 5 --- ## harbor tag immutable delete diff --git a/doc/cli-docs/harbor-tag-immutable-list.md b/doc/cli-docs/harbor-tag-immutable-list.md index fd98de277..de5820498 100644 --- a/doc/cli-docs/harbor-tag-immutable-list.md +++ b/doc/cli-docs/harbor-tag-immutable-list.md @@ -1,6 +1,6 @@ --- title: harbor tag immutable list -weight: 40 +weight: 35 --- ## harbor tag immutable list diff --git a/doc/cli-docs/harbor-tag-immutable.md b/doc/cli-docs/harbor-tag-immutable.md index f151683dd..45b766d09 100644 --- a/doc/cli-docs/harbor-tag-immutable.md +++ b/doc/cli-docs/harbor-tag-immutable.md @@ -1,6 +1,6 @@ --- title: harbor tag immutable -weight: 25 +weight: 50 --- ## harbor tag immutable diff --git a/doc/cli-docs/harbor-user-create.md b/doc/cli-docs/harbor-user-create.md index 479655cce..0aeff1c99 100644 --- a/doc/cli-docs/harbor-user-create.md +++ b/doc/cli-docs/harbor-user-create.md @@ -1,6 +1,6 @@ --- title: harbor user create -weight: 170 +weight: 70 --- ## harbor user create diff --git a/doc/cli-docs/harbor-user-delete.md b/doc/cli-docs/harbor-user-delete.md index 95eb7f53b..d6d9e0542 100644 --- a/doc/cli-docs/harbor-user-delete.md +++ b/doc/cli-docs/harbor-user-delete.md @@ -1,6 +1,6 @@ --- title: harbor user delete -weight: 185 +weight: 95 --- ## harbor user delete diff --git a/doc/cli-docs/harbor-user-elevate.md b/doc/cli-docs/harbor-user-elevate.md index 072efc6e2..72a1d856e 100644 --- a/doc/cli-docs/harbor-user-elevate.md +++ b/doc/cli-docs/harbor-user-elevate.md @@ -1,6 +1,6 @@ --- title: harbor user elevate -weight: 180 +weight: 10 --- ## harbor user elevate diff --git a/doc/cli-docs/harbor-user-list.md b/doc/cli-docs/harbor-user-list.md index 989d6c70d..a9ee7bd60 100644 --- a/doc/cli-docs/harbor-user-list.md +++ b/doc/cli-docs/harbor-user-list.md @@ -1,6 +1,6 @@ --- title: harbor user list -weight: 175 +weight: 90 --- ## harbor user list diff --git a/doc/cli-docs/harbor-user-password.md b/doc/cli-docs/harbor-user-password.md index 6affdf68b..bd3434fe2 100644 --- a/doc/cli-docs/harbor-user-password.md +++ b/doc/cli-docs/harbor-user-password.md @@ -1,6 +1,6 @@ --- title: harbor user password -weight: 30 +weight: 85 --- ## harbor user password diff --git a/doc/cli-docs/harbor-user.md b/doc/cli-docs/harbor-user.md index 38ca59534..9ed1d8a56 100644 --- a/doc/cli-docs/harbor-user.md +++ b/doc/cli-docs/harbor-user.md @@ -1,6 +1,6 @@ --- title: harbor user -weight: 165 +weight: 15 --- ## harbor user diff --git a/doc/cli-docs/harbor-version.md b/doc/cli-docs/harbor-version.md index 3b7da126f..f15afa1ab 100644 --- a/doc/cli-docs/harbor-version.md +++ b/doc/cli-docs/harbor-version.md @@ -1,6 +1,6 @@ --- title: harbor version -weight: 10 +weight: 15 --- ## harbor version diff --git a/doc/cli-docs/harbor-vulnerability-list.md b/doc/cli-docs/harbor-vulnerability-list.md index 2adececc1..69306bacc 100644 --- a/doc/cli-docs/harbor-vulnerability-list.md +++ b/doc/cli-docs/harbor-vulnerability-list.md @@ -1,6 +1,6 @@ --- title: harbor vulnerability list -weight: 90 +weight: 40 --- ## harbor vulnerability list diff --git a/doc/cli-docs/harbor-vulnerability-summary.md b/doc/cli-docs/harbor-vulnerability-summary.md index 4fbd95867..c8e86c834 100644 --- a/doc/cli-docs/harbor-vulnerability-summary.md +++ b/doc/cli-docs/harbor-vulnerability-summary.md @@ -1,6 +1,6 @@ --- title: harbor vulnerability summary -weight: 35 +weight: 10 --- ## harbor vulnerability summary diff --git a/doc/cli-docs/harbor-vulnerability.md b/doc/cli-docs/harbor-vulnerability.md index 44bb3e533..056654f56 100644 --- a/doc/cli-docs/harbor-vulnerability.md +++ b/doc/cli-docs/harbor-vulnerability.md @@ -1,6 +1,6 @@ --- title: harbor vulnerability -weight: 70 +weight: 75 --- ## harbor vulnerability diff --git a/doc/cli-docs/harbor-webhook-delete.md b/doc/cli-docs/harbor-webhook-delete.md index 4b4e5382c..0dc936cad 100644 --- a/doc/cli-docs/harbor-webhook-delete.md +++ b/doc/cli-docs/harbor-webhook-delete.md @@ -1,6 +1,6 @@ --- title: harbor webhook delete -weight: 70 +weight: 65 --- ## harbor webhook delete diff --git a/doc/cli-docs/harbor-webhook-edit.md b/doc/cli-docs/harbor-webhook-edit.md index 55ccca311..33c434040 100644 --- a/doc/cli-docs/harbor-webhook-edit.md +++ b/doc/cli-docs/harbor-webhook-edit.md @@ -1,6 +1,6 @@ --- title: harbor webhook edit -weight: 55 +weight: 30 --- ## harbor webhook edit diff --git a/doc/cli-docs/harbor-webhook-list.md b/doc/cli-docs/harbor-webhook-list.md index ba682c789..dcac1d544 100644 --- a/doc/cli-docs/harbor-webhook-list.md +++ b/doc/cli-docs/harbor-webhook-list.md @@ -1,6 +1,6 @@ --- title: harbor webhook list -weight: 60 +weight: 55 --- ## harbor webhook list diff --git a/doc/cli-docs/harbor-webhook.md b/doc/cli-docs/harbor-webhook.md index adfdf8fab..220ffa108 100644 --- a/doc/cli-docs/harbor-webhook.md +++ b/doc/cli-docs/harbor-webhook.md @@ -1,6 +1,6 @@ --- title: harbor webhook -weight: 20 +weight: 15 --- ## harbor webhook diff --git a/doc/cli-docs/harbor.md b/doc/cli-docs/harbor.md index ec7dd3749..6361772b6 100644 --- a/doc/cli-docs/harbor.md +++ b/doc/cli-docs/harbor.md @@ -39,6 +39,7 @@ harbor help * [harbor config](harbor-config.md) - Manage system configurations * [harbor context](harbor-context.md) - Manage locally available contexts * [harbor cve-allowlist](harbor-cve-allowlist.md) - Manage system CVE allowlist +* [harbor gc](harbor-gc.md) - Manage Garbage Collection in Harbor * [harbor health](harbor-health.md) - Get the health status of Harbor components * [harbor info](harbor-info.md) - Display detailed Harbor system, statistics, and CLI environment information * [harbor instance](harbor-instance.md) - Manage preheat provider instances in Harbor diff --git a/doc/man-docs/man1/harbor-config-get.1 b/doc/man-docs/man1/harbor-config-get.1 index 1728b99bb..818f2b2a5 100644 --- a/doc/man-docs/man1/harbor-config-get.1 +++ b/doc/man-docs/man1/harbor-config-get.1 @@ -1,39 +1,39 @@ -.nh -.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" - -.SH NAME -harbor-config-get - Get Harbor configurations - - -.SH SYNOPSIS -\fBharbor config get [flags]\fP - - -.SH DESCRIPTION -Get Harbor system configurations. - -.EX - This command retrieves the current configurations from Harbor and stores them in your local config file. -.EE - - -.SH OPTIONS -\fB-h\fP, \fB--help\fP[=false] - help for get - - -.SH OPTIONS INHERITED FROM PARENT COMMANDS -\fB-c\fP, \fB--config\fP="" - config file (default is $HOME/.config/harbor-cli/config.yaml) - -.PP -\fB-o\fP, \fB--output-format\fP="" - Output format. One of: json|yaml - -.PP -\fB-v\fP, \fB--verbose\fP[=false] - verbose output - - -.SH SEE ALSO +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-config-get - Get Harbor configurations + + +.SH SYNOPSIS +\fBharbor config get [flags]\fP + + +.SH DESCRIPTION +Get Harbor system configurations. + +.EX + This command retrieves the current configurations from Harbor and stores them in your local config file. +.EE + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for get + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH SEE ALSO \fBharbor-config(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-config-update.1 b/doc/man-docs/man1/harbor-config-update.1 index 52b8725c8..6c295ffdd 100644 --- a/doc/man-docs/man1/harbor-config-update.1 +++ b/doc/man-docs/man1/harbor-config-update.1 @@ -1,43 +1,43 @@ -.nh -.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" - -.SH NAME -harbor-config-update - Update system configurations from local config file - - -.SH SYNOPSIS -\fBharbor config update [flags]\fP - - -.SH DESCRIPTION -Update Harbor system configurations using the values stored in your local config file. -This will push the configurations from your local config file to the Harbor server. -Make sure to run 'harbor config get' first to populate the local config file with current configurations. - - -.SH OPTIONS -\fB-h\fP, \fB--help\fP[=false] - help for update - - -.SH OPTIONS INHERITED FROM PARENT COMMANDS -\fB-c\fP, \fB--config\fP="" - config file (default is $HOME/.config/harbor-cli/config.yaml) - -.PP -\fB-o\fP, \fB--output-format\fP="" - Output format. One of: json|yaml - -.PP -\fB-v\fP, \fB--verbose\fP[=false] - verbose output - - -.SH EXAMPLE -.EX -harbor config update -.EE - - -.SH SEE ALSO +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-config-update - Update system configurations from local config file + + +.SH SYNOPSIS +\fBharbor config update [flags]\fP + + +.SH DESCRIPTION +Update Harbor system configurations using the values stored in your local config file. +This will push the configurations from your local config file to the Harbor server. +Make sure to run 'harbor config get' first to populate the local config file with current configurations. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for update + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX +harbor config update +.EE + + +.SH SEE ALSO \fBharbor-config(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-context-set.1 b/doc/man-docs/man1/harbor-context-set.1 index ff9f5ae8c..c8c5aea40 100644 --- a/doc/man-docs/man1/harbor-context-set.1 +++ b/doc/man-docs/man1/harbor-context-set.1 @@ -1,53 +1,53 @@ -.nh -.TH "HARBOR" "1" "Habor Community" "Harbor User Mannuals" - -.SH NAME -harbor-config-set - Set a specific config item - - -.SH SYNOPSIS -\fBharbor config set [flags]\fP - - -.SH DESCRIPTION -Set the value of a specific CLI config item. -Case-insensitive field lookup, but uses the canonical (Go) field name internally. -If you specify --name, that credential (rather than the "current" one) will be updated. - - -.SH OPTIONS -\fB-h\fP, \fB--help\fP[=false] - help for set - -.PP -\fB-n\fP, \fB--name\fP="" - Name of the credential to set fields on (default: the current credential) - - -.SH OPTIONS INHERITED FROM PARENT COMMANDS -\fB-c\fP, \fB--config\fP="" - config file (default is $HOME/.config/harbor-cli/config.yaml) - -.PP -\fB-o\fP, \fB--output-format\fP="" - Output format. One of: json|yaml - -.PP -\fB-v\fP, \fB--verbose\fP[=false] - verbose output - - -.SH EXAMPLE -.EX - - # Set the current credential's password - harbor config set credentials.password myNewSecret - - # Set a credential's password by specifying the credential name - harbor config set credentials.password myNewSecret --name harbor-cli@http://demo.goharbor.io - -.EE - - -.SH SEE ALSO +.nh +.TH "HARBOR" "1" "Habor Community" "Harbor User Mannuals" + +.SH NAME +harbor-config-set - Set a specific config item + + +.SH SYNOPSIS +\fBharbor config set [flags]\fP + + +.SH DESCRIPTION +Set the value of a specific CLI config item. +Case-insensitive field lookup, but uses the canonical (Go) field name internally. +If you specify --name, that credential (rather than the "current" one) will be updated. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for set + +.PP +\fB-n\fP, \fB--name\fP="" + Name of the credential to set fields on (default: the current credential) + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + + # Set the current credential's password + harbor config set credentials.password myNewSecret + + # Set a credential's password by specifying the credential name + harbor config set credentials.password myNewSecret --name harbor-cli@http://demo.goharbor.io + +.EE + + +.SH SEE ALSO \fBharbor-config(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc-history.1 b/doc/man-docs/man1/harbor-gc-history.1 new file mode 100644 index 000000000..3fcae887a --- /dev/null +++ b/doc/man-docs/man1/harbor-gc-history.1 @@ -0,0 +1,57 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc-history - Get GC execution history + + +.SH SYNOPSIS +\fBharbor gc history [flags]\fP + + +.SH DESCRIPTION +Retrieve the execution history of registry-wide Garbage Collection jobs. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for history + +.PP +\fB--page\fP=1 + Page number + +.PP +\fB--page-size\fP=10 + Size of per page + +.PP +\fB-q\fP, \fB--query\fP="" + Query string to query resources + +.PP +\fB--sort\fP="" + Sort the resource list in ascending or descending order + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + harbor gc history --page 1 --page-size 10 +.EE + + +.SH SEE ALSO +\fBharbor-gc(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc-log.1 b/doc/man-docs/man1/harbor-gc-log.1 new file mode 100644 index 000000000..cce1d75fc --- /dev/null +++ b/doc/man-docs/man1/harbor-gc-log.1 @@ -0,0 +1,41 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc-log - Get GC execution log + + +.SH SYNOPSIS +\fBharbor gc log [gc-id] [flags]\fP + + +.SH DESCRIPTION +Retrieve the execution log of a specific Garbage Collection run by its ID. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for log + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + harbor gc log 12 +.EE + + +.SH SEE ALSO +\fBharbor-gc(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc-schedule.1 b/doc/man-docs/man1/harbor-gc-schedule.1 new file mode 100644 index 000000000..8c203f8e8 --- /dev/null +++ b/doc/man-docs/man1/harbor-gc-schedule.1 @@ -0,0 +1,41 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc-schedule - Get the current GC schedule + + +.SH SYNOPSIS +\fBharbor gc schedule [flags]\fP + + +.SH DESCRIPTION +Retrieve the configuration and schedule parameters for automatic Garbage Collection. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for schedule + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + harbor gc schedule +.EE + + +.SH SEE ALSO +\fBharbor-gc(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc-stop.1 b/doc/man-docs/man1/harbor-gc-stop.1 new file mode 100644 index 000000000..b9cabfaf5 --- /dev/null +++ b/doc/man-docs/man1/harbor-gc-stop.1 @@ -0,0 +1,41 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc-stop - Stop a running GC execution + + +.SH SYNOPSIS +\fBharbor gc stop [gc-id] [flags]\fP + + +.SH DESCRIPTION +Stop a currently running Garbage Collection job by its run ID. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for stop + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + harbor gc stop 12 +.EE + + +.SH SEE ALSO +\fBharbor-gc(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc-trigger.1 b/doc/man-docs/man1/harbor-gc-trigger.1 new file mode 100644 index 000000000..0954d820a --- /dev/null +++ b/doc/man-docs/man1/harbor-gc-trigger.1 @@ -0,0 +1,53 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc-trigger - Trigger Garbage Collection immediately + + +.SH SYNOPSIS +\fBharbor gc trigger [flags]\fP + + +.SH DESCRIPTION +Start a manual Garbage Collection job immediately in Harbor registry. + + +.SH OPTIONS +\fB--delete-untagged\fP[=false] + Delete untagged artifacts + +.PP +\fB--dry-run\fP[=false] + Simulate the GC process without deleting actual blobs + +.PP +\fB-h\fP, \fB--help\fP[=false] + help for trigger + +.PP +\fB-i\fP, \fB--interactive\fP[=false] + Trigger Garbage Collection interactively + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + harbor gc trigger --delete-untagged --dry-run=false +.EE + + +.SH SEE ALSO +\fBharbor-gc(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc-update-schedule.1 b/doc/man-docs/man1/harbor-gc-update-schedule.1 new file mode 100644 index 000000000..b202c4e24 --- /dev/null +++ b/doc/man-docs/man1/harbor-gc-update-schedule.1 @@ -0,0 +1,76 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc-update-schedule - Update automatic GC schedule + + +.SH SYNOPSIS +\fBharbor gc update-schedule [schedule-type: none|hourly|daily|weekly|custom] [flags]\fP + + +.SH DESCRIPTION +Configure or update the automatic Garbage Collection schedule for the registry. + +.PP +Available schedule types: + - none: Disable scheduled Garbage Collection + - hourly: Run GC every hour + - daily: Run GC once per day + - weekly: Run GC once per week + - custom: Define a custom schedule using a cron expression + +.PP +For custom schedules, Harbor requires a 6-field cron expression in the format: + seconds minutes hours day-of-month month day-of-week + +.PP +Examples: + # Disable automatic Garbage Collection + harbor gc update-schedule none + +.PP +# Configure daily Garbage Collection deleting untagged artifacts + harbor gc update-schedule daily --delete-untagged + +.PP +# Configure custom schedule (e.g. daily at 3:00 AM) in dry-run mode + harbor gc update-schedule custom --cron "0 0 3 * * *" --dry-run + + +.SH OPTIONS +\fB--cron\fP="" + Cron expression for custom schedule (include in double quotes) + +.PP +\fB--delete-untagged\fP[=false] + Delete untagged artifacts + +.PP +\fB--dry-run\fP[=false] + Simulate the GC process without deleting actual blobs + +.PP +\fB-h\fP, \fB--help\fP[=false] + help for update-schedule + +.PP +\fB-i\fP, \fB--interactive\fP[=false] + Update GC schedule interactively + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH SEE ALSO +\fBharbor-gc(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-gc.1 b/doc/man-docs/man1/harbor-gc.1 new file mode 100644 index 000000000..d4fbdcf6c --- /dev/null +++ b/doc/man-docs/man1/harbor-gc.1 @@ -0,0 +1,61 @@ +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-gc - Manage Garbage Collection in Harbor + + +.SH SYNOPSIS +\fBharbor gc [flags]\fP + + +.SH DESCRIPTION +Use this command to manage registry-wide Garbage Collection (GC) in your Harbor instance. + +.PP +Garbage Collection cleans up deleted or orphaned blobs/tags in the registry to free up storage space. +This command supports listing execution history, viewing logs, showing schedule configuration, stopping running jobs, and triggering manual runs. + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for gc + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml|csv + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + # View Garbage Collection execution history + harbor gc history + + # Get the current Garbage Collection schedule + harbor gc schedule + + # Trigger Garbage Collection run immediately + harbor gc trigger --delete-untagged --dry-run=false + + # View execution logs for a GC run + harbor gc log 12 + + # Stop a running Garbage Collection run + harbor gc stop 12 + + # Update the automatic Garbage Collection schedule + harbor gc update-schedule daily --delete-untagged +.EE + + +.SH SEE ALSO +\fBharbor(1)\fP, \fBharbor-gc-history(1)\fP, \fBharbor-gc-log(1)\fP, \fBharbor-gc-schedule(1)\fP, \fBharbor-gc-stop(1)\fP, \fBharbor-gc-trigger(1)\fP, \fBharbor-gc-update-schedule(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor-project-member-view.1 b/doc/man-docs/man1/harbor-project-member-view.1 index 2cab48925..ee61d00d2 100644 --- a/doc/man-docs/man1/harbor-project-member-view.1 +++ b/doc/man-docs/man1/harbor-project-member-view.1 @@ -1,49 +1,49 @@ -.nh -.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" - -.SH NAME -harbor-project-member-view - get project member by ID or name - - -.SH SYNOPSIS -\fBharbor project member view [ProjectName Or ID] [member ID] [flags]\fP - - -.SH DESCRIPTION -get member details by MemberID - - -.SH OPTIONS -\fB-h\fP, \fB--help\fP[=false] - help for view - -.PP -\fB--id\fP=0 - Member ID - -.PP -\fB-p\fP, \fB--projectname\fP="" - Project Name - - -.SH OPTIONS INHERITED FROM PARENT COMMANDS -\fB-c\fP, \fB--config\fP="" - config file (default is $HOME/.config/harbor-cli/config.yaml) - -.PP -\fB-o\fP, \fB--output-format\fP="" - Output format. One of: json|yaml - -.PP -\fB-v\fP, \fB--verbose\fP[=false] - verbose output - - -.SH EXAMPLE -.EX - harbor project member view my-project [memberID] -.EE - - -.SH SEE ALSO +.nh +.TH "HARBOR" "1" "Harbor Community" "Harbor User Manuals" + +.SH NAME +harbor-project-member-view - get project member by ID or name + + +.SH SYNOPSIS +\fBharbor project member view [ProjectName Or ID] [member ID] [flags]\fP + + +.SH DESCRIPTION +get member details by MemberID + + +.SH OPTIONS +\fB-h\fP, \fB--help\fP[=false] + help for view + +.PP +\fB--id\fP=0 + Member ID + +.PP +\fB-p\fP, \fB--projectname\fP="" + Project Name + + +.SH OPTIONS INHERITED FROM PARENT COMMANDS +\fB-c\fP, \fB--config\fP="" + config file (default is $HOME/.config/harbor-cli/config.yaml) + +.PP +\fB-o\fP, \fB--output-format\fP="" + Output format. One of: json|yaml + +.PP +\fB-v\fP, \fB--verbose\fP[=false] + verbose output + + +.SH EXAMPLE +.EX + harbor project member view my-project [memberID] +.EE + + +.SH SEE ALSO \fBharbor-project-member(1)\fP \ No newline at end of file diff --git a/doc/man-docs/man1/harbor.1 b/doc/man-docs/man1/harbor.1 index 741d8f706..147652c56 100644 --- a/doc/man-docs/man1/harbor.1 +++ b/doc/man-docs/man1/harbor.1 @@ -43,4 +43,4 @@ harbor help .SH SEE ALSO -\fBharbor-artifact(1)\fP, \fBharbor-config(1)\fP, \fBharbor-context(1)\fP, \fBharbor-cve-allowlist(1)\fP, \fBharbor-health(1)\fP, \fBharbor-info(1)\fP, \fBharbor-instance(1)\fP, \fBharbor-jobservice(1)\fP, \fBharbor-label(1)\fP, \fBharbor-ldap(1)\fP, \fBharbor-login(1)\fP, \fBharbor-logs(1)\fP, \fBharbor-password(1)\fP, \fBharbor-project(1)\fP, \fBharbor-quota(1)\fP, \fBharbor-registry(1)\fP, \fBharbor-replication(1)\fP, \fBharbor-repo(1)\fP, \fBharbor-robot(1)\fP, \fBharbor-scan-all(1)\fP, \fBharbor-scanner(1)\fP, \fBharbor-schedule(1)\fP, \fBharbor-tag(1)\fP, \fBharbor-user(1)\fP, \fBharbor-version(1)\fP, \fBharbor-vulnerability(1)\fP, \fBharbor-webhook(1)\fP \ No newline at end of file +\fBharbor-artifact(1)\fP, \fBharbor-config(1)\fP, \fBharbor-context(1)\fP, \fBharbor-cve-allowlist(1)\fP, \fBharbor-gc(1)\fP, \fBharbor-health(1)\fP, \fBharbor-info(1)\fP, \fBharbor-instance(1)\fP, \fBharbor-jobservice(1)\fP, \fBharbor-label(1)\fP, \fBharbor-ldap(1)\fP, \fBharbor-login(1)\fP, \fBharbor-logs(1)\fP, \fBharbor-password(1)\fP, \fBharbor-project(1)\fP, \fBharbor-quota(1)\fP, \fBharbor-registry(1)\fP, \fBharbor-replication(1)\fP, \fBharbor-repo(1)\fP, \fBharbor-robot(1)\fP, \fBharbor-scan-all(1)\fP, \fBharbor-scanner(1)\fP, \fBharbor-schedule(1)\fP, \fBharbor-tag(1)\fP, \fBharbor-user(1)\fP, \fBharbor-version(1)\fP, \fBharbor-vulnerability(1)\fP, \fBharbor-webhook(1)\fP \ No newline at end of file diff --git a/pkg/api/gc_handler.go b/pkg/api/gc_handler.go new file mode 100644 index 000000000..45b9acbe6 --- /dev/null +++ b/pkg/api/gc_handler.go @@ -0,0 +1,162 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package api + +import ( + "github.com/goharbor/go-client/pkg/sdk/v2.0/client/gc" + "github.com/goharbor/go-client/pkg/sdk/v2.0/models" + "github.com/goharbor/harbor-cli/pkg/utils" +) + +func ListGCHistory(opts ListFlags) ([]*models.GCHistory, error) { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return nil, err + } + + response, err := client.GC.GetGCHistory(ctx, &gc.GetGCHistoryParams{ + Page: &opts.Page, + PageSize: &opts.PageSize, + Q: &opts.Q, + Sort: &opts.Sort, + }) + if err != nil { + return nil, err + } + + return response.Payload, nil +} + +func GetGCStatus(gcID int64) (*models.GCHistory, error) { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return nil, err + } + + response, err := client.GC.GetGC(ctx, &gc.GetGCParams{ + GCID: gcID, + }) + if err != nil { + return nil, err + } + + return response.Payload, nil +} + +func GetGCLog(gcID int64) (string, error) { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return "", err + } + + response, err := client.GC.GetGCLog(ctx, &gc.GetGCLogParams{ + GCID: gcID, + }) + if err != nil { + return "", err + } + + return response.Payload, nil +} + +func StopGC(gcID int64) error { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return err + } + + _, err = client.GC.StopGC(ctx, &gc.StopGCParams{ + GCID: gcID, + }) + return err +} + +func GetGCSchedule() (*models.GCHistory, error) { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return nil, err + } + + response, err := client.GC.GetGCSchedule(ctx, &gc.GetGCScheduleParams{}) + if err != nil { + return nil, err + } + + return response.Payload, nil +} + +func UpdateGCSchedule(scheduleType string, cronStr string, deleteUntagged bool, dryRun bool) error { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return err + } + + parameters := map[string]interface{}{ + "delete_untagged": deleteUntagged, + "dry_run": dryRun, + } + + scheduleObj := &models.ScheduleObj{ + Type: scheduleType, + } + if scheduleType == "Custom" || scheduleType == "Schedule" { + scheduleObj.Cron = cronStr + } else { + // API requires some placeholder values even for Hourly/Daily/Weekly/None + scheduleObj.Cron = "0 0 * * * * " + } + + _, err = client.GC.UpdateGCSchedule(ctx, &gc.UpdateGCScheduleParams{ + Schedule: &models.Schedule{ + Parameters: parameters, + Schedule: scheduleObj, + }, + }) + return err +} + +func TriggerGC(deleteUntagged bool, dryRun bool) error { + ctx, client, err := utils.ContextWithClient() + if err != nil { + return err + } + + parameters := map[string]interface{}{ + "delete_untagged": deleteUntagged, + "dry_run": dryRun, + } + + scheduleObj := &models.ScheduleObj{ + Type: "Manual", + Cron: "0 0 * * * * ", // API needs cron + } + + _, err = client.GC.UpdateGCSchedule(ctx, &gc.UpdateGCScheduleParams{ + Schedule: &models.Schedule{ + Parameters: parameters, + Schedule: scheduleObj, + }, + }) + if err != nil { + // Fallback to Create if Update fails + _, err = client.GC.CreateGCSchedule(ctx, &gc.CreateGCScheduleParams{ + Schedule: &models.Schedule{ + Parameters: parameters, + Schedule: scheduleObj, + }, + }) + } + + return err +} diff --git a/pkg/views/gc/list/view.go b/pkg/views/gc/list/view.go new file mode 100644 index 000000000..99050ef4d --- /dev/null +++ b/pkg/views/gc/list/view.go @@ -0,0 +1,76 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package list + +import ( + "encoding/json" + "fmt" + "os" + "strings" + + "github.com/charmbracelet/bubbles/table" + tea "github.com/charmbracelet/bubbletea" + "github.com/goharbor/go-client/pkg/sdk/v2.0/models" + "github.com/goharbor/harbor-cli/pkg/utils" + "github.com/goharbor/harbor-cli/pkg/views/base/tablelist" +) + +var columns = []table.Column{ + {Title: "ID", Width: tablelist.WidthXS}, + {Title: "Job Name", Width: tablelist.WidthL}, + {Title: "Status", Width: tablelist.WidthM}, + {Title: "Kind", Width: tablelist.WidthM}, + {Title: "Parameters", Width: tablelist.WidthXL}, + {Title: "Creation Time", Width: tablelist.WidthXL}, +} + +func ListGCHistory(history []*models.GCHistory) { + var rows []table.Row + for _, run := range history { + createdTime, _ := utils.FormatCreatedTime(run.CreationTime.String()) + rows = append(rows, table.Row{ + fmt.Sprintf("%d", run.ID), + run.JobName, + run.JobStatus, + run.JobKind, + formatParams(run.JobParameters), + createdTime, + }) + } + + m := tablelist.NewModel(columns, rows, len(rows)) + + if _, err := tea.NewProgram(m).Run(); err != nil { + fmt.Println("Error running program:", err) + os.Exit(1) + } +} + +func formatParams(paramsStr string) string { + if paramsStr == "" { + return "-" + } + var m map[string]interface{} + if err := json.Unmarshal([]byte(paramsStr), &m); err != nil { + return paramsStr + } + var parts []string + for k, v := range m { + parts = append(parts, fmt.Sprintf("%s=%v", k, v)) + } + if len(parts) == 0 { + return "-" + } + return strings.Join(parts, ", ") +} diff --git a/pkg/views/gc/update/view.go b/pkg/views/gc/update/view.go new file mode 100644 index 000000000..7a67e932b --- /dev/null +++ b/pkg/views/gc/update/view.go @@ -0,0 +1,80 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package update + +import ( + "errors" + "fmt" + "regexp" + "strings" + + "github.com/charmbracelet/huh" + log "github.com/sirupsen/logrus" +) + +func EditGCSchedule(cron *string, deleteUntagged *bool, dryRun *bool, promptCron bool) { + theme := huh.ThemeCharm() + + var groups []*huh.Group + + if promptCron { + groups = append(groups, huh.NewGroup( + huh.NewInput(). + Title("Enter the cron expression"). + Description("Standard 6-field cron format: second minute hour day-of-month month day-of-week"). + Placeholder("0 0 0 * * *"). + Value(cron). + Validate(validateCronExpression), + )) + } + + groups = append(groups, huh.NewGroup( + huh.NewConfirm(). + Title("Delete untagged artifacts?"). + Description("If true, any untagged artifacts will be deleted during GC."). + Value(deleteUntagged), + huh.NewConfirm(). + Title("Dry run?"). + Description("If true, GC will simulate the cleanup process without deleting actual blobs."). + Value(dryRun), + )) + + err := huh.NewForm(groups...).WithTheme(theme).Run() + if err != nil { + log.Fatal(err) + } +} + +func validateCronExpression(cron string) error { + if cron == "" { + return errors.New("cron expression cannot be empty") + } + fields := strings.Fields(cron) + if len(fields) != 6 { + if len(fields) == 5 { + return fmt.Errorf("you entered a 5-field cron expression, but Harbor requires 6 fields (with seconds)\n"+ + "Please add a seconds field at the beginning. For example: '0 %s'", cron) + } + return fmt.Errorf("harbor requires exactly 6 fields in cron expressions (seconds minute hour day month weekday), got %d", len(fields)) + } + cronRegex := regexp.MustCompile(`^(\*|[0-9]|[1-5][0-9]|\*/[0-9]+) (\*|[0-9]|[1-5][0-9]|\*/[0-9]+) (\*|[0-9]|1[0-9]|2[0-3]|\*/[0-9]+) (\*|[1-9]|[12][0-9]|3[01]|\*/[0-9]+) (\*|[1-9]|1[0-2]|\*/[0-9]+) (\*|[0-6]|\*/[0-9]+)$`) + if !cronRegex.MatchString(cron) { + return errors.New("invalid cron expression format\n" + + "Examples:\n" + + " 0 0 0 * * * - Daily at midnight\n" + + " 0 0 */6 * * * - Every 6 hours\n" + + " 0 0 0 * * 0 - Weekly on Sunday at midnight") + } + return nil +} diff --git a/pkg/views/gc/view/view.go b/pkg/views/gc/view/view.go new file mode 100644 index 000000000..d573e478c --- /dev/null +++ b/pkg/views/gc/view/view.go @@ -0,0 +1,84 @@ +// Copyright Project Harbor Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +package view + +import ( + "encoding/json" + "fmt" + "os" + "strings" + + "github.com/charmbracelet/bubbles/table" + tea "github.com/charmbracelet/bubbletea" + "github.com/goharbor/go-client/pkg/sdk/v2.0/models" + "github.com/goharbor/harbor-cli/pkg/views/base/tablelist" +) + +var columns = []table.Column{ + {Title: "Type", Width: tablelist.WidthM}, + {Title: "Cron", Width: tablelist.WidthL}, + {Title: "Next Scheduled Time", Width: tablelist.WidthXXL}, + {Title: "Parameters", Width: tablelist.WidthXL}, +} + +func ViewGCSchedule(gcHistory *models.GCHistory) { + var rows []table.Row + var scheduleType, scheduleCron, nextScheduledTime string + if gcHistory != nil && gcHistory.Schedule != nil { + scheduleType = gcHistory.Schedule.Type + scheduleCron = gcHistory.Schedule.Cron + nextScheduledTime = gcHistory.Schedule.NextScheduledTime.String() + } else { + scheduleType = "None" + scheduleCron = "-" + nextScheduledTime = "-" + } + + paramsStr := "" + if gcHistory != nil { + paramsStr = gcHistory.JobParameters + } + + rows = append(rows, table.Row{ + scheduleType, + scheduleCron, + nextScheduledTime, + formatParams(paramsStr), + }) + + m := tablelist.NewModel(columns, rows, len(rows)) + + if _, err := tea.NewProgram(m).Run(); err != nil { + fmt.Println("Error running program:", err) + os.Exit(1) + } +} + +func formatParams(paramsStr string) string { + if paramsStr == "" { + return "-" + } + var m map[string]interface{} + if err := json.Unmarshal([]byte(paramsStr), &m); err != nil { + return paramsStr + } + var parts []string + for k, v := range m { + parts = append(parts, fmt.Sprintf("%s=%v", k, v)) + } + if len(parts) == 0 { + return "-" + } + return strings.Join(parts, ", ") +}