Skip to content

Add Version property to $Context #85

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

Merged
merged 4 commits into from
Jun 6, 2025
Merged

Conversation

AnatoliB
Copy link
Collaborator

@AnatoliB AnatoliB commented Jun 2, 2025

Add Version property to the $Context object passed to orchestrator functions, similar to Azure/azure-functions-powershell-worker#1108.

As a result, PowerShell Functions users will be able to specify a version in host.json:

{
  "extensions": {
    "durableTask": {
      "defaultVersion": "2.0"
    }
  }
}

and check the orchestration version in their orchestrator functions in order to keep them backward compatible, for example:

if ($Context.Version -eq '1.0') {
    # Legacy code path
    Invoke-DurableActivity 'A'
} elseif ($Context.Version -eq '2.0') {
    # New code path
    Invoke-DurableActivity 'B'
}

Note: Microsoft.Azure.WebJobs.Extensions.DurableTask 3.1.0+ is required for this to work properly.

Pull request checklist

  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • I have added all required tests (Unit tests, E2E tests)

@AnatoliB AnatoliB requested review from Copilot and andystaples June 2, 2025 05:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds a Version property to the $Context object, enabling orchestration functions to identify the version specified in host.json for backward compatibility. Key changes include updating host.json to include the durableTask defaultVersion, updating csproj files to require newer package versions and target framework versions, and modifying tests and the OrchestrationContext model to access and assert the new Version property.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/E2E/durableApp/host.json Added the "extensions" section with a defaultVersion property
test/E2E/durableApp/extensions.csproj Updated TargetFramework and DurableTask package to meet version requirements
test/E2E/durableApp/SimpleOrchestrator/run.ps1 Appended a line to output the Context.Version for verification
test/E2E/durableApp/DurableOrchestratorAccessContextProps/run.ps1 Extended orchestration context properties output with Version
test/E2E/AzureFunctions.PowerShell.Durable.SDK.E2E/OrchestrationTests.cs Added an assertion to verify the orchestration Version
test/E2E/AzureFunctions.PowerShell.Durable.SDK.E2E/DurableClientTests.cs Modified expected outputs to include the Version value
src/DurableEngine/Models/OrchestrationContext.cs Introduced a public Version property that reflects the orchestration instance version
src/DurableEngine/DurableEngine.csproj Upgraded DurableTask packages to version 1.10.0
release_notes.md Noted the addition of the Version property to $Context

@AnatoliB AnatoliB force-pushed the anatolib/context-version branch from 12662cc to 1c84b3b Compare June 3, 2025 17:56
@AnatoliB AnatoliB merged commit b95c685 into main Jun 6, 2025
2 checks passed
@AnatoliB AnatoliB deleted the anatolib/context-version branch June 6, 2025 22:06
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