Skip to content

Add deployment registry selector#371

Open
timothyF95 wants to merge 8 commits intomainfrom
add-deployment-registry-selector
Open

Add deployment registry selector#371
timothyF95 wants to merge 8 commits intomainfrom
add-deployment-registry-selector

Conversation

@timothyF95
Copy link
Copy Markdown
Contributor

@timothyF95 timothyF95 commented Apr 14, 2026

Summary

Adds an optional deployment-registry field to user-workflow settings that lets workflow commands resolve registry configuration dynamically from context.yaml instead of using hardcoded environments.yaml defaults. When omitted, behaviour is unchanged (backward compatible). Off-chain registries are gated in production and rejected by on-chain-only commands (deploy, pause, activate, delete) with a clear error until off-chain routing is implemented.

Changes:

  • New DeploymentRegistry field on UserWorkflowSettings, read via Viper
  • ResolveRegistry helper resolves registry by ID from tenant context, branching on type (on-chain / off-chain), with fallback to EnvironmentSet defaults
  • ResolvedRegistry wired into runtime.Context; deploy, pause, activate, delete read from it instead of EnvironmentSet directly
  • RequireOnChainRegistry guard rejects off-chain registries early with an actionable error message

Example workflow.yaml

staging-settings:
  user-workflow:
    workflow-name: "my-workflow-staging"
    deployment-registry: "onchain:ethereum-testnet-sepolia"           <--- new (optional)
  workflow-artifacts:
    workflow-path: "."
    config-path: "./config.staging.json"
    secrets-path: ""

Precedence hierarchy

deployment-registry set?
├── YES → context.yaml registry entry (env vars ignored)
└── NO  → CRE_CLI_WORKFLOW_REGISTRY_* env var
          └── not set → embedded environments.yaml default

@@ -1,4 +1,4 @@
package testutil
package testsettings
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was moved to avoid an import cycle

@timothyF95 timothyF95 marked this pull request as ready for review April 14, 2026 12:24
@timothyF95 timothyF95 requested a review from a team as a code owner April 14, 2026 12:24
// or from a tenant context registry entry selected via deployment-registry.
type ResolvedRegistry struct {
ID string
Type string // "on-chain" or "off-chain"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we could extract the type as cosnts/enums?

ExplorerURL: envSet.WorkflowRegistryChainExplorerURL,
}

if reg.Address != nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does it make sense to resolve a registry without an address?

// ResolvedRegistry holds the fully resolved registry configuration for a
// workflow command. It is built from either the static EnvironmentSet defaults
// or from a tenant context registry entry selected via deployment-registry.
type ResolvedRegistry struct {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have you considered how the code would look like if we had 2 different types representing onchain/offchain regsitry? I'm not the biggest fan, where we have a bag of fields unrelated for a given object type.

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