From b787f56c9d7d01349a690ad0411c47ba53407962 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Nov 2021 08:00:34 +0100 Subject: [PATCH] Bump github.com/xanzy/go-gitlab from 0.52.0 to 0.52.1 (#30) Bumps [github.com/xanzy/go-gitlab](https://github.com/xanzy/go-gitlab) from 0.52.0 to 0.52.1. - [Release notes](https://github.com/xanzy/go-gitlab/releases) - [Changelog](https://github.com/xanzy/go-gitlab/blob/master/releases_test.go) - [Commits](https://github.com/xanzy/go-gitlab/compare/v0.52.0...v0.52.1) --- updated-dependencies: - dependency-name: github.com/xanzy/go-gitlab dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 +- vendor/github.com/xanzy/go-gitlab/README.md | 2 + .../xanzy/go-gitlab/event_webhook_types.go | 15 +- .../xanzy/go-gitlab/generic_packages.go | 158 ++++++++++++++++++ vendor/github.com/xanzy/go-gitlab/gitlab.go | 2 + vendor/github.com/xanzy/go-gitlab/types.go | 33 ++++ vendor/modules.txt | 2 +- 8 files changed, 210 insertions(+), 8 deletions(-) create mode 100644 vendor/github.com/xanzy/go-gitlab/generic_packages.go diff --git a/go.mod b/go.mod index 5b1b714..e8c26a7 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/sj14/review-bot require ( github.com/google/go-github/v25 v25.1.3 github.com/stretchr/testify v1.7.0 - github.com/xanzy/go-gitlab v0.52.0 + github.com/xanzy/go-gitlab v0.52.1 golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288 ) diff --git a/go.sum b/go.sum index d82594c..d1263e9 100644 --- a/go.sum +++ b/go.sum @@ -20,8 +20,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/xanzy/go-gitlab v0.52.0 h1:OApYc2QN3/eA0G/1MpOgiix8XXp94UIZubrOhCTShG0= -github.com/xanzy/go-gitlab v0.52.0/go.mod h1:Q+hQhV508bDPoBijv7YjK/Lvlb4PhVhJdKqXVQrUoAE= +github.com/xanzy/go-gitlab v0.52.1 h1:RPXgQCA++WT5DivNYOys/HPb321fkei9HvEGluHtAiM= +github.com/xanzy/go-gitlab v0.52.1/go.mod h1:Q+hQhV508bDPoBijv7YjK/Lvlb4PhVhJdKqXVQrUoAE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= diff --git a/vendor/github.com/xanzy/go-gitlab/README.md b/vendor/github.com/xanzy/go-gitlab/README.md index 1df039a..568fffc 100644 --- a/vendor/github.com/xanzy/go-gitlab/README.md +++ b/vendor/github.com/xanzy/go-gitlab/README.md @@ -34,6 +34,7 @@ to add new and/or missing endpoints. Currently the following services are suppor - [x] Events - [x] Feature Flags - [ ] Geo Nodes +- [x] Generic Packages - [x] GitLab CI Config Templates - [x] Gitignores Templates - [x] Group Access Requests @@ -57,6 +58,7 @@ to add new and/or missing endpoints. Currently the following services are suppor - [x] Notes (comments) - [x] Notification Settings - [x] Open Source License Templates +- [x] Packages - [x] Pages - [x] Pages Domains - [x] Personal Access Tokens diff --git a/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go b/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go index 719e575..5f253e5 100644 --- a/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go +++ b/vendor/github.com/xanzy/go-gitlab/event_webhook_types.go @@ -698,15 +698,22 @@ type PipelineEvent struct { AllowFailure bool `json:"allow_failure"` User *EventUser `json:"user"` Runner struct { - ID int `json:"id"` - Description string `json:"description"` - Active bool `json:"active"` - IsShared bool `json:"is_shared"` + ID int `json:"id"` + Description string `json:"description"` + Active bool `json:"active"` + IsShared bool `json:"is_shared"` + RunnerType bool `json:"runner_type"` + Tags []string `json:"tags"` } `json:"runner"` ArtifactsFile struct { Filename string `json:"filename"` Size int `json:"size"` } `json:"artifacts_file"` + Environment struct { + Name string `json:"name"` + Action string `json:"action"` + DeploymentTier string `json:"deployment_tier"` + } `json:"environment"` } `json:"builds"` } diff --git a/vendor/github.com/xanzy/go-gitlab/generic_packages.go b/vendor/github.com/xanzy/go-gitlab/generic_packages.go new file mode 100644 index 0000000..ba875fa --- /dev/null +++ b/vendor/github.com/xanzy/go-gitlab/generic_packages.go @@ -0,0 +1,158 @@ +// +// Copyright 2021, Sune Keller +// +// 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 gitlab + +import ( + "bytes" + "fmt" + "io" + "net/http" + "time" +) + +// GenericPackagesService handles communication with the packages related +// methods of the GitLab API. +// +// GitLab docs: +// https://docs.gitlab.com/ee/user/packages/generic_packages/index.html +type GenericPackagesService struct { + client *Client +} + +// GenericPackagesFile represents a GitLab generic package file. +// +// GitLab API docs: +// https://docs.gitlab.com/ee/user/packages/generic_packages/index.html#publish-a-package-file +type GenericPackagesFile struct { + ID int `json:"id"` + PackageID int `json:"package_id"` + CreatedAt *time.Time `json:"created_at"` + UpdatedAt *time.Time `json:"updated_at"` + Size int `json:"size"` + FileStore int `json:"file_store"` + FileMD5 string `json:"file_md5"` + FileSHA1 string `json:"file_sha1"` + FileName string `json:"file_name"` + File struct { + URL string `json:"url"` + } `json:"file"` + FileSHA256 string `json:"file_sha256"` + VerificationRetryAt *time.Time `json:"verification_retry_at"` + VerifiedAt *time.Time `json:"verified_at"` + VerificationFailure bool `json:"verification_failure"` + VerificationRetryCount int `json:"verification_retry_count"` + VerificationChecksum string `json:"verification_checksum"` + VerificationState int `json:"verification_state"` + VerificationStartedAt *time.Time `json:"verification_started_at"` + NewFilePath string `json:"new_file_path"` +} + +// FormatPackageURL returns the GitLab Package Registry URL for the given artifact metadata, without the BaseURL. +// This does not make a GitLab API request, but rather computes it based on their documentation. +func (s *GenericPackagesService) FormatPackageURL(pid interface{}, packageName, packageVersion, fileName string) (string, error) { + project, err := parseID(pid) + if err != nil { + return "", err + } + u := fmt.Sprintf( + "projects/%s/packages/generic/%s/%s/%s", + pathEscape(project), + pathEscape(packageName), + pathEscape(packageVersion), + pathEscape(fileName), + ) + return u, nil +} + +// PublishPackageFileOptions represents the available PublishPackageFile() +// options. +// +// GitLab docs: +// https://docs.gitlab.com/ee/user/packages/generic_packages/index.html#publish-a-package-file +type PublishPackageFileOptions struct { + Status *GenericPackageStatusValue `url:"status,omitempty" json:"status,omitempty"` + Select *GenericPackageSelectValue `url:"select,omitempty" json:"select,omitempty"` +} + +// PublishPackageFile uploads a file to a project's package registry. +// +// GitLab docs: +// https://docs.gitlab.com/ee/user/packages/generic_packages/index.html#publish-a-package-file +func (s *GenericPackagesService) PublishPackageFile(pid interface{}, packageName, packageVersion, fileName string, content io.Reader, opt *PublishPackageFileOptions, options ...RequestOptionFunc) (*GenericPackagesFile, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf( + "projects/%s/packages/generic/%s/%s/%s", + pathEscape(project), + pathEscape(packageName), + pathEscape(packageVersion), + pathEscape(fileName), + ) + + // We need to create the request as a GET request to make sure the options + // are set correctly. After the request is created we will overwrite both + // the method and the body. + req, err := s.client.NewRequest(http.MethodGet, u, opt, options) + if err != nil { + return nil, nil, err + } + + // Overwrite the method and body. + req.Method = http.MethodPut + req.SetBody(content) + + f := new(GenericPackagesFile) + resp, err := s.client.Do(req, f) + if err != nil { + return nil, resp, err + } + + return f, resp, err +} + +// DownloadPackageFile allows you to download the package file. +// +// GitLab docs: +// https://docs.gitlab.com/ee/user/packages/generic_packages/index.html#download-package-file +func (s *GenericPackagesService) DownloadPackageFile(pid interface{}, packageName, packageVersion, fileName string, options ...RequestOptionFunc) ([]byte, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf( + "projects/%s/packages/generic/%s/%s/%s", + pathEscape(project), + pathEscape(packageName), + pathEscape(packageVersion), + pathEscape(fileName), + ) + + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) + if err != nil { + return nil, nil, err + } + + var f bytes.Buffer + resp, err := s.client.Do(req, &f) + if err != nil { + return nil, resp, err + } + + return f.Bytes(), resp, err +} diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index 5f585cb..ddfee94 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -122,6 +122,7 @@ type Client struct { ExternalStatusChecks *ExternalStatusChecksService Features *FeaturesService FreezePeriods *FreezePeriodsService + GenericPackages *GenericPackagesService GeoNodes *GeoNodesService GitIgnoreTemplates *GitIgnoreTemplatesService GroupBadges *GroupBadgesService @@ -312,6 +313,7 @@ func newClient(options ...ClientOptionFunc) (*Client, error) { c.ExternalStatusChecks = &ExternalStatusChecksService{client: c} c.Features = &FeaturesService{client: c} c.FreezePeriods = &FreezePeriodsService{client: c} + c.GenericPackages = &GenericPackagesService{client: c} c.GeoNodes = &GeoNodesService{client: c} c.GitIgnoreTemplates = &GitIgnoreTemplatesService{client: c} c.GroupBadges = &GroupBadgesService{client: c} diff --git a/vendor/github.com/xanzy/go-gitlab/types.go b/vendor/github.com/xanzy/go-gitlab/types.go index 9b95aad..679cb9e 100644 --- a/vendor/github.com/xanzy/go-gitlab/types.go +++ b/vendor/github.com/xanzy/go-gitlab/types.go @@ -199,6 +199,39 @@ func FileAction(v FileActionValue) *FileActionValue { return p } +// GenericPackageSelectValue represents a generic package select value. +type GenericPackageSelectValue string + +// The available generic package select values. +const ( + SelectPackageFile GenericPackageSelectValue = "package_file" +) + +// GenericPackageSelect is a helper routine that allocates a new +// GenericPackageSelectValue value to store v and returns a pointer to it. +func GenericPackageSelect(v GenericPackageSelectValue) *GenericPackageSelectValue { + p := new(GenericPackageSelectValue) + *p = v + return p +} + +// GenericPackageStatusValue represents a generic package status. +type GenericPackageStatusValue string + +// The available generic package statuses. +const ( + PackageDefault GenericPackageStatusValue = "default" + PackageHidden GenericPackageStatusValue = "hidden" +) + +// GenericPackageStatus is a helper routine that allocates a new +// GenericPackageStatusValue value to store v and returns a pointer to it. +func GenericPackageStatus(v GenericPackageStatusValue) *GenericPackageStatusValue { + p := new(GenericPackageStatusValue) + *p = v + return p +} + // ISOTime represents an ISO 8601 formatted date type ISOTime time.Time diff --git a/vendor/modules.txt b/vendor/modules.txt index 25ada01..7873c4d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -15,7 +15,7 @@ github.com/pmezard/go-difflib/difflib # github.com/stretchr/testify v1.7.0 github.com/stretchr/testify/assert github.com/stretchr/testify/require -# github.com/xanzy/go-gitlab v0.52.0 +# github.com/xanzy/go-gitlab v0.52.1 github.com/xanzy/go-gitlab # golang.org/x/net v0.0.0-20201021035429-f5854403a974 golang.org/x/net/context