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

"serviceVersionRange" in Hello World deployment.policy.json example is incorrect #492

Closed
johnwalicki opened this issue Nov 9, 2021 · 8 comments

Comments

@johnwalicki
Copy link
Member

The
https://github.com/open-horizon/examples/blob/master/edge/services/helloworld/policy/deployment.policy.json#L25
file includes an example of a deployment.policy.json with a userInput environment variable definition. It shows a serviceVersionRange key / value pair that is incorrect json. The closing ) should be a ]

"serviceVersionRange": "[0.0.0,INFINITY)",

While it is interesting to show in the example that the serviceVersionRange array can list many versions, to make it relevant to the example, it would be better to specify.

"serviceVersionRange": "[$SERVICE_VERSION]",
or
"serviceVersionRange": "[$SERVICE_VERSION,INFINITY]",

@johnwalicki
Copy link
Member Author

@t-fine This PR has been open for a while. It fixes a typo in a json file. Would be great if you could review / merge it.

@t-fine
Copy link
Collaborator

t-fine commented Nov 29, 2021

Hey @johnwalicki sorry for the delay here ... completely slipped my mind after the examples working group meeting, then out last week for thanksgiving ... looking into this now!

@t-fine
Copy link
Collaborator

t-fine commented Nov 29, 2021

@johnwalicki as far as I can tell when digging into this, there should be no issue including the string "[0.0.0,INFINITY)" ... @linggao I'm going to try to test myself, but is this something you can confirm? We use this syntax in examples in several places so I just want to make sure I'm not missing something

      "serviceVersionRange": "[0.0.0,INFINITY)",

in addition to many exchange return messages on this page... https://github.ibm.com/Edge-Fabric/exchange-api/blob/11cca8b2f6c12628558ad0ea7bec6827acb0931e/doc/openapi-3.json#L1137

@t-fine
Copy link
Collaborator

t-fine commented Nov 29, 2021

@johnwalicki can you remind me, when you were attempting this initially, did it publish to the exchange with "[0.0.0,INFINITY)" and just not rollback correctly? Or was there an error message when publishing?

@linggao
Copy link
Member

linggao commented Nov 29, 2021

@t-fine @johnwalicki The correct syntax is "[0.0.0,INFINITY)". The value for serviceVersionRange is a string, not an array. It uses the semantic version syntax to define a version range. For example:

  1. [1.0.0, 2.0.0] means any version between 1.0.0 to 2.0.0 including 2.0.0 it self.
  2. [1.0.0, 2.0.0) means any version between 1.0.0 to 2.0.0 not including 2.0.0.
  3. (1.0.0, 2.0.0) means any version between 1.0.0 to 2.0.0 not including 1.0.0 and 2.0.0.
  4. [0.0.0,INFINITY) means any version.

@johnwalicki
Copy link
Member Author

johnwalicki commented Nov 30, 2021

Interesting. I use semantic version syntax in several of my projects. I've never heard of "[)"
So, not a bug.
Suggest we close the issue and reject the PR.

I still like pinning a deployment policy to a specific "serviceVersionRange": "[$SERVICE_VERSION]" but that's just a personal preference.

@t-fine
Copy link
Collaborator

t-fine commented Dec 1, 2021

Sounds good! Closing.

@t-fine t-fine closed this as completed Dec 1, 2021
@clementkng
Copy link
Contributor

Late comment, but I think it would be good to note somewhere that we're using semantic version syntax in that way, since the "[)" looked odd to me as well.

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 a pull request may close this issue.

4 participants