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

feat: Ability to easily compare versions using #toArtifactVersion #1183

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KristianOellegaard
Copy link

If you want to verify that your automatic pipeline does not deploy an old version because it is accidentally pushed to the docker repo

eg

#toArtifactVersion(execution.trigger.tag.replace("v", "")) >= #toArtifactVersion(#stage("Find Artifacts From Resource (Manifest)").manifest.spec.template.spec.containers[0].image.split(":")[1].replace("v", ""))

@spinnakerbot
Copy link
Contributor

The following commits need their title changed:

  • 4050f32: Add support for DefaultArtifactVersion to allow easy comparison in pipeline expressions

  • c3fd821: Fix return type

  • 8b03e4c: Fixed missing semi colon and correct return type

  • 309c6c6: Added test

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

@jasonmcintosh jasonmcintosh changed the title Ability to easily compare versions using #toArtifactVersion feat: Ability to easily compare versions using #toArtifactVersion May 15, 2024

String evaluated =
new ExpressionTransform(parserContext, parser, Function.identity())
.transformString(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SO this tries to translate the expression to a string. What's interesting is I DON'T think it's ever actually USED. Transform MAP is used. Ignoring that, you can use this but this I believe returns a boolean which it tries to cast as a string and then fails. Can switch to a transformMap (which is what's REALLY used) OR maybe add a .toString() on the results. I'd be inclined to do the map based test via a "transformMap(Map.of("test", testInput)...).get("test"). " kinda test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants