Skip to content

Commit

Permalink
Merge pull request #5957 from gabemontero/issue5945
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Nov 19, 2015
2 parents 0e3fe6c + 61fc0d1 commit 4b900da
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/api/graph/test/bc-missing-output.yaml
@@ -0,0 +1,33 @@
apiVersion: v1
kind: BuildConfig
metadata:
annotations:
openshift.io/generated-by: OpenShiftNewApp
creationTimestamp: 2015-11-18T14:41:17Z
labels:
app: gitauthtest
template: gitserver
name: gitauthtest
namespace: devproj
resourceVersion: "634"
selfLink: /oapi/v1/namespaces/devproj/buildconfigs/gitauthtest
uid: 6d487478-8e02-11e5-9cf2-3c970e88b00e
spec:
output: {}
resources: {}
source:
git:
uri: http://gitserver-tokenauth.linux.xip.io/ruby-hello-world
sourceSecret:
name: builder-token-nbme5
type: Git
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: ruby:latest
namespace: openshift
type: Source
triggers: []
status:
lastVersion: 1
10 changes: 10 additions & 0 deletions pkg/build/graph/analysis/bc_test.go
Expand Up @@ -72,6 +72,16 @@ func TestPushableBuild(t *testing.T) {
}
}

func TestBuildConfigNoOutput(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/bc-missing-output.yaml")
if err != nil {
t.Fatalf("unexpected error: %v", err)
}

// we were getting go panics with nil refs cause output destinations are not required for BuildConfigs
buildedges.AddAllInputOutputEdges(g)
}

func TestCircularDeps(t *testing.T) {
g, _, err := osgraphtest.BuildGraph("../../../api/graph/test/circular.yaml")
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions pkg/build/graph/edges.go
Expand Up @@ -79,6 +79,9 @@ func imageRefNode(g osgraph.MutableUniqueGraph, ref *kapi.ObjectReference, bc *b

// AddOutputEdges links the build config to its output image node.
func AddOutputEdges(g osgraph.MutableUniqueGraph, node *buildgraph.BuildConfigNode) {
if node.BuildConfig.Spec.Output.To == nil {
return
}
out := imageRefNode(g, node.BuildConfig.Spec.Output.To, node.BuildConfig)
g.AddEdge(node, out, BuildOutputEdgeKind)
}
Expand Down

0 comments on commit 4b900da

Please sign in to comment.