Skip to content

Latest commit

 

History

History
2636 lines (1581 loc) · 78.9 KB

File metadata and controls

2636 lines (1581 loc) · 78.9 KB

API Reference

Constructs

VersionOutputs

Construct for creating version outputs in CloudFormation and SSM Parameter Store.

Initializers

import { VersionOutputs } from 'cdk-devops'

new VersionOutputs(scope: Construct, id: string, props: VersionOutputsProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props VersionOutputsProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.

toString
public toString(): string

Returns a string representation of this construct.

Static Functions

Name Description
isConstruct Checks if x is a construct.

isConstruct
import { VersionOutputs } from 'cdk-devops'

VersionOutputs.isConstruct(x: any)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

xRequired
  • Type: any

Any object.


Properties

Name Type Description
node constructs.Node The tree node.
versionInfo VersionInfo The version information.
outputs {[ key: string ]: aws-cdk-lib.CfnOutput} CloudFormation outputs (if enabled).
parameters {[ key: string ]: aws-cdk-lib.aws_ssm.StringParameter} SSM Parameters (if enabled).

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


versionInfoRequired
public readonly versionInfo: VersionInfo;

The version information.


outputsOptional
public readonly outputs: {[ key: string ]: CfnOutput};
  • Type: {[ key: string ]: aws-cdk-lib.CfnOutput}

CloudFormation outputs (if enabled).


parametersOptional
public readonly parameters: {[ key: string ]: StringParameter};
  • Type: {[ key: string ]: aws-cdk-lib.aws_ssm.StringParameter}

SSM Parameters (if enabled).


Structs

BuildNumberConfig

Build number configuration.

Initializer

import { BuildNumberConfig } from 'cdk-devops'

const buildNumberConfig: BuildNumberConfig = { ... }

Properties

Name Type Description
envVar string Environment variable to read build number from.

envVarOptional
public readonly envVar: string;
  • Type: string
  • Default: 'BUILD_NUMBER'

Environment variable to read build number from.


CloudFormationOnlyOptions

Options for CloudFormation-only output configuration.

Initializer

import { CloudFormationOnlyOptions } from 'cdk-devops'

const cloudFormationOnlyOptions: CloudFormationOnlyOptions = { ... }

Properties

Name Type Description
exportName string Export name for cross-stack references.
format string Output format.
stackOutputName string Stack output name.

exportNameOptional
public readonly exportName: string;
  • Type: string

Export name for cross-stack references.


formatOptional
public readonly format: string;
  • Type: string
  • Default: 'plain'

Output format.


stackOutputNameOptional
public readonly stackOutputName: string;
  • Type: string

Stack output name.


CloudFormationOutputConfig

CloudFormation output configuration.

Initializer

import { CloudFormationOutputConfig } from 'cdk-devops'

const cloudFormationOutputConfig: CloudFormationOutputConfig = { ... }

Properties

Name Type Description
enabled boolean Whether to create CloudFormation outputs.
export boolean Whether to export the outputs for cross-stack references.
exportNameTemplate string Export name template (supports {version}, {environment}, etc.).

enabledOptional
public readonly enabled: boolean;
  • Type: boolean
  • Default: true

Whether to create CloudFormation outputs.


exportOptional
public readonly export: boolean;
  • Type: boolean
  • Default: false

Whether to export the outputs for cross-stack references.


exportNameTemplateOptional
public readonly exportNameTemplate: string;
  • Type: string

Export name template (supports {version}, {environment}, etc.).


CommitCountConfig

Commit count configuration.

Initializer

import { CommitCountConfig } from 'cdk-devops'

const commitCountConfig: CommitCountConfig = { ... }

Properties

Name Type Description
mode string Commit counting mode - 'all': Count all commits - 'branch': Count commits on current branch - 'since-tag': Count commits since last tag.
padding number Padding for commit count (e.g., 5 means '00042').

modeOptional
public readonly mode: string;
  • Type: string
  • Default: 'all'

Commit counting mode - 'all': Count all commits - 'branch': Count commits on current branch - 'since-tag': Count commits since last tag.


paddingOptional
public readonly padding: number;
  • Type: number
  • Default: 0

Padding for commit count (e.g., 5 means '00042').


ComputationContext

Context for version computation.

Initializer

import { ComputationContext } from 'cdk-devops'

const computationContext: ComputationContext = { ... }

Properties

Name Type Description
environment string Environment/stage name.
gitInfo GitInfo Git information.
buildNumber string Build number.
deploymentTime string Deployment timestamp.
packageVersion string Package version from package.json.
pipelineVersion string Pipeline version/execution ID.
repositoryUrl string Repository URL.

environmentRequired
public readonly environment: string;
  • Type: string

Environment/stage name.


gitInfoRequired
public readonly gitInfo: GitInfo;

Git information.


buildNumberOptional
public readonly buildNumber: string;
  • Type: string

Build number.


deploymentTimeOptional
public readonly deploymentTime: string;
  • Type: string

Deployment timestamp.


packageVersionOptional
public readonly packageVersion: string;
  • Type: string

Package version from package.json.


pipelineVersionOptional
public readonly pipelineVersion: string;
  • Type: string

Pipeline version/execution ID.


repositoryUrlOptional
public readonly repositoryUrl: string;
  • Type: string

Repository URL.


GitInfo

Git repository information.

Initializer

import { GitInfo } from 'cdk-devops'

const gitInfo: GitInfo = { ... }

Properties

Name Type Description
branch string Current branch name.
commitCount number Total commit count.
commitHash string Full commit hash.
shortCommitHash string Short commit hash (typically 8 characters).
commitsSinceTag number Commit count since last tag.
tag string Git tag (if on a tagged commit).

branchRequired
public readonly branch: string;
  • Type: string

Current branch name.


commitCountRequired
public readonly commitCount: number;
  • Type: number

Total commit count.


commitHashRequired
public readonly commitHash: string;
  • Type: string

Full commit hash.


shortCommitHashRequired
public readonly shortCommitHash: string;
  • Type: string

Short commit hash (typically 8 characters).


commitsSinceTagOptional
public readonly commitsSinceTag: number;
  • Type: number

Commit count since last tag.


tagOptional
public readonly tag: string;
  • Type: string

Git tag (if on a tagged commit).


GitInfoProps

Props for creating GitInfo.

Initializer

import { GitInfoProps } from 'cdk-devops'

const gitInfoProps: GitInfoProps = { ... }

Properties

Name Type Description
branch string Current branch name.
commitCount number Total commit count.
commitHash string Full commit hash.
commitsSinceTag number Commit count since last tag.
tag string Git tag (if on a tagged commit).

branchRequired
public readonly branch: string;
  • Type: string

Current branch name.


commitCountRequired
public readonly commitCount: number;
  • Type: number

Total commit count.


commitHashRequired
public readonly commitHash: string;
  • Type: string

Full commit hash.


commitsSinceTagOptional
public readonly commitsSinceTag: number;
  • Type: number

Commit count since last tag.


tagOptional
public readonly tag: string;
  • Type: string

Git tag (if on a tagged commit).


GitTagConfig

Git tag configuration for version extraction.

Initializer

import { GitTagConfig } from 'cdk-devops'

const gitTagConfig: GitTagConfig = { ... }

Properties

Name Type Description
countCommitsSince boolean Whether to count commits since the last tag.
pattern string Pattern to match git tags.
prefix string Prefix to strip from git tags (e.g., 'v' for tags like 'v1.2.3').

countCommitsSinceOptional
public readonly countCommitsSince: boolean;
  • Type: boolean
  • Default: true

Whether to count commits since the last tag.


patternOptional
public readonly pattern: string;
  • Type: string
  • Default: '..*'

Pattern to match git tags.


prefixOptional
public readonly prefix: string;
  • Type: string
  • Default: 'v'

Prefix to strip from git tags (e.g., 'v' for tags like 'v1.2.3').


HierarchicalParametersOptions

Options for hierarchical parameter configuration.

Initializer

import { HierarchicalParametersOptions } from 'cdk-devops'

const hierarchicalParametersOptions: HierarchicalParametersOptions = { ... }

Properties

Name Type Description
format string Output format.
includeCloudFormation boolean Whether to include CloudFormation outputs.

formatOptional
public readonly format: string;
  • Type: string
  • Default: 'plain'

Output format.


includeCloudFormationOptional
public readonly includeCloudFormation: boolean;
  • Type: boolean
  • Default: false

Whether to include CloudFormation outputs.


PackageJsonConfig

Package.json version configuration.

Initializer

import { PackageJsonConfig } from 'cdk-devops'

const packageJsonConfig: PackageJsonConfig = { ... }

Properties

Name Type Description
includePrerelease boolean Whether to include prerelease identifiers.

includePrereleaseOptional
public readonly includePrerelease: boolean;
  • Type: boolean
  • Default: true

Whether to include prerelease identifiers.


ParameterStoreOutputConfig

SSM Parameter Store output configuration.

Initializer

import { ParameterStoreOutputConfig } from 'cdk-devops'

const parameterStoreOutputConfig: ParameterStoreOutputConfig = { ... }

Properties

Name Type Description
basePath string Base path for parameters (e.g., '/myapp/version').
description string Description for the parameter.
enabled boolean Whether to create SSM parameters.
splitParameters boolean Whether to split version info into separate parameters.

basePathOptional
public readonly basePath: string;
  • Type: string

Base path for parameters (e.g., '/myapp/version').


descriptionOptional
public readonly description: string;
  • Type: string

Description for the parameter.


enabledOptional
public readonly enabled: boolean;
  • Type: boolean
  • Default: true

Whether to create SSM parameters.


splitParametersOptional
public readonly splitParameters: boolean;
  • Type: boolean
  • Default: false

Whether to split version info into separate parameters.


StandardOutputOptions

Options for standard output configuration.

Initializer

import { StandardOutputOptions } from 'cdk-devops'

const standardOutputOptions: StandardOutputOptions = { ... }

Properties

Name Type Description
format string Output format.
parameterName string Parameter name template.

formatOptional
public readonly format: string;
  • Type: string
  • Default: 'plain'

Output format.


parameterNameOptional
public readonly parameterName: string;
  • Type: string
  • Default: '/{stackName}/version'

Parameter name template.


VersionInfoProps

Props for creating VersionInfo.

Initializer

import { VersionInfoProps } from 'cdk-devops'

const versionInfoProps: VersionInfoProps = { ... }

Properties

Name Type Description
environment string Environment/stage name.
gitInfo GitInfo Git information.
version string Computed version string.
buildNumber string Build number.
deploymentTime string Deployment timestamp.
deploymentUser string Deployment username.
packageVersion string Package version from package.json.
pipelineVersion string Pipeline version/execution ID.
repositoryUrl string Repository URL.

environmentRequired
public readonly environment: string;
  • Type: string

Environment/stage name.


gitInfoRequired
public readonly gitInfo: GitInfo;

Git information.


versionRequired
public readonly version: string;
  • Type: string

Computed version string.


buildNumberOptional
public readonly buildNumber: string;
  • Type: string

Build number.


deploymentTimeOptional
public readonly deploymentTime: string;
  • Type: string

Deployment timestamp.


deploymentUserOptional
public readonly deploymentUser: string;
  • Type: string

Deployment username.


packageVersionOptional
public readonly packageVersion: string;
  • Type: string

Package version from package.json.


pipelineVersionOptional
public readonly pipelineVersion: string;
  • Type: string

Pipeline version/execution ID.


repositoryUrlOptional
public readonly repositoryUrl: string;
  • Type: string

Repository URL.


VersioningConfig

Versioning configuration.

Initializer

import { VersioningConfig } from 'cdk-devops'

const versioningConfig: VersioningConfig = { ... }

Properties

Name Type Description
outputs VersioningOutputsConfig Output configuration.
strategy IVersioningStrategy Versioning strategy.
enabled boolean Whether versioning is enabled.
stageOverrides {[ key: string ]: VersioningConfig} Stage-specific configuration overrides.

outputsRequired
public readonly outputs: VersioningOutputsConfig;

Output configuration.


strategyRequired
public readonly strategy: IVersioningStrategy;

Versioning strategy.


enabledOptional
public readonly enabled: boolean;
  • Type: boolean
  • Default: true

Whether versioning is enabled.


stageOverridesOptional
public readonly stageOverrides: {[ key: string ]: VersioningConfig};

Stage-specific configuration overrides.


VersioningOutputsConfig

Output configuration for version information.

Initializer

import { VersioningOutputsConfig } from 'cdk-devops'

const versioningOutputsConfig: VersioningOutputsConfig = { ... }

Properties

Name Type Description
cloudFormation CloudFormationOutputConfig CloudFormation output configuration.
parameterStore ParameterStoreOutputConfig SSM Parameter Store configuration.

cloudFormationOptional
public readonly cloudFormation: CloudFormationOutputConfig;

CloudFormation output configuration.


parameterStoreOptional
public readonly parameterStore: ParameterStoreOutputConfig;

SSM Parameter Store configuration.


VersioningStrategyComponents

Components that can be included in a versioning strategy.

Initializer

import { VersioningStrategyComponents } from 'cdk-devops'

const versioningStrategyComponents: VersioningStrategyComponents = { ... }

Properties

Name Type Description
buildNumber BuildNumberConfig Build number configuration.
commitCount CommitCountConfig Commit count configuration.
gitTag GitTagConfig Git tag configuration.
packageJson PackageJsonConfig Package.json version configuration.

buildNumberOptional
public readonly buildNumber: BuildNumberConfig;

Build number configuration.


commitCountOptional
public readonly commitCount: CommitCountConfig;

Commit count configuration.


gitTagOptional
public readonly gitTag: GitTagConfig;

Git tag configuration.


packageJsonOptional
public readonly packageJson: PackageJsonConfig;

Package.json version configuration.


VersionOutputsProps

Props for VersionOutputs construct.

Initializer

import { VersionOutputsProps } from 'cdk-devops'

const versionOutputsProps: VersionOutputsProps = { ... }

Properties

Name Type Description
versionInfo VersionInfo Version information to output.
cloudFormation CloudFormationOutputConfig CloudFormation output configuration.
metadataKey string Metadata key.
outputPrefix string Prefix for output names.
parameterStore ParameterStoreOutputConfig SSM Parameter Store configuration.

versionInfoRequired
public readonly versionInfo: VersionInfo;

Version information to output.


cloudFormationOptional
public readonly cloudFormation: CloudFormationOutputConfig;

CloudFormation output configuration.


metadataKeyOptional
public readonly metadataKey: string;
  • Type: string
  • Default: 'Version'

Metadata key.


outputPrefixOptional
public readonly outputPrefix: string;
  • Type: string
  • Default: 'Version'

Prefix for output names.


parameterStoreOptional
public readonly parameterStore: ParameterStoreOutputConfig;

SSM Parameter Store configuration.


Classes

CompositeComputation

Composite computation strategy that replaces template variables.

Initializers

import { CompositeComputation } from 'cdk-devops'

new CompositeComputation(strategy: IVersioningStrategy)
Name Type Description
strategy IVersioningStrategy No description.

strategyRequired

Methods

Name Description
compute Compute version by replacing template variables in format string.

compute
public compute(context: ComputationContext): string

Compute version by replacing template variables in format string.

contextRequired

GitInfoHelper

Helper class for working with Git information.

Initializers

import { GitInfoHelper } from 'cdk-devops'

new GitInfoHelper()
Name Type Description

Static Functions

Name Description
create Create GitInfo from individual components.
fromEnvironment Create GitInfo from environment variables (CI/CD context).
isMainBranch Check if on a main branch.
isTaggedRelease Check if on a tagged release.
shortenHash Shorten a git commit hash to 8 characters.

create
import { GitInfoHelper } from 'cdk-devops'

GitInfoHelper.create(props: GitInfoProps)

Create GitInfo from individual components.

propsRequired

fromEnvironment
import { GitInfoHelper } from 'cdk-devops'

GitInfoHelper.fromEnvironment()

Create GitInfo from environment variables (CI/CD context).

isMainBranch
import { GitInfoHelper } from 'cdk-devops'

GitInfoHelper.isMainBranch(branch: string)

Check if on a main branch.

branchRequired
  • Type: string

isTaggedRelease
import { GitInfoHelper } from 'cdk-devops'

GitInfoHelper.isTaggedRelease(gitInfo: GitInfo)

Check if on a tagged release.

gitInfoRequired

shortenHash
import { GitInfoHelper } from 'cdk-devops'

GitInfoHelper.shortenHash(hash: string, length?: number)

Shorten a git commit hash to 8 characters.

hashRequired
  • Type: string

lengthOptional
  • Type: number

VersionComputationStrategy

Abstract base class for version computation strategies.

Initializers

import { VersionComputationStrategy } from 'cdk-devops'

new VersionComputationStrategy()
Name Type Description

Methods

Name Description
compute Compute version string from context.

compute
public compute(context: ComputationContext): string

Compute version string from context.

contextRequired

VersionComputer

Main version computer class.

Initializers

import { VersionComputer } from 'cdk-devops'

new VersionComputer(strategy: IVersioningStrategy)
Name Type Description
strategy IVersioningStrategy No description.

strategyRequired

Methods

Name Description
compute Compute version from context.
computeVersionString Compute version string only (without creating VersionInfo).

compute
public compute(context: ComputationContext): VersionInfo

Compute version from context.

contextRequired

computeVersionString
public computeVersionString(context: ComputationContext): string

Compute version string only (without creating VersionInfo).

contextRequired

VersionInfo

Version information for deployments.

Methods

Name Description
displayVersion Get display version (prefers tag if available).
exportName Get export name from template.
isMainBranch Check if deployed from main branch.
isTaggedRelease Check if this is a tagged release.
parameterName Get SSM parameter name from template.
toJson Convert to JSON string.
toObject Convert to plain object.

displayVersion
public displayVersion(): string

Get display version (prefers tag if available).

exportName
public exportName(template: string): string

Get export name from template.

templateRequired
  • Type: string

isMainBranch
public isMainBranch(): boolean

Check if deployed from main branch.

isTaggedRelease
public isTaggedRelease(): boolean

Check if this is a tagged release.

parameterName
public parameterName(template: string): string

Get SSM parameter name from template.

templateRequired
  • Type: string

toJson
public toJson(): string

Convert to JSON string.

toObject
public toObject(): IVersionInfo

Convert to plain object.

Static Functions

Name Description
compare Compare two version infos.
create Create VersionInfo from props.
fromEnvironment Create VersionInfo from environment variables.
fromJson Create VersionInfo from JSON string.

compare
import { VersionInfo } from 'cdk-devops'

VersionInfo.compare(a: VersionInfo, b: VersionInfo)

Compare two version infos.

aRequired

bRequired

create
import { VersionInfo } from 'cdk-devops'

VersionInfo.create(props: VersionInfoProps)

Create VersionInfo from props.

propsRequired

fromEnvironment
import { VersionInfo } from 'cdk-devops'

VersionInfo.fromEnvironment(version: string, environment: string)

Create VersionInfo from environment variables.

versionRequired
  • Type: string

environmentRequired
  • Type: string

fromJson
import { VersionInfo } from 'cdk-devops'

VersionInfo.fromJson(json: string)

Create VersionInfo from JSON string.

jsonRequired
  • Type: string

Properties

Name Type Description
branch string Git branch name.
commitCount number Total commit count.
commitHash string Git commit hash.
deploymentTime string Deployment timestamp.
deploymentUser string Deployment username.
environment string Environment/stage name.
shortCommitHash string Git commit hash (short form, typically 8 characters).
version string Computed version string.
buildNumber string Build number (if available).
packageVersion string Package version from package.json (if available).
pipelineVersion string Pipeline version/execution ID.
repositoryUrl string Repository URL.
tag string Git tag (if available).

branchRequired
public readonly branch: string;
  • Type: string

Git branch name.


commitCountRequired
public readonly commitCount: number;
  • Type: number

Total commit count.


commitHashRequired
public readonly commitHash: string;
  • Type: string

Git commit hash.


deploymentTimeRequired
public readonly deploymentTime: string;
  • Type: string

Deployment timestamp.


deploymentUserRequired
public readonly deploymentUser: string;
  • Type: string

Deployment username.


environmentRequired
public readonly environment: string;
  • Type: string

Environment/stage name.


shortCommitHashRequired
public readonly shortCommitHash: string;
  • Type: string

Git commit hash (short form, typically 8 characters).


versionRequired
public readonly version: string;
  • Type: string

Computed version string.


buildNumberOptional
public readonly buildNumber: string;
  • Type: string

Build number (if available).


packageVersionOptional
public readonly packageVersion: string;
  • Type: string

Package version from package.json (if available).


pipelineVersionOptional
public readonly pipelineVersion: string;
  • Type: string

Pipeline version/execution ID.


repositoryUrlOptional
public readonly repositoryUrl: string;
  • Type: string

Repository URL.


tagOptional
public readonly tag: string;
  • Type: string

Git tag (if available).


VersionInfoBuilder

Builder for VersionInfo.

Initializers

import { VersionInfoBuilder } from 'cdk-devops'

new VersionInfoBuilder()
Name Type Description

Methods

Name Description
buildVersionInfo Build the VersionInfo instance.
withBuildNumber Set build number.
withDeploymentTime Set deployment time.
withDeploymentUser Set deployment username.
withEnvironment Set environment.
withGitInfo Set git information.
withPackageVersion Set package version.
withPipelineVersion Set pipeline version.
withRepositoryUrl Set repository URL.
withVersion Set version string.

buildVersionInfo
public buildVersionInfo(): VersionInfo

Build the VersionInfo instance.

withBuildNumber
public withBuildNumber(buildNumber?: string): VersionInfoBuilder

Set build number.

buildNumberOptional
  • Type: string

withDeploymentTime
public withDeploymentTime(deploymentTime?: string): VersionInfoBuilder

Set deployment time.

deploymentTimeOptional
  • Type: string

withDeploymentUser
public withDeploymentUser(deploymentUser?: string): VersionInfoBuilder

Set deployment username.

deploymentUserOptional
  • Type: string

withEnvironment
public withEnvironment(environment: string): VersionInfoBuilder

Set environment.

environmentRequired
  • Type: string

withGitInfo
public withGitInfo(gitInfo: GitInfo): VersionInfoBuilder

Set git information.

gitInfoRequired

withPackageVersion
public withPackageVersion(packageVersion?: string): VersionInfoBuilder

Set package version.

packageVersionOptional
  • Type: string

withPipelineVersion
public withPipelineVersion(pipelineVersion?: string): VersionInfoBuilder

Set pipeline version.

pipelineVersionOptional
  • Type: string

withRepositoryUrl
public withRepositoryUrl(repositoryUrl?: string): VersionInfoBuilder

Set repository URL.

repositoryUrlOptional
  • Type: string

withVersion
public withVersion(version: string): VersionInfoBuilder

Set version string.

versionRequired
  • Type: string

VersioningOutputsFactory

Factory class for creating versioning output configurations.

Initializers

import { VersioningOutputsFactory } from 'cdk-devops'

new VersioningOutputsFactory()
Name Type Description

Static Functions

Name Description
cloudFormationOnly CloudFormation-only output configuration.
hierarchicalParameters Hierarchical Parameter Store configuration.
minimal Minimal output configuration with only CloudFormation outputs.
standard Standard output configuration with CloudFormation and Parameter Store.

cloudFormationOnly
import { VersioningOutputsFactory } from 'cdk-devops'

VersioningOutputsFactory.cloudFormationOnly(options?: CloudFormationOnlyOptions)

CloudFormation-only output configuration.

optionsOptional

hierarchicalParameters
import { VersioningOutputsFactory } from 'cdk-devops'

VersioningOutputsFactory.hierarchicalParameters(basePath: string, options?: HierarchicalParametersOptions)

Hierarchical Parameter Store configuration.

basePathRequired
  • Type: string

optionsOptional

minimal
import { VersioningOutputsFactory } from 'cdk-devops'

VersioningOutputsFactory.minimal()

Minimal output configuration with only CloudFormation outputs.

standard
import { VersioningOutputsFactory } from 'cdk-devops'

VersioningOutputsFactory.standard(options?: StandardOutputOptions)

Standard output configuration with CloudFormation and Parameter Store.

optionsOptional

VersioningStrategy

Versioning strategy implementation.

Static Functions

Name Description
buildNumber Strategy using build number and commit information Format: build-{commit-count}-{commit-hash:8}.
commitCount Strategy using commit count Format: 0.0.{commit-count}.
commitHash Strategy using commit hash Format: {commit-hash:8}.
create Create a custom versioning strategy.
gitTag Strategy using git tags as version source Format: {git-tag} or {git-tag}-{commit-count} if not on a tag.
gitTagWithDevVersions Strategy combining git tag with commit count for non-tagged commits Format: {git-tag} or {git-tag}-dev.{commit-count}.
packageJson Strategy using package.json version Format: {package-version}.
packageWithBranch Strategy combining package version with branch and commit info Format: {package-version}-{branch}.{commit-count}.
semanticWithPatch Semantic versioning strategy with automatic patch increment Format: {package-version}.{commit-count}.

buildNumber
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.buildNumber(config?: BuildNumberConfig)

Strategy using build number and commit information Format: build-{commit-count}-{commit-hash:8}.

configOptional

commitCount
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.commitCount(config?: CommitCountConfig)

Strategy using commit count Format: 0.0.{commit-count}.

configOptional

commitHash
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.commitHash()

Strategy using commit hash Format: {commit-hash:8}.

create
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.create(format: string, components?: VersioningStrategyComponents)

Create a custom versioning strategy.

formatRequired
  • Type: string

componentsOptional

gitTag
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.gitTag(config?: GitTagConfig)

Strategy using git tags as version source Format: {git-tag} or {git-tag}-{commit-count} if not on a tag.

configOptional

gitTagWithDevVersions
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.gitTagWithDevVersions(config?: GitTagConfig)

Strategy combining git tag with commit count for non-tagged commits Format: {git-tag} or {git-tag}-dev.{commit-count}.

configOptional

packageJson
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.packageJson(config?: PackageJsonConfig)

Strategy using package.json version Format: {package-version}.

configOptional

packageWithBranch
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.packageWithBranch(config?: PackageJsonConfig)

Strategy combining package version with branch and commit info Format: {package-version}-{branch}.{commit-count}.

configOptional

semanticWithPatch
import { VersioningStrategy } from 'cdk-devops'

VersioningStrategy.semanticWithPatch(config?: PackageJsonConfig)

Semantic versioning strategy with automatic patch increment Format: {package-version}.{commit-count}.

configOptional

Properties

Name Type Description
components VersioningStrategyComponents Strategy components configuration.
format string Format string for version computation Supports placeholders: {git-tag}, {package-version}, {commit-count}, {commit-hash}, {branch}, {build-number}.

componentsRequired
public readonly components: VersioningStrategyComponents;

Strategy components configuration.


formatRequired
public readonly format: string;
  • Type: string

Format string for version computation Supports placeholders: {git-tag}, {package-version}, {commit-count}, {commit-hash}, {branch}, {build-number}.


Protocols

IVersionInfo

Version information interface.

Properties

Name Type Description
branch string Git branch name.
commitCount number Total commit count.
commitHash string Git commit hash.
deploymentTime string Deployment timestamp.
deploymentUser string Deployment username.
environment string Environment/stage name.
shortCommitHash string Git commit hash (short form, typically 8 characters).
version string Computed version string.
buildNumber string Build number (if available).
packageVersion string Package version from package.json (if available).
pipelineVersion string Pipeline version/execution ID.
repositoryUrl string Repository URL.
tag string Git tag (if available).

branchRequired
public readonly branch: string;
  • Type: string

Git branch name.


commitCountRequired
public readonly commitCount: number;
  • Type: number

Total commit count.


commitHashRequired
public readonly commitHash: string;
  • Type: string

Git commit hash.


deploymentTimeRequired
public readonly deploymentTime: string;
  • Type: string

Deployment timestamp.


deploymentUserRequired
public readonly deploymentUser: string;
  • Type: string

Deployment username.


environmentRequired
public readonly environment: string;
  • Type: string

Environment/stage name.


shortCommitHashRequired
public readonly shortCommitHash: string;
  • Type: string

Git commit hash (short form, typically 8 characters).


versionRequired
public readonly version: string;
  • Type: string

Computed version string.


buildNumberOptional
public readonly buildNumber: string;
  • Type: string

Build number (if available).


packageVersionOptional
public readonly packageVersion: string;
  • Type: string

Package version from package.json (if available).


pipelineVersionOptional
public readonly pipelineVersion: string;
  • Type: string

Pipeline version/execution ID.


repositoryUrlOptional
public readonly repositoryUrl: string;
  • Type: string

Repository URL.


tagOptional
public readonly tag: string;
  • Type: string

Git tag (if available).


IVersioningStrategy

Versioning strategy interface.

Properties

Name Type Description
components VersioningStrategyComponents Strategy components configuration.
format string Format string for version computation Supports placeholders: {git-tag}, {package-version}, {commit-count}, {commit-hash}, {branch}, {build-number}.

componentsRequired
public readonly components: VersioningStrategyComponents;

Strategy components configuration.


formatRequired
public readonly format: string;
  • Type: string

Format string for version computation Supports placeholders: {git-tag}, {package-version}, {commit-count}, {commit-hash}, {branch}, {build-number}.