Skip to content

WIP: Support the date add filters in file substitution - #2129

Closed
NickJosevski wants to merge 1 commit into
mainfrom
nj/date-adds
Closed

WIP: Support the date add filters in file substitution#2129
NickJosevski wants to merge 1 commit into
mainfrom
nj/date-adds

Conversation

@NickJosevski

Copy link
Copy Markdown
Contributor

Warning

WIP — do not merge, and CI is expected to be red. This encodes the desired end state; it cannot pass until the Octostache pin is bumped.

Variant of #2124 and #2128, for the full filter set in OctopusDeploy/Octostache#126.

Why

Calamari does variable substitution in files at deploy time using its own pinned Octostache. These filters won't work inside substituted config files until that pin moves — even after Octopus Server ships them. A filter that resolves in a project variable but echoes unreplaced in a web.config is unpleasant to diagnose.

What

Eleven cases added to ShouldApplyFiltersDuringSubstitution, with a fixed dateVar so output stays deterministic:

Expression Output
AddSeconds 30 2030-05-22T09:05:30.0000000
AddMinutes 2 2030-05-22T09:07:00.0000000
AddHours 2 2030-05-22T11:05:00.0000000
AddHours -2 2030-05-22T07:05:00.0000000
AddHours 48 2030-05-24T09:05:00.0000000
AddDays 1 2030-05-23T09:05:00.0000000
AddWeeks 1 2030-05-29T09:05:00.0000000
AddMonths 1 2030-06-22T09:05:00.0000000
AddTimeSpan "2.12:00:00" 2030-05-24T21:05:00.0000000
AddTimeSpan 48:00:00 2030-07-09T09:05:00.0000000
AddHours 2 | Format "yyyy-MM-dd HH:mm:ss" 2030-05-22 11:05:00

Values were produced by running the expressions against the Octostache branch, not hand-written.

Note the last two AddTimeSpan rows sit directly against AddHours 48: the same "48" reaches 24 May via AddHours and 9 July via AddTimeSpan 48:00:00, because the .NET TimeSpan format re-reads the leading field as days above 23. Pinned here so the difference is visible in the deployment path, not just in Octostache's own tests.

To finish

🤖 Generated with Claude Code

Calamari does variable substitution in files at deploy time using its own
pinned Octostache, so these filters won't work in substituted files until
that pin moves past 3.9.2.

These cases encode the expected post-bump behaviour and will fail until
then: with 3.9.2 the filters are unknown, so the expressions echo
unreplaced rather than resolving.

Includes a case pinning that AddTimeSpan 48:00:00 shifts by 48 days where
AddHours 48 shifts by 48 hours, since that difference is silent.

Expected values verified against the Octostache implementation.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NickJosevski

Copy link
Copy Markdown
Contributor Author

Closing — going with the AddHours/AddDays shape in OctopusDeploy/Octostache#124 instead. The matching PR for that variant stays open.

@NickJosevski
NickJosevski deleted the nj/date-adds branch August 10, 2026 10:54
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.

1 participant