Class BuildEnvironmentVariable
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CodeBuild
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BuildEnvironmentVariable : Object, IBuildEnvironmentVariable
Syntax (vb)
Public Class BuildEnvironmentVariable
Inherits Object
Implements IBuildEnvironmentVariable
Remarks
ExampleMetadata: infused
Examples
// later:
PipelineProject project;
var sourceOutput = new Artifact();
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "Build1",
Input = sourceOutput,
Project = new PipelineProject(this, "Project", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "env", new Dictionary<string, string[]> {
{ "exported-variables", new [] { "MY_VAR" } }
} },
{ "phases", new Dictionary<string, IDictionary<string, string>> {
{ "build", new Struct {
Commands = "export MY_VAR=\"some value\""
} }
} }
})
}),
VariablesNamespace = "MyNamespace"
});
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "MyVar", new BuildEnvironmentVariable {
Value = buildAction.Variable("MY_VAR")
} }
}
});
Synopsis
Constructors
Build |
Properties
Type | The type of environment variable. |
Value | The value of the environment variable. |
Constructors
BuildEnvironmentVariable()
public BuildEnvironmentVariable()
Properties
Type
The type of environment variable.
public Nullable<BuildEnvironmentVariableType> Type { get; set; }
Property Value
System.
Remarks
Default: PlainText
Value
The value of the environment variable.
public object Value { get; set; }
Property Value
System.
Remarks
For plain-text variables (the default), this is the literal value of variable.
For SSM parameter variables, pass the name of the parameter here (parameterName
property of IParameter
).
For SecretsManager variables secrets, pass either the secret name (secretName
property of ISecret
)
or the secret ARN (secretArn
property of ISecret
) here,
along with optional SecretsManager qualifiers separated by ':', like the JSON key, or the version or stage
(see https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.env.secrets-manager for details).