Skip to content

Commit

Permalink
chore: minor fix and refactory (argoproj#2517)
Browse files Browse the repository at this point in the history
  • Loading branch information
whynowy authored Mar 25, 2020
1 parent b1ad163 commit b277124
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@
},
"io.argoproj.workflow.v1alpha1.GCSBucket": {
"type": "object",
"title": "GCSBucket contains the access information for interfacring with a GCS bucket",
"title": "GCSBucket contains the access information for interfacring with a GCS bucket",
"properties": {
"bucket": {
"type": "string",
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ require (
golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224 // indirect
golang.org/x/tools v0.0.0-20200325194147-644a21fb1449 // indirect
google.golang.org/api v0.20.0
google.golang.org/genproto v0.0.0-20200317114155-1f3552e48f24
google.golang.org/grpc v1.28.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,8 @@ golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapK
golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20200317043434-63da46f3035e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224 h1:azwY/v0y0K4mFHVsg5+UrTgchqALYWpqVo6vL5OmkmI=
golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/tools v0.0.0-20200325194147-644a21fb1449 h1:KOG4qpDXI4j4YMkZezw18+e2jkjrRw5f/n+3p9JiIjY=
golang.org/x/tools v0.0.0-20200325194147-644a21fb1449/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiclient/cronworkflow/cron-workflow.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@
"title": "ServiceAccountKeySecret is the secret selector to the bucket's service account key"
}
},
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
},
"github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.Gauge": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion pkg/apiclient/workflow/workflow.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@
"title": "ServiceAccountKeySecret is the secret selector to the bucket's service account key"
}
},
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
},
"github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.Gauge": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@
"title": "ServiceAccountKeySecret is the secret selector to the bucket's service account key"
}
},
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
},
"github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.Gauge": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
"title": "ServiceAccountKeySecret is the secret selector to the bucket's service account key"
}
},
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
"title": "GCSBucket contains the access information for interfacring with a GCS bucket"
},
"github.com.argoproj.argo.pkg.apis.workflow.v1alpha1.Gauge": {
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/workflow/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/apis/workflow/v1alpha1/workflow_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ func (h *HTTPArtifact) HasLocation() bool {
return h != nil && h.URL != ""
}

// GCSBucket contains the access information for interfacring with a GCS bucket
// GCSBucket contains the access information for interfacring with a GCS bucket
type GCSBucket struct {

// Bucket is the name of the bucket
Expand Down
2 changes: 1 addition & 1 deletion workflow/artifacts/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func NewDriver(art *wfv1.Artifact, ri resource.Interface) (ArtifactDriver, error
}

if art.GCS != nil {
driver := gcs.GCSArtifactDriver{}
driver := gcs.ArtifactDriver{}
if art.GCS.ServiceAccountKeySecret.Name != "" {
serviceAccountKeyBytes, err := ri.GetSecret(art.GCS.ServiceAccountKeySecret.Name, art.GCS.ServiceAccountKeySecret.Key)
if err != nil {
Expand Down
11 changes: 6 additions & 5 deletions workflow/artifacts/gcs/gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
wfv1 "github.com/argoproj/argo/pkg/apis/workflow/v1alpha1"
)

// GCSArtifactDriver is a driver for GCS
type GCSArtifactDriver struct {
// ArtifactDriver is a driver for GCS
type ArtifactDriver struct {
ServiceAccountKey string
}

func (g *GCSArtifactDriver) newGCSClient() (*storage.Client, error) {
func (g *ArtifactDriver) newGCSClient() (*storage.Client, error) {
if g.ServiceAccountKey != "" {
return newGCSClientWithCredential(g.ServiceAccountKey)
}
Expand Down Expand Up @@ -58,7 +58,7 @@ func newGCSClientDefault() (*storage.Client, error) {
}

// Load function downloads objects from GCS
func (g *GCSArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
func (g *ArtifactDriver) Load(inputArtifact *wfv1.Artifact, path string) error {
err := wait.ExponentialBackoff(wait.Backoff{Duration: time.Second * 2, Factor: 2.0, Steps: 5, Jitter: 0.1},
func() (bool, error) {
log.Infof("GCS Load path: %s, key: %s", path, inputArtifact.GCS.Key)
Expand Down Expand Up @@ -146,7 +146,7 @@ func listByPrefix(client *storage.Client, bucket, prefix, delim string) ([]strin
}

// Save an artifact to GCS compliant storage, e.g., uploading a local file to GCS bucket
func (g *GCSArtifactDriver) Save(path string, outputArtifact *wfv1.Artifact) error {
func (g *ArtifactDriver) Save(path string, outputArtifact *wfv1.Artifact) error {
err := wait.ExponentialBackoff(wait.Backoff{Duration: time.Second * 2, Factor: 2.0, Steps: 5, Jitter: 0.1},
func() (bool, error) {
log.Infof("GCS Save path: %s, key: %s", path, outputArtifact.GCS.Key)