Skip to content

Commit

Permalink
fix(conformance): OCI-Filters-Applied should return a literal (projec…
Browse files Browse the repository at this point in the history
…t-zot#1640)

* fix(conformance): OCI-Filters-Applied should return a literal

opencontainers/distribution-spec#448

Should only indicate what filter-type was applied and not what exact
values it was filtered on.

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

* ci(conformance): point to temporary repo

Revert this commit once upstream changes have been merged

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>

---------

Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
  • Loading branch information
rchincha authored Jul 22, 2023
1 parent 46ee330 commit de24bd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/oci-conformance-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
with:
# TODO: change to upstream once the foloowing PR is merged:
# https://github.com/opencontainers/distribution-spec/pull/436
repository: opencontainers/distribution-spec
ref: main
repository: rchincha/distribution-spec
ref: fix-ref
path: distribution-spec
- name: build conformance binary from main
run: |
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5924,15 +5924,15 @@ func TestArtifactReferences(t *testing.T) {
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, http.StatusOK)
So(resp.Header().Get("Content-Type"), ShouldEqual, ispec.MediaTypeImageIndex)
So(resp.Header().Get("OCI-Filters-Applied"), ShouldEqual, artifactType)
So(resp.Header().Get("OCI-Filters-Applied"), ShouldEqual, "artifactType")

resp, err = resty.R().SetQueryParams(map[string]string{"artifactType": artifactType +
",otherArtType"}).Get(baseURL + fmt.Sprintf("/v2/%s/referrers/%s", repoName,
digest.String()))
So(err, ShouldBeNil)
So(resp.StatusCode(), ShouldEqual, http.StatusOK)
So(resp.Header().Get("Content-Type"), ShouldEqual, ispec.MediaTypeImageIndex)
So(resp.Header().Get("OCI-Filters-Applied"), ShouldEqual, artifactType+",otherArtType")
So(resp.Header().Get("OCI-Filters-Applied"), ShouldEqual, "artifactType")
})
})
})
Expand Down
3 changes: 2 additions & 1 deletion pkg/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ func (rh *RouteHandler) GetReferrers(response http.ResponseWriter, request *http
}

if len(artifactTypes) > 0 {
response.Header().Set("OCI-Filters-Applied", strings.Join(artifactTypes, ","))
// currently, the only filter supported and on this end-point
response.Header().Set("OCI-Filters-Applied", "artifactType")
}

zcommon.WriteData(response, http.StatusOK, ispec.MediaTypeImageIndex, out)
Expand Down

0 comments on commit de24bd9

Please sign in to comment.