Table of Contents

Interface IVariableService

Namespace
Invex.Atom.Build.Variables
Assembly
Invex.Atom.Build.dll

Defines a centralized service for managing workflow variables, coordinating operations across multiple providers.

public interface IVariableService

Remarks

This service abstracts the complexity of multiple variable providers, offering a unified API for reading and writing variables. It delegates operations to registered IVariableProvider implementations, trying custom providers first before falling back to the base Atom provider.

Methods

ReadVariable(string, string, CancellationToken)

Reads a variable written by a specific job.

Task<string?> ReadVariable(string jobName, string variableName, CancellationToken cancellationToken = default)

Parameters

jobName string

The name of the job context from which to read the variable.

variableName string

The name of the variable as defined in the build parameters.

cancellationToken CancellationToken

A cancellation token.

Returns

Task<string>

The variable's value, or null if no provider could supply it.

Remarks

A value that is found is also exposed as an environment variable named after the parameter's argument name, so that it resolves through IParamService like any other parameter.

WriteVariable(string, string, CancellationToken)

Writes a variable to the workflow context, making it available for subsequent steps and jobs.

Task WriteVariable(string variableName, string variableValue, CancellationToken cancellationToken = default)

Parameters

variableName string

The name of the variable as defined in the build parameters.

variableValue string

The value to store for the variable.

cancellationToken CancellationToken

A cancellation token.

Returns

Task

A System.Threading.Tasks.Task representing the asynchronous write operation.

Remarks

The service resolves the variable's argument name from the build definition and attempts to write it using custom providers first. If none succeed, it uses the base Atom provider.