Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for numeric types #2557

Merged
merged 1 commit into from
Feb 6, 2023

Conversation

carolynvs
Copy link
Member

@carolynvs carolynvs commented Feb 6, 2023

What does this change

When I updated the canonical json library used by cnab-go, I missed that cnab-to-oci also used the one without support for numeric types. I have updated Porter with a regression test for numeric types Just building a bundle with it isn't enough as we already had tests for that in the cnab config adapter tests. We needed to push it too which exercises the fix in cnab-to-oci, so I added this to the mybuns bundle used in our smoke tests. For now we'll stay on a patched cnab-to-oci until the patch is merged and a new release of cnab-to-oci is available.

This fixes the following error when pushing a bundle that uses numeric types, such as setting the default value for a parameter to 0.5

$ porter publish
reference not found (localhost:5000/porter-hello:v0.1.0)
Pushing bundle image...
The push refers to repository [localhost:5000/porter-hello]
...
0fd880641d89: Pushed
9d0460f30cfd: Pushed
76dda007b025: Pushed
porter-37da5464f8517662657529ad34851db9: digest: sha256:d53641f601988f8894ebc681bcb277624db45e328f547054401d2de994e2ab1e size: 2412

Rewriting CNAB bundle.json...
Starting to copy image localhost:5000/porter-hello@sha256:d53641f601988f8894ebc681bcb277624db45e328f547054401d2de994e2ab1e...
Completed image localhost:5000/porter-hello@sha256:d53641f601988f8894ebc681bcb277624db45e328f547054401d2de994e2ab1e copy
error pushing the bundle to localhost:5000/porter-hello:v0.1.0: json: unsupported value: 0.5

What issue does it fix

This addresses the issue raised in cnabio/cnab-to-oci#131

Notes for the reviewer

NA

Checklist

  • Did you write tests?
  • Did you write documentation?
  • Did you change porter.yaml or a storage document record? Update the corresponding schema file.
  • If this is your first pull request, please add your name to the bottom of our Contributors list. Thank you for making Porter better! 🙇‍♀️

Reviewer Checklist

  • Comment with /azp run test-porter-release if a magefile or build script was modified
  • Comment with /azp run porter-integration if it's a non-trivial PR

When I updated the canonical json library used by cnab-go, I missed that cnab-to-oci also used the one without support for numeric types. I have updated Porter with a regression test for numeric types (just building a bundle with it isn't enough, we need to push it too which exercises the fix in cnab-to-oci). For now we'll stay on a patched cnab-to-oci until the patch is merged and a new release of cnab-to-oci is available.

This fixes the following error when pushing a bundle that uses numeric types, such as setting the default value for a paramter to 0.5

```
$ porter publish
reference not found (localhost:5000/porter-hello:v0.1.0)
Pushing bundle image...
The push refers to repository [localhost:5000/porter-hello]
...
0fd880641d89: Pushed
9d0460f30cfd: Pushed
76dda007b025: Pushed
porter-37da5464f8517662657529ad34851db9: digest: sha256:d53641f601988f8894ebc681bcb277624db45e328f547054401d2de994e2ab1e size: 2412

Rewriting CNAB bundle.json...
Starting to copy image localhost:5000/porter-hello@sha256:d53641f601988f8894ebc681bcb277624db45e328f547054401d2de994e2ab1e...
Completed image localhost:5000/porter-hello@sha256:d53641f601988f8894ebc681bcb277624db45e328f547054401d2de994e2ab1e copy
error pushing the bundle to localhost:5000/porter-hello:v0.1.0: json: unsupported value: 0.5
```

Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
@carolynvs carolynvs marked this pull request as ready for review February 6, 2023 16:38
@carolynvs carolynvs merged commit 89b93a0 into getporter:main Feb 6, 2023
@carolynvs carolynvs deleted the patch-numeric-types branch February 6, 2023 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants