Skip to content

Commit

Permalink
Merge pull request #6678 from csrwng/fix_build_details
Browse files Browse the repository at this point in the history
Merged by openshift-bot
  • Loading branch information
OpenShift Bot committed Jan 16, 2016
2 parents 9b59dab + 378876c commit d95ec08
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/build/admission/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func (a *buildByStrategy) Admit(attr admission.Attributes) error {
if resource := attr.GetResource(); resource != buildsResource && resource != buildConfigsResource {
return nil
}
// Explicitly exclude the builds/details subresource because it's only
// updating commit info and cannot change build type.
if attr.GetResource() == buildsResource && attr.GetSubresource() == "details" {
return nil
}
switch obj := attr.GetObject().(type) {
case *buildapi.Build:
return a.checkBuildAuthorization(obj, attr)
Expand Down
9 changes: 9 additions & 0 deletions pkg/build/admission/admission_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ func TestBuildAdmission(t *testing.T) {
expectAccept: false,
expectedError: "Internal error occurred: [Unrecognized request object &admission.fakeObject{}, couldn't find ObjectMeta field in admission.fakeObject{}]",
},
{
name: "details on forbidden docker build",
object: testBuild(buildapi.BuildStrategy{DockerStrategy: &buildapi.DockerBuildStrategy{}}),
kind: "Build",
resource: buildsResource,
subResource: "details",
reviewResponse: reviewResponse(false, "cannot create build of type docker build"),
expectAccept: true,
},
}

ops := []admission.Operation{admission.Create, admission.Update}
Expand Down

0 comments on commit d95ec08

Please # to comment.