Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: xanzy/go-gitlab
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.87.0
Choose a base ref
...
head repository: xanzy/go-gitlab
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.88.0
Choose a head ref
  • 9 commits
  • 8 files changed
  • 3 contributors

Commits on Jul 19, 2023

  1. Add snippet repository storage move APIs

    nwestbury committed Jul 19, 2023
    Copy the full SHA
    86dd632 View commit details
  2. Use separate options for each schedule

    nwestbury committed Jul 19, 2023
    Copy the full SHA
    f2c344c View commit details
  3. Update tests

    nwestbury committed Jul 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    852645c View commit details
  4. Copy the full SHA
    89486a0 View commit details

Commits on Jul 20, 2023

  1. Copy the full SHA
    a42af85 View commit details
  2. Merge pull request #1759 from PatrickRice-KSC/add-missing-housekeepin…

    …g-setting
    
    Add missing `housekeeping_optimize_repository_period` setting
    svanharmelen authored Jul 20, 2023
    Copy the full SHA
    a4d27d6 View commit details
  3. Copy the full SHA
    ddb5ca0 View commit details
  4. Merge pull request #1758 from billiechar/billiechar-snippet-moves

    Add snippet repository storage move APIs
    svanharmelen authored Jul 20, 2023
    Copy the full SHA
    2ac3eea View commit details
  5. Update pipeline tests

    svanharmelen committed Jul 20, 2023
    Copy the full SHA
    7e3c23c View commit details
Showing with 489 additions and 60 deletions.
  1. +2 −0 gitlab.go
  2. +1 −1 pipelines.go
  3. +11 −4 pipelines_test.go
  4. +50 −53 project_repository_storage_move.go
  5. +2 −0 settings.go
  6. +203 −0 snippet_repository_storage_move.go
  7. +215 −0 snippet_repository_storage_move_test.go
  8. +5 −2 testdata/get_pipeline_testreport.json
2 changes: 2 additions & 0 deletions gitlab.go
Original file line number Diff line number Diff line change
@@ -206,6 +206,7 @@ type Client struct {
Services *ServicesService
Settings *SettingsService
Sidekiq *SidekiqService
SnippetRepositoryStorageMove *SnippetRepositoryStorageMoveService
Snippets *SnippetsService
SystemHooks *SystemHooksService
Tags *TagsService
@@ -425,6 +426,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) {
c.Settings = &SettingsService{client: c}
c.Sidekiq = &SidekiqService{client: c}
c.Snippets = &SnippetsService{client: c}
c.SnippetRepositoryStorageMove = &SnippetRepositoryStorageMoveService{client: c}
c.SystemHooks = &SystemHooksService{client: c}
c.Tags = &TagsService{client: c}
c.Todos = &TodosService{client: c}
2 changes: 1 addition & 1 deletion pipelines.go
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ type PipelineTestCases struct {
Classname string `json:"classname"`
File string `json:"file"`
ExecutionTime float64 `json:"execution_time"`
SystemOutput string `json:"system_output"`
SystemOutput interface{} `json:"system_output"`
StackTrace string `json:"stack_trace"`
AttachmentURL string `json:"attachment_url"`
RecentFailures *RecentFailures `json:"recent_failures"`
15 changes: 11 additions & 4 deletions pipelines_test.go
Original file line number Diff line number Diff line change
@@ -128,12 +128,19 @@ func TestGetPipelineTestReport(t *testing.T) {
Name: "Error testcase 2",
Classname: "MyClass",
ExecutionTime: 19.984,
SystemOutput: map[string]interface{}{
"message": "Failed test",
"type": "MultipleExceptionError",
},
},
{
Status: "error",
Name: "Error testcase 3",
Classname: "MyClass",
SystemOutput: "Failed test",
Status: "error",
Name: "Error testcase 3",
Classname: "MyClass",
SystemOutput: []interface{}{
"Failed test a",
"Failed test b",
},
},
{
Status: "success",
103 changes: 50 additions & 53 deletions project_repository_storage_move.go
Original file line number Diff line number Diff line change
@@ -36,41 +36,44 @@ type ProjectRepositoryStorageMoveService struct {
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html
type ProjectRepositoryStorageMove struct {
ID int `json:"id"`
CreatedAt *time.Time `json:"created_at"`
State string `json:"state"`
SourceStorageName string `json:"source_storage_name"`
DestinationStorageName string `json:"destination_storage_name"`
Project struct {
ID int `json:"id"`
Description string `json:"description"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
CreatedAt *time.Time `json:"created_at"`
} `json:"project"`
ID int `json:"id"`
CreatedAt *time.Time `json:"created_at"`
State string `json:"state"`
SourceStorageName string `json:"source_storage_name"`
DestinationStorageName string `json:"destination_storage_name"`
Project *RepositoryProject `json:"project"`
}

// RetrieveAllStorageMovesOptions represents the available
type RepositoryProject struct {
ID int `json:"id"`
Description string `json:"description"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
CreatedAt *time.Time `json:"created_at"`
}

// RetrieveAllProjectStorageMovesOptions represents the available
// RetrieveAllStorageMoves() options.
//
// GitLab API docs: https://docs.gitlab.com/ee/api/project_repository_storage_moves.html
type RetrieveAllStorageMovesOptions ListOptions
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html
type RetrieveAllProjectStorageMovesOptions ListOptions

// RetrieveAllStorageMoves retrieves all repository storage moves accessible by
// the authenticated user.
// RetrieveAllStorageMoves retrieves all project repository storage moves
// accessible by the authenticated user.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#retrieve-all-project-repository-storage-moves
func (s ProjectRepositoryStorageMoveService) RetrieveAllStorageMoves(opts RetrieveAllStorageMovesOptions, options ...RequestOptionFunc) ([]*ProjectRepositoryStorageMove, *Response, error) {
req, err := s.client.NewRequest(http.MethodGet, "project_repository_storage_moves", opts, options)
func (p ProjectRepositoryStorageMoveService) RetrieveAllStorageMoves(opts RetrieveAllProjectStorageMovesOptions, options ...RequestOptionFunc) ([]*ProjectRepositoryStorageMove, *Response, error) {
req, err := p.client.NewRequest(http.MethodGet, "project_repository_storage_moves", opts, options)
if err != nil {
return nil, nil, err
}

var psms []*ProjectRepositoryStorageMove
resp, err := s.client.Do(req, &psms)
resp, err := p.client.Do(req, &psms)
if err != nil {
return nil, resp, err
}
@@ -83,37 +86,37 @@ func (s ProjectRepositoryStorageMoveService) RetrieveAllStorageMoves(opts Retrie
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#retrieve-all-repository-storage-moves-for-a-project
func (s ProjectRepositoryStorageMoveService) RetrieveAllStorageMovesForProject(project int, opts RetrieveAllStorageMovesOptions, options ...RequestOptionFunc) ([]*ProjectRepositoryStorageMove, *Response, error) {
func (p ProjectRepositoryStorageMoveService) RetrieveAllStorageMovesForProject(project int, opts RetrieveAllProjectStorageMovesOptions, options ...RequestOptionFunc) ([]*ProjectRepositoryStorageMove, *Response, error) {
u := fmt.Sprintf("projects/%d/repository_storage_moves", project)

req, err := s.client.NewRequest(http.MethodGet, u, opts, options)
req, err := p.client.NewRequest(http.MethodGet, u, opts, options)
if err != nil {
return nil, nil, err
}

var psms []*ProjectRepositoryStorageMove
resp, err := s.client.Do(req, &psms)
resp, err := p.client.Do(req, &psms)
if err != nil {
return nil, resp, err
}

return psms, resp, err
}

// GetStorageMove gets a single repository storage move.
// GetStorageMove gets a single project repository storage move.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#get-a-single-project-repository-storage-move
func (s ProjectRepositoryStorageMoveService) GetStorageMove(repositoryStorage int, options ...RequestOptionFunc) (*ProjectRepositoryStorageMove, *Response, error) {
func (p ProjectRepositoryStorageMoveService) GetStorageMove(repositoryStorage int, options ...RequestOptionFunc) (*ProjectRepositoryStorageMove, *Response, error) {
u := fmt.Sprintf("project_repository_storage_moves/%d", repositoryStorage)

req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
req, err := p.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

psm := new(ProjectRepositoryStorageMove)
resp, err := s.client.Do(req, psm)
resp, err := p.client.Do(req, psm)
if err != nil {
return nil, resp, err
}
@@ -125,59 +128,53 @@ func (s ProjectRepositoryStorageMoveService) GetStorageMove(repositoryStorage in
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#get-a-single-repository-storage-move-for-a-project
func (s ProjectRepositoryStorageMoveService) GetStorageMoveForProject(project int, repositoryStorage int, options ...RequestOptionFunc) (*ProjectRepositoryStorageMove, *Response, error) {
func (p ProjectRepositoryStorageMoveService) GetStorageMoveForProject(project int, repositoryStorage int, options ...RequestOptionFunc) (*ProjectRepositoryStorageMove, *Response, error) {
u := fmt.Sprintf("projects/%d/repository_storage_moves/%d", project, repositoryStorage)

req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
req, err := p.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}

psm := new(ProjectRepositoryStorageMove)
resp, err := s.client.Do(req, psm)
resp, err := p.client.Do(req, psm)
if err != nil {
return nil, resp, err
}

return psm, resp, err
}

// ScheduleAllStorageMoves schedules all repositories to be moved.
// ScheduleStorageMoveForProject schedule a repository to be moved for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#schedule-repository-storage-moves-for-all-projects-on-a-storage-shard
func (s ProjectRepositoryStorageMoveService) ScheduleAllStorageMoves(options ...RequestOptionFunc) ([]*ProjectRepositoryStorageMove, *Response, error) {
req, err := s.client.NewRequest(http.MethodPost, "project_repository_storage_moves", nil, options)
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#schedule-a-repository-storage-move-for-a-project
func (p ProjectRepositoryStorageMoveService) ScheduleStorageMoveForProject(project int, options ...RequestOptionFunc) (*ProjectRepositoryStorageMove, *Response, error) {
u := fmt.Sprintf("projects/%d/repository_storage_moves", project)

req, err := p.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}

var psms []*ProjectRepositoryStorageMove
resp, err := s.client.Do(req, &psms)
psm := new(ProjectRepositoryStorageMove)
resp, err := p.client.Do(req, psm)
if err != nil {
return nil, resp, err
}

return psms, resp, err
return psm, resp, err
}

// ScheduleStorageMoveForProject schedule a repository to be moved for a project.
// ScheduleAllStorageMoves schedules all repositories to be moved.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#schedule-a-repository-storage-move-for-a-project
func (s ProjectRepositoryStorageMoveService) ScheduleStorageMoveForProject(project int, options ...RequestOptionFunc) (*ProjectRepositoryStorageMove, *Response, error) {
u := fmt.Sprintf("projects/%d/repository_storage_moves", project)

req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
if err != nil {
return nil, nil, err
}

psm := new(ProjectRepositoryStorageMove)
resp, err := s.client.Do(req, psm)
// https://docs.gitlab.com/ee/api/project_repository_storage_moves.html#schedule-repository-storage-moves-for-all-projects-on-a-storage-shard
func (p ProjectRepositoryStorageMoveService) ScheduleAllStorageMoves(options ...RequestOptionFunc) (*Response, error) {
req, err := p.client.NewRequest(http.MethodPost, "project_repository_storage_moves", nil, options)
if err != nil {
return nil, resp, err
return nil, err
}

return psm, resp, err
return p.client.Do(req, nil)
}
2 changes: 2 additions & 0 deletions settings.go
Original file line number Diff line number Diff line change
@@ -189,6 +189,7 @@ type Settings struct {
HousekeepingFullRepackPeriod int `json:"housekeeping_full_repack_period"`
HousekeepingGcPeriod int `json:"housekeeping_gc_period"`
HousekeepingIncrementalRepackPeriod int `json:"housekeeping_incremental_repack_period"`
HousekeepingOptimizeRepositoryPeriod int `json:"housekeeping_optimize_repository_period"`
ImportSources []string `json:"import_sources"`
InactiveProjectsDeleteAfterMonths int `json:"inactive_projects_delete_after_months"`
InactiveProjectsMinSizeMB int `json:"inactive_projects_min_size_mb"`
@@ -567,6 +568,7 @@ type UpdateSettingsOptions struct {
HousekeepingFullRepackPeriod *int `url:"housekeeping_full_repack_period,omitempty" json:"housekeeping_full_repack_period,omitempty"`
HousekeepingGcPeriod *int `url:"housekeeping_gc_period,omitempty" json:"housekeeping_gc_period,omitempty"`
HousekeepingIncrementalRepackPeriod *int `url:"housekeeping_incremental_repack_period,omitempty" json:"housekeeping_incremental_repack_period,omitempty"`
HousekeepingOptimizedepositoryPeriod *int `url:"housekeeping_optimize_repository_period,omitempty" json:"housekeeping_optimize_repository_period,omitempty"`
ImportSources *[]string `url:"import_sources,omitempty" json:"import_sources,omitempty"`
InactiveProjectsDeleteAfterMonths *int `url:"inactive_projects_delete_after_months,omitempty" json:"inactive_projects_delete_after_months,omitempty"`
InactiveProjectsMinSizeMB *int `url:"inactive_projects_min_size_mb,omitempty" json:"inactive_projects_min_size_mb,omitempty"`
Loading