Skip to content

Commit

Permalink
Fix linter warnings and update swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Matyushentsev authored and Alexander Matyushentsev committed Oct 11, 2018
1 parent 7d0e77b commit 3b52b26
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"swagger": "2.0",
"info": {
"title": "Argo",
"version": "v2.2.0"
"version": "v2.2.1"
},
"paths": {},
"definitions": {
Expand Down
11 changes: 11 additions & 0 deletions util/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package util

type Closer interface {
Close() error
}

// Close is a convenience function to close a object that has a Close() method, ignoring any errors
// Used to satisfy errcheck lint
func Close(c Closer) {
_ = c.Close()
}
2 changes: 1 addition & 1 deletion workflow/controller/exec_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (woc *wfOperationCtx) killDeamonedChildren(nodeID string) error {
}
err := woc.updateExecutionControl(childNode.ID, execCtl)
if err != nil {
woc.log.Errorf("Failed to update execution control of %s: %+v", childNode, err)
woc.log.Errorf("Failed to update execution control of node %s: %+v", childNode.ID, err)
if firstErr == nil {
firstErr = err
}
Expand Down
4 changes: 2 additions & 2 deletions workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (woc *wfOperationCtx) executeSteps(nodeName string, tmpl *wfv1.Template, bo
}

if !sgNode.Successful() {
failMessage := fmt.Sprintf("step group %s was unsuccessful: %s", sgNode, sgNode.Message)
failMessage := fmt.Sprintf("step group %s was unsuccessful: %s", sgNode.ID, sgNode.Message)
woc.log.Info(failMessage)
woc.updateOutboundNodes(nodeName, tmpl)
return woc.markNodePhase(nodeName, wfv1.NodeFailed, sgNode.Message)
Expand Down Expand Up @@ -194,7 +194,7 @@ func (woc *wfOperationCtx) executeStepGroup(stepGroup []wfv1.WorkflowStep, sgNod
return node
case ErrParallelismReached:
default:
errMsg := fmt.Sprintf("child '%s' errored", childNode)
errMsg := fmt.Sprintf("child '%s' errored", childNode.ID)
woc.log.Infof("Step group node %s deemed errored due to child %s error: %s", node, childNodeName, err.Error())
woc.addChildNode(sgNodeName, childNodeName)
return woc.markNodePhase(node.Name, wfv1.NodeError, errMsg)
Expand Down
4 changes: 3 additions & 1 deletion workflow/executor/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"strings"
"time"

"github.com/argoproj/argo/util"

"github.com/argoproj/argo/errors"
"github.com/argoproj/argo/workflow/common"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -74,7 +76,7 @@ func (d *DockerExecutor) Logs(containerID string, path string) error {
if err != nil {
return errors.InternalWrapError(err)
}
defer outfile.Close()
defer util.Close(outfile)
cmd.Stdout = outfile
err = cmd.Start()
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion workflow/executor/kubelet/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
"syscall"
"time"

"github.com/argoproj/argo/util"

"github.com/argoproj/argo/errors"
"github.com/argoproj/argo/workflow/common"
"github.com/gorilla/websocket"
Expand Down Expand Up @@ -171,7 +173,7 @@ func (k *kubeletClient) saveLogsToFile(namespace, podName, containerName, path s
if err != nil {
return errors.InternalWrapError(err)
}
defer outFile.Close()
defer util.Close(outFile)
_, err = io.Copy(outFile, resp.Body)
return err
}
Expand Down

0 comments on commit 3b52b26

Please sign in to comment.