Skip to content

Commit

Permalink
Allow switching manifest packing version and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
carabasdaniel committed Oct 3, 2023
1 parent 1938fd3 commit a95e4d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
The policy CLI is a tool for building, versioning and publishing your authorization policies.
It uses OCI standards to manage artifacts, and the [Open Policy Agent (OPA)](https://github.com/open-policy-agent/opa) to compile and run.


> ***As of version v0.2.4 we use the OCI Image Manifest defined in image-spec v1.1.0-rc4 when building policy images.*** This can cause issues when trying to push the image to some registries (ex. Amazon ECR)
> To set the CLI to build the policy image using the the OCI Image Manifest defined in image-spec v1.0.2 you can set the *USE_PACK_MANIFEST_1_0* environment variable to true.
---

[![Go Report Card](https://goreportcard.com/badge/github.com/opcr-io/policy?)](https://goreportcard.com/report/github.com/opcr-io/policy)
Expand Down
7 changes: 6 additions & 1 deletion pkg/app/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,12 @@ func (c *PolicyApp) createImage(ociStore *orasoci.Store, tarball string, annotat
return descriptor, err
}

manifestDesc, err := oras.PackManifest(c.Context, ociStore, oras.PackManifestVersion1_1_RC4, ocispec.MediaTypeImageManifest, oras.PackManifestOptions{Layers: []ocispec.Descriptor{descriptor}, ConfigDescriptor: &configDesc, ManifestAnnotations: descriptor.Annotations})
packVersion := oras.PackManifestVersion1_1_RC4
if os.Getenv("USE_PACK_MANIFEST_1_0") == "true" {
packVersion = oras.PackManifestVersion1_0
}

manifestDesc, err := oras.PackManifest(c.Context, ociStore, packVersion, ocispec.MediaTypeImageManifest, oras.PackManifestOptions{Layers: []ocispec.Descriptor{descriptor}, ConfigDescriptor: &configDesc, ManifestAnnotations: descriptor.Annotations})
if err != nil {
return manifestDesc, err
}
Expand Down

0 comments on commit a95e4d3

Please sign in to comment.