Repository: argoproj/argo
Pull request #3367 (2020-07-01 15:37:06)

chore: Remove unused code
Checklist:

* [x] Either (a) I've created an [enhancement proposal](https://github.com/argoproj/argo/issues/new/choose) and discussed it with the community, (b) this is a bug fix, or (c) this is a chore.
* [x] The title of the PR is (a) [conventional](https://www.conventionalcommits.org/en/v1.0.0/), (b) states what changed, and (c) suffixes the related issues number. E.g. `"fix(controller): Updates such and such. Fixes #1234"`.  
* [x] I've signed the CLA.
* [ ] I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
* [ ] My builds are green. Try syncing with master if they are not. 
* [x] My organization is added to [USERS.md](https://github.com/argoproj/argo/blob/master/USERS.md).



Patch:
diff --git a/.github/stale.yml b/.github/stale.yml
new file mode 100644
index 000000000..97448cd58
--- /dev/null
+++ b/.github/stale.yml
@@ -0,0 +1,19 @@
+# https://probot.github.io/apps/stale/
+# Number of days of inactivity before an issue becomes stale
+daysUntilStale: 60
+# Number of days of inactivity before a stale issue is closed
+daysUntilClose: 7
+# Issues with these labels will never be considered stale
+exemptLabels:
+  - enhancement
+  - pinned
+  - security
+# Label to use when marking an issue as stale
+staleLabel: wontfix
+# Comment to post when marking an issue as stale. Set to `false` to disable
+markComment: >
+  This issue has been automatically marked as stale because it has not had
+  recent activity. It will be closed if no further activity occurs. Thank you
+  for your contributions.
+# Comment to post when closing a stale issue. Set to `false` to disable
+closeComment: false
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 7e9ad2d46..3b34550ab 100644
--- a/Makefile
+++ b/Makefile
@@ -291,7 +291,7 @@ $(GOPATH)/bin/openapi-gen: tools
 $(GOPATH)/bin/swagger: tools
 
 $(GOPATH)/bin/goimports:
-	go get golang.org/x/tools/cmd/goimports
+	go get golang.org/x/tools/cmd/goimports@v0.0.0-20200630154851-b2d8b0336632
 
 .PHONY: proto
 proto: $(GOPATH)/bin/go-to-protobuf $(GOPATH)/bin/protoc-gen-gogo $(GOPATH)/bin/protoc-gen-gogofast $(GOPATH)/bin/goimports $(GOPATH)/bin/protoc-gen-grpc-gateway $(GOPATH)/bin/protoc-gen-swagger
diff --git a/hack/gen_schemas.go b/hack/gen_schemas.go
deleted file mode 100644
index 402ac8d11..000000000
--- a/hack/gen_schemas.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package main
-
-import (
-	"encoding/json"
-	"io/ioutil"
-
-	"github.com/argoproj/argo/pkg/apis/workflow"
-)
-
-/*
-	Generate JSON schemas good enough for the UI to validate against.
-
-	We're a bit lazy with these, we do not scrub the assets, and we just bundle all
-	the definitions, when we could cherry-pick the relevant ones.
-*/
-func genSchemas() {
-	data, err := ioutil.ReadFile("api/openapi-spec/swagger.json")
-	if err != nil {
-		panic(err)
-	}
-	swagger := obj{}
-	err = json.Unmarshal(data, &swagger)
-	if err != nil {
-		panic(err)
-	}
-	for _, crd := range workflow.CRDs {
-		name := "io.argoproj.workflow.v1alpha1." + crd.Kind
-		filename := "ui/src/app/assets/schemas/" + crd.Kind + ".json"
-		println(filename)
-		schema := obj{
-			"$id":         "http://workflows.argoproj.io/" + crd.Kind + ".json",
-			"$schema":     "http://json-schema.org/draft-07/schema",
-			"$ref":        "#/definitions/" + name,
-			"definitions": swagger["definitions"],
-		}
-		data, err = json.MarshalIndent(schema, "", "  ")
-		if err != nil {
-			panic(err)
-		}
-		err = ioutil.WriteFile(filename, data, 0666)
-		if err != nil {
-			panic(err)
-		}
-	}
-}
diff --git a/hack/main.go b/hack/main.go
index 880db5319..834e0784d 100644
--- a/hack/main.go
+++ b/hack/main.go
@@ -10,8 +10,6 @@ func main() {
 		removeCRDValidation(os.Args[2])
 	case "docgen":
 		generateDocs()
-	case "genschemas":
-		genSchemas()
 	case "kubeifyswagger":
 		kubeifySwagger(os.Args[2], os.Args[3])
 	case "secondaryswaggergen":
diff --git a/server/workflow/workflow_server.go b/server/workflow/workflow_server.go
index a6b019165..5153d2ca3 100644
--- a/server/workflow/workflow_server.go
+++ b/server/workflow/workflow_server.go
@@ -164,7 +164,7 @@ func (s *workflowServer) WatchWorkflows(req *workflowpkg.WatchWorkflowsRequest,
 	for {
 		select {
 		case <-ctx.Done():
-			return ctx.Err()
+			return nil
 		case event, open := <-watch.ResultChan():
 			if !open {
 				log.Debug("Re-establishing workflow watch")
diff --git a/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx b/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx
index dd7afd55f..904116063 100644
--- a/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx
+++ b/ui/src/app/workflows/components/workflow-dag/workflow-dag.tsx
@@ -259,6 +259,7 @@ export class WorkflowDag extends React.Component<WorkflowDagProps, WorkflowDagRe
             .map(node => node.id);
         const edges = Object.values(this.props.nodes)
             .filter(node => !!node)
+            .filter(node => node.phase !== NODE_PHASE.OMITTED)
             .map(node =>
                 (node.children || [])
                     // we can get outbound nodes, but no node


Test patch:
diff --git a/server/workflow/workflow_server_test.go b/server/workflow/workflow_server_test.go
index 4c64edd0c..c97830b8c 100644
--- a/server/workflow/workflow_server_test.go
+++ b/server/workflow/workflow_server_test.go
@@ -621,7 +621,7 @@ func TestWatchWorkflows(t *testing.T) {
 	ctx, cancel := context.WithCancel(ctx)
 	go func() {
 		err := server.WatchWorkflows(&workflowpkg.WatchWorkflowsRequest{}, &testWatchWorkflowServer{testServerStream{ctx}})
-		assert.EqualError(t, err, "context canceled")
+		assert.NoError(t, err)
 	}()
 	cancel()
 }
@@ -639,7 +639,7 @@ func TestWatchLatestWorkflow(t *testing.T) {
 				FieldSelector: util.GenerateFieldSelectorFromWorkflowName("@latest"),
 			},
 		}, &testWatchWorkflowServer{testServerStream{ctx}})
-		assert.EqualError(t, err, "context canceled")
+		assert.NoError(t, err)
 	}()
 	cancel()
 }