Skip to content

Commit

Permalink
delete git auth secret when app creation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
Davor Gajic committed Dec 6, 2023
1 parent 2135486 commit 2308f50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
7 changes: 7 additions & 0 deletions create/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ func (app *applicationCmd) Run(ctx context.Context, client *api.Client) error {
defer cancel()

if err := c.createResource(appWaitCtx); err != nil {
if auth.Enabled() {
secret := auth.Secret(newApp)
if gitErr := client.Delete(ctx, secret); err != nil {
return errors.Join(err, fmt.Errorf("unable to delete git auth secret, please contact support: %w", gitErr))

Check failure on line 126 in create/application.go

View workflow job for this annotation

GitHub Actions / test

undefined: errors.Join

Check failure on line 126 in create/application.go

View workflow job for this annotation

GitHub Actions / lint

undefined: errors.Join

Check failure on line 126 in create/application.go

View workflow job for this annotation

GitHub Actions / lint

undefined: errors.Join
}
}

return err
}

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/crossplane/crossplane-runtime v0.15.1
github.com/docker/docker v20.10.23+incompatible
github.com/fatih/color v1.14.1
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48
github.com/gobuffalo/flect v0.2.3
github.com/goccy/go-yaml v1.11.0
github.com/golang-jwt/jwt v3.2.2+incompatible
Expand All @@ -17,6 +16,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/int128/kubelogin v1.25.3
github.com/lucasepe/codename v0.2.0
github.com/mattn/go-isatty v0.0.19
github.com/moby/moby v24.0.1+incompatible
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6
github.com/ninech/apis v0.0.0-20230905134643-5501080a23f9
Expand Down Expand Up @@ -119,7 +119,6 @@ require (
github.com/julienschmidt/httprouter v1.3.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/miekg/dns v1.1.50 // indirect
Expand Down
11 changes: 0 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,6 @@ github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7a
github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI=
github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo=
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48 h1:JVrqSeQfdhYRFk24TvhTZWU0q8lfCojxZQFi3Ou7+uY=
github.com/go-resty/resty/v2 v2.1.1-0.20191201195748-d7b97669fe48/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
Expand Down Expand Up @@ -966,8 +965,6 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-oci8 v0.0.7/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI=
Expand Down Expand Up @@ -1052,14 +1049,6 @@ github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxzi
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/ninech/apis v0.0.0-20230711123708-93a958dae9bf h1:FuJNLzd3WDe/GDI3PkK396lqwWGBKeaRMjVJTG4z6Gc=
github.com/ninech/apis v0.0.0-20230711123708-93a958dae9bf/go.mod h1:wrOupX4C8yri9Ydt60VZNv0fJrOL32F02/NcVka5WPo=
github.com/ninech/apis v0.0.0-20230712142921-101299efc792 h1:jTJUGnuShukT9s0nUeE1ShNKnSmdtWIWrY/tbul07b0=
github.com/ninech/apis v0.0.0-20230712142921-101299efc792/go.mod h1:wrOupX4C8yri9Ydt60VZNv0fJrOL32F02/NcVka5WPo=
github.com/ninech/apis v0.0.0-20230719070900-5493c913246a h1:+sdmIcy9+6WD++4Aue+Ty4K+sOSuHcTC5q1oxLEactU=
github.com/ninech/apis v0.0.0-20230719070900-5493c913246a/go.mod h1:wrOupX4C8yri9Ydt60VZNv0fJrOL32F02/NcVka5WPo=
github.com/ninech/apis v0.0.0-20230817192736-20a81d2ab110 h1:YikcbFXbNkYvRPPDs2npK5BKpsYFwriltPcVxojEXI4=
github.com/ninech/apis v0.0.0-20230817192736-20a81d2ab110/go.mod h1:wrOupX4C8yri9Ydt60VZNv0fJrOL32F02/NcVka5WPo=
github.com/ninech/apis v0.0.0-20230905134643-5501080a23f9 h1:Q2oBSf7m5AM6hRDqd887Vu1ZvXwCSmRO3AALG1H4YIc=
github.com/ninech/apis v0.0.0-20230905134643-5501080a23f9/go.mod h1:wrOupX4C8yri9Ydt60VZNv0fJrOL32F02/NcVka5WPo=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
Expand Down

0 comments on commit 2308f50

Please sign in to comment.