Skip to content

Commit

Permalink
Merge pull request #214 from Qovery/fix/qovery-client-npe-on-jobs
Browse files Browse the repository at this point in the history
fix: NPE qovery client
  • Loading branch information
benjaminch authored Oct 26, 2023
2 parents 60c0057 + 2c3c548 commit 63b6a64
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 390 deletions.
11 changes: 9 additions & 2 deletions cmd/cronjob_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ var cronjobDeployCmd = &cobra.Command{
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}

docker := cronjob.Source.JobResponseAllOfSourceOneOf1.Docker
image := cronjob.Source.JobResponseAllOfSourceOneOf.Image
var docker *qovery.JobResponseAllOfSourceOneOf1Docker = nil
if cronjob.Source.JobResponseAllOfSourceOneOf1 != nil {
docker = cronjob.Source.JobResponseAllOfSourceOneOf1.Docker
}

var image *qovery.ContainerSource = nil
if cronjob.Source.JobResponseAllOfSourceOneOf != nil {
image = cronjob.Source.JobResponseAllOfSourceOneOf.Image
}

var req qovery.JobDeployRequest

Expand Down
12 changes: 10 additions & 2 deletions cmd/cronjob_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"github.com/qovery/qovery-client-go"
"io"
"os"

Expand Down Expand Up @@ -64,8 +65,15 @@ var cronjobUpdateCmd = &cobra.Command{
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}

docker := cronjob.Source.JobResponseAllOfSourceOneOf1.Docker
image := cronjob.Source.JobResponseAllOfSourceOneOf.Image
var docker *qovery.JobResponseAllOfSourceOneOf1Docker = nil
if cronjob.Source.JobResponseAllOfSourceOneOf1 != nil {
docker = cronjob.Source.JobResponseAllOfSourceOneOf1.Docker
}

var image *qovery.ContainerSource = nil
if cronjob.Source.JobResponseAllOfSourceOneOf != nil {
image = cronjob.Source.JobResponseAllOfSourceOneOf.Image
}

if docker != nil && (cronjobTag != "" || cronjobImageName != "") {
utils.PrintlnError(fmt.Errorf("you can't use --tag or --image-name with a cronjob targetting a Dockerfile. Use --branch instead"))
Expand Down
11 changes: 9 additions & 2 deletions cmd/lifecycle_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,15 @@ var lifecycleDeployCmd = &cobra.Command{
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}

docker := lifecycle.Source.JobResponseAllOfSourceOneOf1.Docker
image := lifecycle.Source.JobResponseAllOfSourceOneOf.Image
var docker *qovery.JobResponseAllOfSourceOneOf1Docker = nil
if lifecycle.Source.JobResponseAllOfSourceOneOf1 != nil {
docker = lifecycle.Source.JobResponseAllOfSourceOneOf1.Docker
}

var image *qovery.ContainerSource = nil
if lifecycle.Source.JobResponseAllOfSourceOneOf != nil {
image = lifecycle.Source.JobResponseAllOfSourceOneOf.Image
}

var req qovery.JobDeployRequest

Expand Down
12 changes: 10 additions & 2 deletions cmd/lifecycle_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cmd

import (
"fmt"
"github.com/qovery/qovery-client-go"
"io"
"os"

Expand Down Expand Up @@ -64,8 +65,15 @@ var lifecycleUpdateCmd = &cobra.Command{
panic("unreachable") // staticcheck false positive: https://staticcheck.io/docs/checks#SA5011
}

docker := lifecycle.Source.JobResponseAllOfSourceOneOf1.Docker
image := lifecycle.Source.JobResponseAllOfSourceOneOf.Image
var docker *qovery.JobResponseAllOfSourceOneOf1Docker = nil
if lifecycle.Source.JobResponseAllOfSourceOneOf1 != nil {
docker = lifecycle.Source.JobResponseAllOfSourceOneOf1.Docker
}

var image *qovery.ContainerSource = nil
if lifecycle.Source.JobResponseAllOfSourceOneOf != nil {
image = lifecycle.Source.JobResponseAllOfSourceOneOf.Image
}

if docker != nil && (lifecycleTag != "" || lifecycleImageName != "") {
utils.PrintlnError(fmt.Errorf("you can't use --tag or --image-name with a lifecycle targetting a Dockerfile. Use --branch instead"))
Expand Down
4 changes: 0 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ require (
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gookit/color v1.5.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
Expand Down Expand Up @@ -68,11 +67,8 @@ require (
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
golang.org/x/crypto v0.10.0 // indirect
golang.org/x/oauth2 v0.9.0 // indirect
golang.org/x/term v0.9.0 // indirect
golang.org/x/text v0.10.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
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
)
Loading

0 comments on commit 63b6a64

Please sign in to comment.