Skip to content

Commit

Permalink
feat: set crane as default resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
zach-source committed Aug 8, 2023
1 parent 6a013f4 commit c3f2686
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Tooling that enables software release pipelines for operator manifests.

### Binaries

Binaries are available for Linux (amd64, s390x, ppc64le, and arm64) and Darwin (amd64). This tool doesn't require skopeo to function
but to not use skopeo is definitely the harder path. If you require the library on an unsupported OS we recommend you use the docker images.
Binaries are available for Linux (amd64, s390x, ppc64le, and arm64) and Darwin (amd64). This tool bundles the [crane resolver](https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md)and uses it by default. Use of alternate or even custom image resolvers is available; please see the sections below.

### Docker

Expand Down Expand Up @@ -62,7 +61,10 @@ operator-manifest-tools pinning pin $MANIFEST_DIR
# equalivent to pin; doesn't generate temporary files for the cmd though
operator-manifest-tools pinning extract $MANIFEST_DIR - | operator-manifest-tools pinning resolve - | operator-manifest-tools pinning replace $MANIFEST_DIR
```
#### Using alternate resolvers

If the built in `crane` resolver is causing issues, there is a built in alternate skopeo resolver. It requires the [skopeo](https://github.com/containers/skopeo) binary to be on the host machine. Just run the commands with the option `--resolver skopeo`

#### Custom Resolve Scripts

It's possible to replace skopeo with other resolve mechanisms (i.e. docker). The resolve and pin command can take parameters that will override the skopeo default with a script. Please see [hack/resolvers/skopeo.sh](hack/resolvers/skopeo.sh) for an example using skopeo.
It's possible to replace skopeo with other resolve mechanisms (i.e. docker). The resolve and pin command can take parameters that will override the crane default with a script. Please see [hack/resolvers/skopeo.sh](hack/resolvers/skopeo.sh) for an example using skopeo.
2 changes: 1 addition & 1 deletion cmd/pinning/resolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func mountResolverOpts(
}

cmd.Flags().StringVarP(resolverVar,
"resolver", "r", "skopeo",
"resolver", "r", "crane",
fmt.Sprintf("The resolver to use; valid values are [%s]", imageresolver.GetResolverOptions()))

cmd.Flags().StringToStringVar(resolverArgs,
Expand Down
7 changes: 4 additions & 3 deletions internal/tests/integration/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def assert_output_files_have_expected_content(testing_pullspecs):
else:
assert pullspec['original'] in references_content


class TestPinCommand():

# def test_version(self, teardown, tmp_path):
Expand All @@ -70,7 +70,7 @@ class TestPinCommand():

def test_manifest_dir_empty(self, teardown, tmp_path):
cmd = subprocess.run(['operator-manifest-tools', 'pinning', 'pin', tmp_path], capture_output=True)
print({"err": cmd.stderr, "output":cmd.stderr})
print({"err": cmd.stderr, "output": cmd.stderr})
assert 'Missing ClusterServiceVersion in operator manifests' in str(cmd.stderr)
assert_output_files_are_empty()

Expand Down Expand Up @@ -264,7 +264,8 @@ def test_nonexistent_image(self, csv_filename, teardown, tmp_path):
cmd = subprocess.run(['operator-manifest-tools', 'pinning', 'pin', tmp_path], capture_output=True)
err_msg = "Failed to inspect docker://quay.io/containerbuildsystem/operator-manifest-test-image:nonexistenttag." \
" Make sure it exists and is accessible."
assert err_msg in str(cmd.stderr)
err_msg_alt = "manifest unknown"
assert err_msg in str(cmd.stderr) or err_msg_alt in str(cmd.stderr)

@pytest.mark.parametrize('csv_filename', ['related_images_defined_on_both_places_csv.yaml'])
def test_manifests_having_related_images_defined_on_both_places(self, csv_filename, teardown, tmp_path):
Expand Down

0 comments on commit c3f2686

Please sign in to comment.