From 21ef21a93e29fb90dfa65176d35d58bdec0ff0ee Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Wed, 30 Aug 2023 10:27:47 -0400 Subject: [PATCH 1/4] chore(webhook): improve on some comments during the webhook flow (#944) * fix(webhook): repo archive/unarchive interacts with SCM webhook + bonus comment updates * revert archive changes * more comments --------- Co-authored-by: David May <1301201+wass3r@users.noreply.github.com> --- api/build/executable.go | 1 + api/build/publish.go | 10 ++++++++-- api/webhook/post.go | 19 ++++++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/api/build/executable.go b/api/build/executable.go index 9df63467d..17ca1c082 100644 --- a/api/build/executable.go +++ b/api/build/executable.go @@ -82,6 +82,7 @@ func GetBuildExecutable(c *gin.Context) { "subject": cl.Subject, }).Infof("reading build executable %s/%d", r.GetFullName(), b.GetNumber()) + // send database call to pop the requested build executable from the table bExecutable, err := database.FromContext(c).PopBuildExecutable(ctx, b.GetID()) if err != nil { retErr := fmt.Errorf("unable to pop build executable: %w", err) diff --git a/api/build/publish.go b/api/build/publish.go index 51f94cff2..3cf20ff02 100644 --- a/api/build/publish.go +++ b/api/build/publish.go @@ -17,9 +17,10 @@ import ( "github.com/sirupsen/logrus" ) -// PublishToQueue is a helper function that creates -// a build item and publishes it to the queue. +// PublishToQueue is a helper function that pushes the build executable to the database +// and publishes a queue item (build, repo, user) to the queue. func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interface, p *pipeline.Build, b *library.Build, r *library.Repo, u *library.User) { + // marshal pipeline build into byte data to add to the build executable object byteExecutable, err := json.Marshal(p) if err != nil { logrus.Errorf("Failed to marshal build executable %d for %s: %v", b.GetNumber(), r.GetFullName(), err) @@ -30,10 +31,12 @@ func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interf return } + // create build executable to push to database bExecutable := new(library.BuildExecutable) bExecutable.SetBuildID(b.GetID()) bExecutable.SetData(byteExecutable) + // send database call to create a build executable err = db.CreateBuildExecutable(ctx, bExecutable) if err != nil { logrus.Errorf("Failed to publish build executable to database %d for %s: %v", b.GetNumber(), r.GetFullName(), err) @@ -44,6 +47,7 @@ func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interf return } + // convert build, repo, and user into queue item item := types.ToItem(b, r, u) logrus.Infof("Converting queue item to json for build %d for %s", b.GetNumber(), r.GetFullName()) @@ -60,6 +64,7 @@ func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interf logrus.Infof("Establishing route for build %d for %s", b.GetNumber(), r.GetFullName()) + // determine the route on which to publish the queue item route, err := queue.Route(&p.Worker) if err != nil { logrus.Errorf("unable to set route for build %d for %s: %v", b.GetNumber(), r.GetFullName(), err) @@ -72,6 +77,7 @@ func PublishToQueue(ctx context.Context, queue queue.Service, db database.Interf logrus.Infof("Publishing item for build %d for %s to queue %s", b.GetNumber(), r.GetFullName(), route) + // push item on to the queue err = queue.Push(context.Background(), route, byteItem) if err != nil { logrus.Errorf("Retrying; Failed to publish build %d for %s: %v", b.GetNumber(), r.GetFullName(), err) diff --git a/api/webhook/post.go b/api/webhook/post.go index b3d0fd3b3..e0ef95223 100644 --- a/api/webhook/post.go +++ b/api/webhook/post.go @@ -113,7 +113,8 @@ func PostWebhook(c *gin.Context) { // -------------------- End of TODO: -------------------- // process the webhook from the source control provider - // comment, number, h, r, b + // + // populate build, hook, repo resources as well as PR Number / PR Comment if necessary webhook, err := scm.FromContext(c).ProcessWebhook(c.Request) if err != nil { retErr := fmt.Errorf("unable to parse webhook: %w", err) @@ -142,7 +143,7 @@ func PostWebhook(c *gin.Context) { return } - // if there were actual changes to the repo, return the repo object + // if there were actual changes to the repo (database call populated ID field), return the repo object if r.GetID() != 0 { c.JSON(http.StatusOK, r) return @@ -345,7 +346,8 @@ func PostWebhook(c *gin.Context) { logrus.Debug("updating status to pending") b.SetStatus(constants.StatusPending) - // if this is a comment on a pull_request event + // if the event is issue_comment and the issue is a pull request, + // call SCM for more data not provided in webhook payload if strings.EqualFold(b.GetEvent(), constants.EventComment) && webhook.PRNumber > 0 { commit, branch, baseref, headref, err := scm.FromContext(c).GetPullRequest(u, repo, webhook.PRNumber) if err != nil { @@ -366,6 +368,7 @@ func PostWebhook(c *gin.Context) { // variable to store changeset files var files []string + // check if the build event is not issue_comment or pull_request if !strings.EqualFold(b.GetEvent(), constants.EventComment) && !strings.EqualFold(b.GetEvent(), constants.EventPull) { @@ -423,7 +426,7 @@ func PostWebhook(c *gin.Context) { time.Sleep(time.Duration(i) * time.Second) } - // send API call to attempt to capture the pipeline + // send database call to attempt to capture the pipeline if we already processed it before pipeline, err = database.FromContext(c).GetPipelineForRepo(ctx, b.GetCommit(), repo) if err != nil { // assume the pipeline doesn't exist in the database yet // send API call to capture the pipeline configuration file @@ -463,7 +466,7 @@ func PostWebhook(c *gin.Context) { return } - // update repo fields with any changes from SCM process + // update DB record of repo (repo) with any changes captured from webhook payload (r) repo.SetTopics(r.GetTopics()) repo.SetBranch(r.GetBranch()) @@ -525,7 +528,7 @@ func PostWebhook(c *gin.Context) { // before compiling. After we're done compiling, we reset the pipeline type. repo.SetPipelineType(pipelineType) - // skip the build if only the init or clone steps are found + // skip the build if pipeline compiled to only the init and clone steps skip := build.SkipEmptyBuild(p) if skip != "" { // set build to successful status @@ -678,6 +681,8 @@ func PostWebhook(c *gin.Context) { ) } +// handleRepositoryEvent is a helper function that processes repository events from the SCM and updates +// the database resources with any relevant changes resulting from the event, such as name changes, transfers, etc. func handleRepositoryEvent(ctx context.Context, c *gin.Context, m *types.Metadata, h *library.Hook, r *library.Repo) (*library.Repo, error) { logrus.Debugf("webhook is repository event, making necessary updates to repo %s", r.GetFullName()) @@ -690,7 +695,7 @@ func handleRepositoryEvent(ctx context.Context, c *gin.Context, m *types.Metadat }() switch h.GetEventAction() { - // if action is rename, go through rename routine + // if action is renamed or transferred, go through rename routine case constants.ActionRenamed, constants.ActionTransferred: r, err := renameRepository(ctx, h, r, c, m) if err != nil { From c8499cd2c66a34c399fc5d5ec2897c04f982dc04 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:35:48 -0500 Subject: [PATCH 2/4] chore(deps): update all non-major dependencies (#925) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/integration-test.yml | 2 +- Dockerfile | 2 +- Dockerfile-alpine | 2 +- go.mod | 39 ++++++------- go.sum | 81 +++++++++++++------------- 5 files changed, 62 insertions(+), 64 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 655ec6c0e..d339d45f6 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -15,7 +15,7 @@ jobs: services: postgres: - image: postgres:15-alpine + image: postgres:15-alpine@sha256:8bc3c893342c766481df5fde58fab6f1a1115b94eb56778126163305243e9709 env: POSTGRES_DB: vela POSTGRES_PASSWORD: notARealPassword12345 diff --git a/Dockerfile b/Dockerfile index 79beef6fb..8f86431d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # # Use of this source code is governed by the LICENSE file in this repository. -FROM alpine:3.18.2@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70 as certs +FROM alpine:3.18.3@sha256:c5c5fda71656f28e49ac9c5416b3643eaa6a108a8093151d6d1afc9463be8e33 as certs RUN apk add --update --no-cache ca-certificates diff --git a/Dockerfile-alpine b/Dockerfile-alpine index 38ce8fded..894752491 100644 --- a/Dockerfile-alpine +++ b/Dockerfile-alpine @@ -2,7 +2,7 @@ # # Use of this source code is governed by the LICENSE file in this repository. -FROM alpine:3.18.2@sha256:25fad2a32ad1f6f510e528448ae1ec69a28ef81916a004d3629874104f8a7f70 +FROM alpine:3.18.3@sha256:c5c5fda71656f28e49ac9c5416b3643eaa6a108a8093151d6d1afc9463be8e33 RUN apk add --update --no-cache ca-certificates diff --git a/go.mod b/go.mod index 788f5cdb0..99659d352 100644 --- a/go.mod +++ b/go.mod @@ -7,9 +7,9 @@ require ( github.com/DATA-DOG/go-sqlmock v1.5.0 github.com/Masterminds/semver/v3 v3.2.1 github.com/Masterminds/sprig/v3 v3.2.3 - github.com/adhocore/gronx v1.6.4 - github.com/alicebob/miniredis/v2 v2.30.4 - github.com/aws/aws-sdk-go v1.44.309 + github.com/adhocore/gronx v1.6.5 + github.com/alicebob/miniredis/v2 v2.30.5 + github.com/aws/aws-sdk-go v1.44.334 github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3 github.com/drone/envsubst v1.0.3 github.com/gin-gonic/gin v1.9.1 @@ -18,7 +18,7 @@ require ( github.com/golang-jwt/jwt/v5 v5.0.0 github.com/google/go-cmp v0.5.9 github.com/google/go-github/v53 v53.2.0 - github.com/google/uuid v1.3.0 + github.com/google/uuid v1.3.1 github.com/goware/urlx v0.3.2 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-multierror v1.1.1 @@ -27,19 +27,19 @@ require ( github.com/joho/godotenv v1.5.1 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.16.0 - github.com/redis/go-redis/v9 v9.0.5 + github.com/redis/go-redis/v9 v9.1.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/afero v1.9.5 github.com/urfave/cli/v2 v2.25.7 - go.starlark.net v0.0.0-20230725161458-0d7263928a74 - golang.org/x/crypto v0.11.0 - golang.org/x/oauth2 v0.9.0 + go.starlark.net v0.0.0-20230829175125-68633c9954b0 + golang.org/x/crypto v0.12.0 + golang.org/x/oauth2 v0.11.0 golang.org/x/sync v0.3.0 gopkg.in/square/go-jose.v2 v2.6.0 gorm.io/driver/postgres v1.5.2 - gorm.io/driver/sqlite v1.5.2 - gorm.io/gorm v1.25.2 - k8s.io/apimachinery v0.27.4 + gorm.io/driver/sqlite v1.5.3 + gorm.io/gorm v1.25.4 + k8s.io/apimachinery v0.28.1 ) require ( @@ -62,7 +62,7 @@ require ( github.com/ghodss/yaml v1.0.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-jose/go-jose/v3 v3.0.0 // indirect - github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/logr v1.2.4 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect @@ -107,7 +107,6 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/shopspring/decimal v1.2.0 // indirect @@ -117,14 +116,14 @@ require ( github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yuin/gopher-lua v1.1.0 // indirect golang.org/x/arch v0.3.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect - golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect + golang.org/x/net v0.14.0 // indirect + golang.org/x/sys v0.11.0 // indirect + golang.org/x/text v0.12.0 // indirect + golang.org/x/time v0.3.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/klog/v2 v2.90.1 // indirect - k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + k8s.io/klog/v2 v2.100.1 // indirect + k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect ) diff --git a/go.sum b/go.sum index f109e9873..9d98de207 100644 --- a/go.sum +++ b/go.sum @@ -57,23 +57,23 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/adhocore/gronx v1.6.4 h1:Bx5cNRVQsGquOOUJL3+2M5vlz1KCCMHrCECwb5UghNU= -github.com/adhocore/gronx v1.6.4/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= +github.com/adhocore/gronx v1.6.5 h1:/pryEagBKz3WqUgpgvtL51eBN2rJLXowuW7rpS+jrew= +github.com/adhocore/gronx v1.6.5/go.mod h1:7oUY1WAU8rEJWmAxXR2DN0JaO4gi9khSgKjiRypqteg= github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZpUGpz5+4FfNmIU+FmZg2P3Xaj2v2bfNWmk= github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= github.com/alicebob/miniredis/v2 v2.11.1/go.mod h1:UA48pmi7aSazcGAvcdKcBB49z521IC9VjTTRz2nIaJE= -github.com/alicebob/miniredis/v2 v2.30.4 h1:8S4/o1/KoUArAGbGwPxcwf0krlzceva2XVOSchFS7Eo= -github.com/alicebob/miniredis/v2 v2.30.4/go.mod h1:b25qWj4fCEsBeAAR2mlb0ufImGC6uH3VlUfb/HS5zKg= +github.com/alicebob/miniredis/v2 v2.30.5 h1:3r6kTHdKnuP4fkS8k2IrvSfxpxUTcW1SOL0wN7b7Dt0= +github.com/alicebob/miniredis/v2 v2.30.5/go.mod h1:b25qWj4fCEsBeAAR2mlb0ufImGC6uH3VlUfb/HS5zKg= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= -github.com/aws/aws-sdk-go v1.44.309 h1:IPJOFBzXekakxmEpDwd4RTKmmBR6LIAiXgNsM51bWbU= -github.com/aws/aws-sdk-go v1.44.309/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.334 h1:h2bdbGb//fez6Sv6PaYv868s9liDeoYM6hYsAqTB4MU= +github.com/aws/aws-sdk-go v1.44.334/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bsm/ginkgo/v2 v2.7.0 h1:ItPMPH90RbmZJt5GtkcNvIRuGEdwlBItdNVoyzaNQao= +github.com/bsm/ginkgo/v2 v2.9.5 h1:rtVBYPs3+TC5iLUVOis1B9tjLTup7Cj5IfzosKtvTJ0= github.com/bsm/gomega v1.26.0 h1:LhQm+AFcgV2M0WyKroMASzAzCAJVpAxQXv4SaI9a69Y= github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3 h1:q+sMKdA6L8LyGVudTkpGoC73h6ak2iWSPFiFo/pFOU8= github.com/buildkite/yaml v0.0.0-20181016232759-0caa5f0796e3/go.mod h1:5hCug3EZaHXU3FdCA3gJm0YTNi+V+ooA2qNTiVpky4A= @@ -132,8 +132,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-jose/go-jose/v3 v3.0.0 h1:s6rrhirfEP/CGIoc6p+PZAeogN2SxKav6Wp7+dyMWVo= github.com/go-jose/go-jose/v3 v3.0.0/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= @@ -219,8 +219,8 @@ github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= @@ -346,11 +346,10 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/redis/go-redis/v9 v9.0.5 h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl5o= -github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= +github.com/redis/go-redis/v9 v9.1.0 h1:137FnGdk+EQdCbye1FW+qOEcY5S+SpY9T0NiuqvtfMY= +github.com/redis/go-redis/v9 v9.1.0/go.mod h1:urWj3He21Dj5k4TK1y59xH8Uj6ATueP8AH1cY3lZl4c= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= @@ -402,8 +401,8 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.starlark.net v0.0.0-20230725161458-0d7263928a74 h1:EL8MuNFlzO8vvpHgZxDGPaehP0ozoJ1j1zA768zKXUQ= -go.starlark.net v0.0.0-20230725161458-0d7263928a74/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= +go.starlark.net v0.0.0-20230829175125-68633c9954b0 h1:mr0wY3kXIH4jJZPj1HYmK35saEoo+2aQkdD1Dh/IssM= +go.starlark.net v0.0.0-20230829175125-68633c9954b0/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= @@ -417,8 +416,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk= +golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -488,8 +487,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= +golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -499,8 +498,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.9.0 h1:BPpt2kU7oMRq3kCHAA1tbSEshXRw1LpG2ztgDwrzuAs= -golang.org/x/oauth2 v0.9.0/go.mod h1:qYgFZaFiu6Wg24azG8bdV52QJXJGbZzIIsRCdVKzbLw= +golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= +golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -560,8 +559,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= +golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -576,13 +575,13 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= +golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 h1:vVKdlvoWBphwdxWKrFZEuM0kGgGLxUOYcY4U/2Vjg44= -golang.org/x/time v0.0.0-20220210224613-90d013bbcef8/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -728,8 +727,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -746,10 +745,10 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0= gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8= -gorm.io/driver/sqlite v1.5.2 h1:TpQ+/dqCY4uCigCFyrfnrJnrW9zjpelWVoEVNy5qJkc= -gorm.io/driver/sqlite v1.5.2/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= -gorm.io/gorm v1.25.2 h1:gs1o6Vsa+oVKG/a9ElL3XgyGfghFfkKA2SInQaCyMho= -gorm.io/gorm v1.25.2/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= +gorm.io/driver/sqlite v1.5.3 h1:7/0dUgX28KAcopdfbRWWl68Rflh6osa4rDh+m51KL2g= +gorm.io/driver/sqlite v1.5.3/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4= +gorm.io/gorm v1.25.4 h1:iyNd8fNAe8W9dvtlgeRI5zSVZPsq3OpcTu37cYcpCmw= +gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -757,12 +756,12 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -k8s.io/apimachinery v0.27.4 h1:CdxflD4AF61yewuid0fLl6bM4a3q04jWel0IlP+aYjs= -k8s.io/apimachinery v0.27.4/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= -k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= -k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/apimachinery v0.28.1 h1:EJD40og3GizBSV3mkIoXQBsws32okPOy+MkRyzh6nPY= +k8s.io/apimachinery v0.28.1/go.mod h1:X0xh/chESs2hP9koe+SdIAcXWcQ+RM5hy0ZynB+yEvw= +k8s.io/klog/v2 v2.100.1 h1:7WCHKK6K8fNhTqfBhISHQ97KrnJNFZMcQvKp7gP/tmg= +k8s.io/klog/v2 v2.100.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk= +k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= From 25de9e839a84a7e20688a74c31196e8dbcc65928 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 09:41:51 -0500 Subject: [PATCH 3/4] fix(deps): update module github.com/google/go-github/v53 to v54 (#929) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- compiler/native/compile_test.go | 2 +- compiler/registry/github/github.go | 2 +- compiler/registry/github/github_test.go | 2 +- compiler/registry/github/template.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- scm/github/access.go | 2 +- scm/github/authentication.go | 2 +- scm/github/changeset.go | 2 +- scm/github/deployment.go | 2 +- scm/github/github.go | 2 +- scm/github/github_test.go | 2 +- scm/github/repo.go | 2 +- scm/github/webhook.go | 2 +- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/compiler/native/compile_test.go b/compiler/native/compile_test.go index 3a37703d6..e0d2fc59b 100644 --- a/compiler/native/compile_test.go +++ b/compiler/native/compile_test.go @@ -15,7 +15,7 @@ import ( "github.com/go-vela/types/constants" "github.com/go-vela/types/raw" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" "testing" "time" diff --git a/compiler/registry/github/github.go b/compiler/registry/github/github.go index 7fb6f22b7..eb8177d02 100644 --- a/compiler/registry/github/github.go +++ b/compiler/registry/github/github.go @@ -9,7 +9,7 @@ import ( "net/url" "strings" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" "golang.org/x/oauth2" ) diff --git a/compiler/registry/github/github_test.go b/compiler/registry/github/github_test.go index 530b8f644..d83619b4d 100644 --- a/compiler/registry/github/github_test.go +++ b/compiler/registry/github/github_test.go @@ -12,7 +12,7 @@ import ( "reflect" "testing" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" "golang.org/x/oauth2" ) diff --git a/compiler/registry/github/template.go b/compiler/registry/github/template.go index 956a7608d..573bbe689 100644 --- a/compiler/registry/github/template.go +++ b/compiler/registry/github/template.go @@ -13,7 +13,7 @@ import ( "github.com/go-vela/types/library" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // Template captures the templated pipeline configuration from the GitHub repo. diff --git a/go.mod b/go.mod index 99659d352..586f5bedb 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/go-vela/types v0.20.2-0.20230822144153-14b37585731d github.com/golang-jwt/jwt/v5 v5.0.0 github.com/google/go-cmp v0.5.9 - github.com/google/go-github/v53 v53.2.0 + github.com/google/go-github/v54 v54.0.0 github.com/google/uuid v1.3.1 github.com/goware/urlx v0.3.2 github.com/hashicorp/go-cleanhttp v0.5.2 diff --git a/go.sum b/go.sum index 9d98de207..796ddae86 100644 --- a/go.sum +++ b/go.sum @@ -196,8 +196,8 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-github/v53 v53.2.0 h1:wvz3FyF53v4BK+AsnvCmeNhf8AkTaeh2SoYu/XUvTtI= -github.com/google/go-github/v53 v53.2.0/go.mod h1:XhFRObz+m/l+UCm9b7KSIC3lT3NWSXGt7mOsAWEloao= +github.com/google/go-github/v54 v54.0.0 h1:OZdXwow4EAD5jEo5qg+dGFH2DpkyZvVsAehjvJuUL/c= +github.com/google/go-github/v54 v54.0.0/go.mod h1:Sw1LXWHhXRZtzJ9LI5fyJg9wbQzYvFhW8W5P2yaAQ7s= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= diff --git a/scm/github/access.go b/scm/github/access.go index ee47cf3d1..f5696a1ed 100644 --- a/scm/github/access.go +++ b/scm/github/access.go @@ -10,7 +10,7 @@ import ( "github.com/sirupsen/logrus" "github.com/go-vela/types/library" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // OrgAccess captures the user's access level for an org. diff --git a/scm/github/authentication.go b/scm/github/authentication.go index 3b4ccf14b..7aa317cf1 100644 --- a/scm/github/authentication.go +++ b/scm/github/authentication.go @@ -14,7 +14,7 @@ import ( "github.com/go-vela/server/random" "github.com/go-vela/types/library" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // Authorize uses the given access token to authorize the user. diff --git a/scm/github/changeset.go b/scm/github/changeset.go index da8ca221a..21e8f511c 100644 --- a/scm/github/changeset.go +++ b/scm/github/changeset.go @@ -10,7 +10,7 @@ import ( "github.com/sirupsen/logrus" "github.com/go-vela/types/library" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // Changeset captures the list of files changed for a commit. diff --git a/scm/github/deployment.go b/scm/github/deployment.go index fea3f8d03..2d59edd42 100644 --- a/scm/github/deployment.go +++ b/scm/github/deployment.go @@ -11,7 +11,7 @@ import ( "github.com/go-vela/types/library" "github.com/go-vela/types/raw" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // GetDeployment gets a deployment from the GitHub repo. diff --git a/scm/github/github.go b/scm/github/github.go index ebae7ec76..723584585 100644 --- a/scm/github/github.go +++ b/scm/github/github.go @@ -9,7 +9,7 @@ import ( "fmt" "net/url" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" "github.com/sirupsen/logrus" "golang.org/x/oauth2" diff --git a/scm/github/github_test.go b/scm/github/github_test.go index 1c10db60a..4a23cee67 100644 --- a/scm/github/github_test.go +++ b/scm/github/github_test.go @@ -12,7 +12,7 @@ import ( "reflect" "testing" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" "golang.org/x/oauth2" ) diff --git a/scm/github/repo.go b/scm/github/repo.go index e69c7220c..c545c5169 100644 --- a/scm/github/repo.go +++ b/scm/github/repo.go @@ -15,7 +15,7 @@ import ( "github.com/go-vela/types/constants" "github.com/go-vela/types/library" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // ConfigBackoff is a wrapper for Config that will retry five times if the function diff --git a/scm/github/webhook.go b/scm/github/webhook.go index 43615e8cb..1d56ae227 100644 --- a/scm/github/webhook.go +++ b/scm/github/webhook.go @@ -20,7 +20,7 @@ import ( "github.com/go-vela/types" "github.com/go-vela/types/constants" "github.com/go-vela/types/library" - "github.com/google/go-github/v53/github" + "github.com/google/go-github/v54/github" ) // ProcessWebhook parses the webhook from a repo. From 7c233918901117f066ef0646d346f1c8c24b742a Mon Sep 17 00:00:00 2001 From: Easton Crupper <65553218+ecrupper@users.noreply.github.com> Date: Wed, 30 Aug 2023 11:15:17 -0400 Subject: [PATCH 4/4] refactor(db): return worker on created and updated (#945) --- api/worker/create.go | 2 +- api/worker/refresh.go | 2 +- api/worker/update.go | 5 +---- database/integration_test.go | 9 ++------- database/worker/count_test.go | 4 ++-- database/worker/create.go | 11 +++++------ database/worker/create_test.go | 7 ++++++- database/worker/delete_test.go | 2 +- database/worker/get_hostname_test.go | 2 +- database/worker/get_test.go | 2 +- database/worker/interface.go | 4 ++-- database/worker/list_test.go | 4 ++-- database/worker/update.go | 11 +++++------ database/worker/update_test.go | 9 +++++++-- router/middleware/worker/worker_test.go | 2 +- 15 files changed, 38 insertions(+), 38 deletions(-) diff --git a/api/worker/create.go b/api/worker/create.go index b7d1bf286..afd8e04c5 100644 --- a/api/worker/create.go +++ b/api/worker/create.go @@ -89,7 +89,7 @@ func CreateWorker(c *gin.Context) { "worker": input.GetHostname(), }).Infof("creating new worker %s", input.GetHostname()) - err = database.FromContext(c).CreateWorker(input) + _, err = database.FromContext(c).CreateWorker(input) if err != nil { retErr := fmt.Errorf("unable to create worker: %w", err) diff --git a/api/worker/refresh.go b/api/worker/refresh.go index cd4aa7ef3..cf62201aa 100644 --- a/api/worker/refresh.go +++ b/api/worker/refresh.go @@ -79,7 +79,7 @@ func Refresh(c *gin.Context) { w.SetLastCheckedIn(time.Now().Unix()) // send API call to update the worker - err := database.FromContext(c).UpdateWorker(w) + _, err := database.FromContext(c).UpdateWorker(w) if err != nil { retErr := fmt.Errorf("unable to update worker %s: %w", w.GetHostname(), err) diff --git a/api/worker/update.go b/api/worker/update.go index b3a8d5130..500d43990 100644 --- a/api/worker/update.go +++ b/api/worker/update.go @@ -124,7 +124,7 @@ func UpdateWorker(c *gin.Context) { } // send API call to update the worker - err = database.FromContext(c).UpdateWorker(w) + w, err = database.FromContext(c).UpdateWorker(w) if err != nil { retErr := fmt.Errorf("unable to update worker %s: %w", w.GetHostname(), err) @@ -133,8 +133,5 @@ func UpdateWorker(c *gin.Context) { return } - // send API call to capture the updated worker - w, _ = database.FromContext(c).GetWorkerForHostname(w.GetHostname()) - c.JSON(http.StatusOK, w) } diff --git a/database/integration_test.go b/database/integration_test.go index f982b25cb..a43106c57 100644 --- a/database/integration_test.go +++ b/database/integration_test.go @@ -1760,7 +1760,7 @@ func testWorkers(t *testing.T, db Interface, resources *Resources) { // create the workers for _, worker := range resources.Workers { - err := db.CreateWorker(worker) + _, err := db.CreateWorker(worker) if err != nil { t.Errorf("unable to create worker %d: %v", worker.GetID(), err) } @@ -1802,16 +1802,11 @@ func testWorkers(t *testing.T, db Interface, resources *Resources) { // update the workers for _, worker := range resources.Workers { worker.SetActive(false) - err = db.UpdateWorker(worker) + got, err := db.UpdateWorker(worker) if err != nil { t.Errorf("unable to update worker %d: %v", worker.GetID(), err) } - // lookup the worker by ID - got, err := db.GetWorker(worker.GetID()) - if err != nil { - t.Errorf("unable to get worker %d by ID: %v", worker.GetID(), err) - } if !reflect.DeepEqual(got, worker) { t.Errorf("GetWorker() is %v, want %v", got, worker) } diff --git a/database/worker/count_test.go b/database/worker/count_test.go index bd9d4c4ac..f6c5924d7 100644 --- a/database/worker/count_test.go +++ b/database/worker/count_test.go @@ -37,12 +37,12 @@ func TestWorker_Engine_CountWorkers(t *testing.T) { _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() - err := _sqlite.CreateWorker(_workerOne) + _, err := _sqlite.CreateWorker(_workerOne) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } - err = _sqlite.CreateWorker(_workerTwo) + _, err = _sqlite.CreateWorker(_workerTwo) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } diff --git a/database/worker/create.go b/database/worker/create.go index 6c62b30b6..dab2fac8e 100644 --- a/database/worker/create.go +++ b/database/worker/create.go @@ -12,7 +12,7 @@ import ( ) // CreateWorker creates a new worker in the database. -func (e *engine) CreateWorker(w *library.Worker) error { +func (e *engine) CreateWorker(w *library.Worker) (*library.Worker, error) { e.logger.WithFields(logrus.Fields{ "worker": w.GetHostname(), }).Tracef("creating worker %s in the database", w.GetHostname()) @@ -27,12 +27,11 @@ func (e *engine) CreateWorker(w *library.Worker) error { // https://pkg.go.dev/github.com/go-vela/types/database#Worker.Validate err := worker.Validate() if err != nil { - return err + return nil, err } // send query to the database - return e.client. - Table(constants.TableWorker). - Create(worker). - Error + result := e.client.Table(constants.TableWorker).Create(worker) + + return worker.ToLibrary(), result.Error } diff --git a/database/worker/create_test.go b/database/worker/create_test.go index e4c4dc9cb..83364265d 100644 --- a/database/worker/create_test.go +++ b/database/worker/create_test.go @@ -5,6 +5,7 @@ package worker import ( + "reflect" "testing" "github.com/DATA-DOG/go-sqlmock" @@ -55,7 +56,7 @@ VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12) RETURNING "id"`). // run tests for _, test := range tests { t.Run(test.name, func(t *testing.T) { - err := test.database.CreateWorker(_worker) + got, err := test.database.CreateWorker(_worker) if test.failure { if err == nil { @@ -68,6 +69,10 @@ VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12) RETURNING "id"`). if err != nil { t.Errorf("CreateWorker for %s returned err: %v", test.name, err) } + + if !reflect.DeepEqual(got, _worker) { + t.Errorf("CreateWorker for %s returned %s, want %s", test.name, got, _worker) + } }) } } diff --git a/database/worker/delete_test.go b/database/worker/delete_test.go index c8a9bd1be..5fc48b160 100644 --- a/database/worker/delete_test.go +++ b/database/worker/delete_test.go @@ -29,7 +29,7 @@ func TestWorker_Engine_DeleteWorker(t *testing.T) { _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() - err := _sqlite.CreateWorker(_worker) + _, err := _sqlite.CreateWorker(_worker) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } diff --git a/database/worker/get_hostname_test.go b/database/worker/get_hostname_test.go index 3dd1d4fe6..40846f556 100644 --- a/database/worker/get_hostname_test.go +++ b/database/worker/get_hostname_test.go @@ -34,7 +34,7 @@ func TestWorker_Engine_GetWorkerForName(t *testing.T) { _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() - err := _sqlite.CreateWorker(_worker) + _, err := _sqlite.CreateWorker(_worker) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } diff --git a/database/worker/get_test.go b/database/worker/get_test.go index 17fd03739..0c4422637 100644 --- a/database/worker/get_test.go +++ b/database/worker/get_test.go @@ -34,7 +34,7 @@ func TestWorker_Engine_GetWorker(t *testing.T) { _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() - err := _sqlite.CreateWorker(_worker) + _, err := _sqlite.CreateWorker(_worker) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } diff --git a/database/worker/interface.go b/database/worker/interface.go index 9e7fe1169..e1f49fe56 100644 --- a/database/worker/interface.go +++ b/database/worker/interface.go @@ -29,7 +29,7 @@ type WorkerInterface interface { // CountWorkers defines a function that gets the count of all workers. CountWorkers() (int64, error) // CreateWorker defines a function that creates a new worker. - CreateWorker(*library.Worker) error + CreateWorker(*library.Worker) (*library.Worker, error) // DeleteWorker defines a function that deletes an existing worker. DeleteWorker(*library.Worker) error // GetWorker defines a function that gets a worker by ID. @@ -39,5 +39,5 @@ type WorkerInterface interface { // ListWorkers defines a function that gets a list of all workers. ListWorkers() ([]*library.Worker, error) // UpdateWorker defines a function that updates an existing worker. - UpdateWorker(*library.Worker) error + UpdateWorker(*library.Worker) (*library.Worker, error) } diff --git a/database/worker/list_test.go b/database/worker/list_test.go index 5eed3f94f..7263ebb31 100644 --- a/database/worker/list_test.go +++ b/database/worker/list_test.go @@ -47,12 +47,12 @@ func TestWorker_Engine_ListWorkers(t *testing.T) { _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() - err := _sqlite.CreateWorker(_workerOne) + _, err := _sqlite.CreateWorker(_workerOne) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } - err = _sqlite.CreateWorker(_workerTwo) + _, err = _sqlite.CreateWorker(_workerTwo) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } diff --git a/database/worker/update.go b/database/worker/update.go index b0e475273..9bdda391a 100644 --- a/database/worker/update.go +++ b/database/worker/update.go @@ -12,7 +12,7 @@ import ( ) // UpdateWorker updates an existing worker in the database. -func (e *engine) UpdateWorker(w *library.Worker) error { +func (e *engine) UpdateWorker(w *library.Worker) (*library.Worker, error) { e.logger.WithFields(logrus.Fields{ "worker": w.GetHostname(), }).Tracef("updating worker %s in the database", w.GetHostname()) @@ -27,12 +27,11 @@ func (e *engine) UpdateWorker(w *library.Worker) error { // https://pkg.go.dev/github.com/go-vela/types/database#Worker.Validate err := worker.Validate() if err != nil { - return err + return nil, err } // send query to the database - return e.client. - Table(constants.TableWorker). - Save(worker). - Error + result := e.client.Table(constants.TableWorker).Save(worker) + + return worker.ToLibrary(), result.Error } diff --git a/database/worker/update_test.go b/database/worker/update_test.go index 0beeafa47..c9b3a8eaa 100644 --- a/database/worker/update_test.go +++ b/database/worker/update_test.go @@ -5,6 +5,7 @@ package worker import ( + "reflect" "testing" "github.com/DATA-DOG/go-sqlmock" @@ -31,7 +32,7 @@ WHERE "id" = $12`). _sqlite := testSqlite(t) defer func() { _sql, _ := _sqlite.client.DB(); _sql.Close() }() - err := _sqlite.CreateWorker(_worker) + _, err := _sqlite.CreateWorker(_worker) if err != nil { t.Errorf("unable to create test worker for sqlite: %v", err) } @@ -57,7 +58,7 @@ WHERE "id" = $12`). // run tests for _, test := range tests { t.Run(test.name, func(t *testing.T) { - err = test.database.UpdateWorker(_worker) + got, err := test.database.UpdateWorker(_worker) if test.failure { if err == nil { @@ -70,6 +71,10 @@ WHERE "id" = $12`). if err != nil { t.Errorf("UpdateWorker for %s returned err: %v", test.name, err) } + + if !reflect.DeepEqual(got, _worker) { + t.Errorf("UpdateWorker for %s returned %s, want %s", test.name, got, _worker) + } }) } } diff --git a/router/middleware/worker/worker_test.go b/router/middleware/worker/worker_test.go index 58d090825..bc1d41492 100644 --- a/router/middleware/worker/worker_test.go +++ b/router/middleware/worker/worker_test.go @@ -62,7 +62,7 @@ func TestWorker_Establish(t *testing.T) { db.Close() }() - _ = db.CreateWorker(want) + _, _ = db.CreateWorker(want) // setup context gin.SetMode(gin.TestMode)