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

Allow filter functions in #{if} #65

Closed
ulrichb opened this issue Nov 15, 2021 · 9 comments · Fixed by #83
Closed

Allow filter functions in #{if} #65

ulrichb opened this issue Nov 15, 2021 · 9 comments · Fixed by #83

Comments

@ulrichb
Copy link

ulrichb commented Nov 15, 2021

Atm this is not supported by #{if}/#{unless}. The current workaround is to extract "temporary variables", but this is a) cumbersome and b) doesn't work "inline" in transformation config files.

Example use cases:

  • #{if My.Var | Trim != ""}oh it's empty or whitespace#{/if}
  • #{if My.Var | Contains meow}oh it seems to contain a cat#{/if}
  • #{if My.Url | UriPart Scheme == "https"}oh it's https#{/if}

As this conflicts with the (arbitrarily long) function argument list syntax, maybe it's better to use a "sub expression syntax", something like:
#{if #{SomeUrl | Trim} != ""}oh it's empty or whitespace#{/if}

@mross002
Copy link

mross002 commented Dec 1, 2021

Just throwing in 2 cents on behalf of my R&D team - we've had this need countless times - of course we're able to create a child / sub token to work around this and then include that in the #{if} and achieve the same thing, but we've had a lot of these use cases and it does add a good amount of time and impact readability and maintainability when you're searching for the sub tokens and trying to bring the expression all together for review or edits - so it would be beyond excellent if we could use filter functions in #{if}, +100 upvotes :happy

@ulrichb
Copy link
Author

ulrichb commented Jul 18, 2022

Many thanks @YihaoOct and @mjhilton !!

@mjhilton
Copy link
Contributor

No worries ☺

We still need to bump the version in Octopus Deploy to pick up this new functionality. We'll update this issue with details of which release(s) it will be available from once it's rolling out.

@ulrichb
Copy link
Author

ulrichb commented Jul 18, 2022

No prob. I can wait :) Thy for info!

@mross002
Copy link

This is excellent news! Thanks for implementing this. Do you happen to know when this updated version will be available via NuGet?

@mjhilton
Copy link
Contributor

Hey @mross002,

We aim to integrate Octostache into Octopus Deploy server before releasing to NuGet, because we have a very comprehensive set of integration tests that indirectly exercise a lot of Octostache's functionality. This suite picked up a regression in version 3.2.0, which we've since diagnosed and fixed to create version 3.2.1.

The pipeline was still running with the fixed version when you commented, but I've just checked and it's now been merged into the mainline of Octopus Deploy so... I'll go click the Deploy button to promote it to NuGet now :)

@mjhilton
Copy link
Contributor

It's deployed and live on NuGet.org now :)

@mjhilton
Copy link
Contributor

These changes will be available in Octopus Deploy after version 2022.3.6265 (unrelated things caused that build not to meet the quality bar, so the actual version number will be whichever is the first successful build in Release Stream 2022.3 after 6265)

@mross002
Copy link

@mjhilton - thanks so much!! Yes I saw that issue and PR to fix it, you all are very diligent with your auto tests, it's great to see and provides a lot of confidence in the package. I've upgraded to the latest NuGet package version, this really is a high impact feature that opens up many new use cases that previously weren't supported - you all are awesome, thanks again for all your efforts on this repo!

This issue was closed.
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.

3 participants