Construct for creating version outputs in CloudFormation and SSM Parameter Store.
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. |
- Type: constructs.Construct
- Type: string
- Type: VersionOutputsProps
| Name | Description |
|---|---|
toString |
Returns a string representation of this construct. |
public toString(): stringReturns a string representation of this construct.
| Name | Description |
|---|---|
isConstruct |
Checks if x is a construct. |
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.
- Type: any
Any object.
| 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). |
public readonly node: Node;- Type: constructs.Node
The tree node.
public readonly versionInfo: VersionInfo;- Type: VersionInfo
The version information.
public readonly outputs: {[ key: string ]: CfnOutput};- Type: {[ key: string ]: aws-cdk-lib.CfnOutput}
CloudFormation outputs (if enabled).
public readonly parameters: {[ key: string ]: StringParameter};- Type: {[ key: string ]: aws-cdk-lib.aws_ssm.StringParameter}
SSM Parameters (if enabled).
Build number configuration.
import { BuildNumberConfig } from 'cdk-devops'
const buildNumberConfig: BuildNumberConfig = { ... }| Name | Type | Description |
|---|---|---|
envVar |
string |
Environment variable to read build number from. |
public readonly envVar: string;- Type: string
- Default: 'BUILD_NUMBER'
Environment variable to read build number from.
Options for CloudFormation-only output configuration.
import { CloudFormationOnlyOptions } from 'cdk-devops'
const cloudFormationOnlyOptions: CloudFormationOnlyOptions = { ... }| Name | Type | Description |
|---|---|---|
exportName |
string |
Export name for cross-stack references. |
format |
string |
Output format. |
stackOutputName |
string |
Stack output name. |
public readonly exportName: string;- Type: string
Export name for cross-stack references.
public readonly format: string;- Type: string
- Default: 'plain'
Output format.
public readonly stackOutputName: string;- Type: string
Stack output name.
CloudFormation output configuration.
import { CloudFormationOutputConfig } from 'cdk-devops'
const cloudFormationOutputConfig: CloudFormationOutputConfig = { ... }| 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.). |
public readonly enabled: boolean;- Type: boolean
- Default: true
Whether to create CloudFormation outputs.
public readonly export: boolean;- Type: boolean
- Default: false
Whether to export the outputs for cross-stack references.
public readonly exportNameTemplate: string;- Type: string
Export name template (supports {version}, {environment}, etc.).
Commit count configuration.
import { CommitCountConfig } from 'cdk-devops'
const commitCountConfig: CommitCountConfig = { ... }| 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'). |
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.
public readonly padding: number;- Type: number
- Default: 0
Padding for commit count (e.g., 5 means '00042').
Context for version computation.
import { ComputationContext } from 'cdk-devops'
const computationContext: ComputationContext = { ... }| 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. |
public readonly environment: string;- Type: string
Environment/stage name.
public readonly gitInfo: GitInfo;- Type: GitInfo
Git information.
public readonly buildNumber: string;- Type: string
Build number.
public readonly deploymentTime: string;- Type: string
Deployment timestamp.
public readonly packageVersion: string;- Type: string
Package version from package.json.
public readonly pipelineVersion: string;- Type: string
Pipeline version/execution ID.
public readonly repositoryUrl: string;- Type: string
Repository URL.
Git repository information.
import { GitInfo } from 'cdk-devops'
const gitInfo: GitInfo = { ... }| 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). |
public readonly branch: string;- Type: string
Current branch name.
public readonly commitCount: number;- Type: number
Total commit count.
public readonly commitHash: string;- Type: string
Full commit hash.
public readonly shortCommitHash: string;- Type: string
Short commit hash (typically 8 characters).
public readonly commitsSinceTag: number;- Type: number
Commit count since last tag.
public readonly tag: string;- Type: string
Git tag (if on a tagged commit).
Props for creating GitInfo.
import { GitInfoProps } from 'cdk-devops'
const gitInfoProps: GitInfoProps = { ... }| 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). |
public readonly branch: string;- Type: string
Current branch name.
public readonly commitCount: number;- Type: number
Total commit count.
public readonly commitHash: string;- Type: string
Full commit hash.
public readonly commitsSinceTag: number;- Type: number
Commit count since last tag.
public readonly tag: string;- Type: string
Git tag (if on a tagged commit).
Git tag configuration for version extraction.
import { GitTagConfig } from 'cdk-devops'
const gitTagConfig: GitTagConfig = { ... }| 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'). |
public readonly countCommitsSince: boolean;- Type: boolean
- Default: true
Whether to count commits since the last tag.
public readonly pattern: string;- Type: string
- Default: '..*'
Pattern to match git tags.
public readonly prefix: string;- Type: string
- Default: 'v'
Prefix to strip from git tags (e.g., 'v' for tags like 'v1.2.3').
Options for hierarchical parameter configuration.
import { HierarchicalParametersOptions } from 'cdk-devops'
const hierarchicalParametersOptions: HierarchicalParametersOptions = { ... }| Name | Type | Description |
|---|---|---|
format |
string |
Output format. |
includeCloudFormation |
boolean |
Whether to include CloudFormation outputs. |
public readonly format: string;- Type: string
- Default: 'plain'
Output format.
public readonly includeCloudFormation: boolean;- Type: boolean
- Default: false
Whether to include CloudFormation outputs.
Package.json version configuration.
import { PackageJsonConfig } from 'cdk-devops'
const packageJsonConfig: PackageJsonConfig = { ... }| Name | Type | Description |
|---|---|---|
includePrerelease |
boolean |
Whether to include prerelease identifiers. |
public readonly includePrerelease: boolean;- Type: boolean
- Default: true
Whether to include prerelease identifiers.
SSM Parameter Store output configuration.
import { ParameterStoreOutputConfig } from 'cdk-devops'
const parameterStoreOutputConfig: ParameterStoreOutputConfig = { ... }| 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. |
public readonly basePath: string;- Type: string
Base path for parameters (e.g., '/myapp/version').
public readonly description: string;- Type: string
Description for the parameter.
public readonly enabled: boolean;- Type: boolean
- Default: true
Whether to create SSM parameters.
public readonly splitParameters: boolean;- Type: boolean
- Default: false
Whether to split version info into separate parameters.
Options for standard output configuration.
import { StandardOutputOptions } from 'cdk-devops'
const standardOutputOptions: StandardOutputOptions = { ... }| Name | Type | Description |
|---|---|---|
format |
string |
Output format. |
parameterName |
string |
Parameter name template. |
public readonly format: string;- Type: string
- Default: 'plain'
Output format.
public readonly parameterName: string;- Type: string
- Default: '/{stackName}/version'
Parameter name template.
Props for creating VersionInfo.
import { VersionInfoProps } from 'cdk-devops'
const versionInfoProps: VersionInfoProps = { ... }| 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. |
public readonly environment: string;- Type: string
Environment/stage name.
public readonly gitInfo: GitInfo;- Type: GitInfo
Git information.
public readonly version: string;- Type: string
Computed version string.
public readonly buildNumber: string;- Type: string
Build number.
public readonly deploymentTime: string;- Type: string
Deployment timestamp.
public readonly deploymentUser: string;- Type: string
Deployment username.
public readonly packageVersion: string;- Type: string
Package version from package.json.
public readonly pipelineVersion: string;- Type: string
Pipeline version/execution ID.
public readonly repositoryUrl: string;- Type: string
Repository URL.
Versioning configuration.
import { VersioningConfig } from 'cdk-devops'
const versioningConfig: VersioningConfig = { ... }| 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. |
public readonly outputs: VersioningOutputsConfig;- Type: VersioningOutputsConfig
Output configuration.
public readonly strategy: IVersioningStrategy;- Type: IVersioningStrategy
Versioning strategy.
public readonly enabled: boolean;- Type: boolean
- Default: true
Whether versioning is enabled.
public readonly stageOverrides: {[ key: string ]: VersioningConfig};- Type: {[ key: string ]: VersioningConfig}
Stage-specific configuration overrides.
Output configuration for version information.
import { VersioningOutputsConfig } from 'cdk-devops'
const versioningOutputsConfig: VersioningOutputsConfig = { ... }| Name | Type | Description |
|---|---|---|
cloudFormation |
CloudFormationOutputConfig |
CloudFormation output configuration. |
parameterStore |
ParameterStoreOutputConfig |
SSM Parameter Store configuration. |
public readonly cloudFormation: CloudFormationOutputConfig;CloudFormation output configuration.
public readonly parameterStore: ParameterStoreOutputConfig;SSM Parameter Store configuration.
Components that can be included in a versioning strategy.
import { VersioningStrategyComponents } from 'cdk-devops'
const versioningStrategyComponents: VersioningStrategyComponents = { ... }| Name | Type | Description |
|---|---|---|
buildNumber |
BuildNumberConfig |
Build number configuration. |
commitCount |
CommitCountConfig |
Commit count configuration. |
gitTag |
GitTagConfig |
Git tag configuration. |
packageJson |
PackageJsonConfig |
Package.json version configuration. |
public readonly buildNumber: BuildNumberConfig;- Type: BuildNumberConfig
Build number configuration.
public readonly commitCount: CommitCountConfig;- Type: CommitCountConfig
Commit count configuration.
public readonly gitTag: GitTagConfig;- Type: GitTagConfig
Git tag configuration.
public readonly packageJson: PackageJsonConfig;- Type: PackageJsonConfig
Package.json version configuration.
Props for VersionOutputs construct.
import { VersionOutputsProps } from 'cdk-devops'
const versionOutputsProps: VersionOutputsProps = { ... }| 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. |
public readonly versionInfo: VersionInfo;- Type: VersionInfo
Version information to output.
public readonly cloudFormation: CloudFormationOutputConfig;- Type: CloudFormationOutputConfig
- Default: CloudFormation outputs enabled
CloudFormation output configuration.
public readonly metadataKey: string;- Type: string
- Default: 'Version'
Metadata key.
public readonly outputPrefix: string;- Type: string
- Default: 'Version'
Prefix for output names.
public readonly parameterStore: ParameterStoreOutputConfig;- Type: ParameterStoreOutputConfig
- Default: Parameter Store disabled
SSM Parameter Store configuration.
Composite computation strategy that replaces template variables.
import { CompositeComputation } from 'cdk-devops'
new CompositeComputation(strategy: IVersioningStrategy)| Name | Type | Description |
|---|---|---|
strategy |
IVersioningStrategy |
No description. |
- Type: IVersioningStrategy
| Name | Description |
|---|---|
compute |
Compute version by replacing template variables in format string. |
public compute(context: ComputationContext): stringCompute version by replacing template variables in format string.
- Type: ComputationContext
Helper class for working with Git information.
import { GitInfoHelper } from 'cdk-devops'
new GitInfoHelper()| Name | Type | Description |
|---|
| 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. |
import { GitInfoHelper } from 'cdk-devops'
GitInfoHelper.create(props: GitInfoProps)Create GitInfo from individual components.
- Type: GitInfoProps
import { GitInfoHelper } from 'cdk-devops'
GitInfoHelper.fromEnvironment()Create GitInfo from environment variables (CI/CD context).
import { GitInfoHelper } from 'cdk-devops'
GitInfoHelper.isMainBranch(branch: string)Check if on a main branch.
- Type: string
import { GitInfoHelper } from 'cdk-devops'
GitInfoHelper.isTaggedRelease(gitInfo: GitInfo)Check if on a tagged release.
- Type: GitInfo
import { GitInfoHelper } from 'cdk-devops'
GitInfoHelper.shortenHash(hash: string, length?: number)Shorten a git commit hash to 8 characters.
- Type: string
- Type: number
Abstract base class for version computation strategies.
import { VersionComputationStrategy } from 'cdk-devops'
new VersionComputationStrategy()| Name | Type | Description |
|---|
| Name | Description |
|---|---|
compute |
Compute version string from context. |
public compute(context: ComputationContext): stringCompute version string from context.
- Type: ComputationContext
Main version computer class.
import { VersionComputer } from 'cdk-devops'
new VersionComputer(strategy: IVersioningStrategy)| Name | Type | Description |
|---|---|---|
strategy |
IVersioningStrategy |
No description. |
- Type: IVersioningStrategy
| Name | Description |
|---|---|
compute |
Compute version from context. |
computeVersionString |
Compute version string only (without creating VersionInfo). |
public compute(context: ComputationContext): VersionInfoCompute version from context.
- Type: ComputationContext
public computeVersionString(context: ComputationContext): stringCompute version string only (without creating VersionInfo).
- Type: ComputationContext
- Implements: IVersionInfo
Version information for deployments.
| 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. |
public displayVersion(): stringGet display version (prefers tag if available).
public exportName(template: string): stringGet export name from template.
- Type: string
public isMainBranch(): booleanCheck if deployed from main branch.
public isTaggedRelease(): booleanCheck if this is a tagged release.
public parameterName(template: string): stringGet SSM parameter name from template.
- Type: string
public toJson(): stringConvert to JSON string.
public toObject(): IVersionInfoConvert to plain object.
| Name | Description |
|---|---|
compare |
Compare two version infos. |
create |
Create VersionInfo from props. |
fromEnvironment |
Create VersionInfo from environment variables. |
fromJson |
Create VersionInfo from JSON string. |
import { VersionInfo } from 'cdk-devops'
VersionInfo.compare(a: VersionInfo, b: VersionInfo)Compare two version infos.
- Type: VersionInfo
- Type: VersionInfo
import { VersionInfo } from 'cdk-devops'
VersionInfo.create(props: VersionInfoProps)Create VersionInfo from props.
- Type: VersionInfoProps
import { VersionInfo } from 'cdk-devops'
VersionInfo.fromEnvironment(version: string, environment: string)Create VersionInfo from environment variables.
- Type: string
- Type: string
import { VersionInfo } from 'cdk-devops'
VersionInfo.fromJson(json: string)Create VersionInfo from JSON string.
- Type: string
| 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). |
public readonly branch: string;- Type: string
Git branch name.
public readonly commitCount: number;- Type: number
Total commit count.
public readonly commitHash: string;- Type: string
Git commit hash.
public readonly deploymentTime: string;- Type: string
Deployment timestamp.
public readonly deploymentUser: string;- Type: string
Deployment username.
public readonly environment: string;- Type: string
Environment/stage name.
public readonly shortCommitHash: string;- Type: string
Git commit hash (short form, typically 8 characters).
public readonly version: string;- Type: string
Computed version string.
public readonly buildNumber: string;- Type: string
Build number (if available).
public readonly packageVersion: string;- Type: string
Package version from package.json (if available).
public readonly pipelineVersion: string;- Type: string
Pipeline version/execution ID.
public readonly repositoryUrl: string;- Type: string
Repository URL.
public readonly tag: string;- Type: string
Git tag (if available).
Builder for VersionInfo.
import { VersionInfoBuilder } from 'cdk-devops'
new VersionInfoBuilder()| Name | Type | Description |
|---|
| 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. |
public buildVersionInfo(): VersionInfoBuild the VersionInfo instance.
public withBuildNumber(buildNumber?: string): VersionInfoBuilderSet build number.
- Type: string
public withDeploymentTime(deploymentTime?: string): VersionInfoBuilderSet deployment time.
- Type: string
public withDeploymentUser(deploymentUser?: string): VersionInfoBuilderSet deployment username.
- Type: string
public withEnvironment(environment: string): VersionInfoBuilderSet environment.
- Type: string
public withGitInfo(gitInfo: GitInfo): VersionInfoBuilderSet git information.
- Type: GitInfo
public withPackageVersion(packageVersion?: string): VersionInfoBuilderSet package version.
- Type: string
public withPipelineVersion(pipelineVersion?: string): VersionInfoBuilderSet pipeline version.
- Type: string
public withRepositoryUrl(repositoryUrl?: string): VersionInfoBuilderSet repository URL.
- Type: string
public withVersion(version: string): VersionInfoBuilderSet version string.
- Type: string
Factory class for creating versioning output configurations.
import { VersioningOutputsFactory } from 'cdk-devops'
new VersioningOutputsFactory()| Name | Type | Description |
|---|
| 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. |
import { VersioningOutputsFactory } from 'cdk-devops'
VersioningOutputsFactory.cloudFormationOnly(options?: CloudFormationOnlyOptions)CloudFormation-only output configuration.
import { VersioningOutputsFactory } from 'cdk-devops'
VersioningOutputsFactory.hierarchicalParameters(basePath: string, options?: HierarchicalParametersOptions)Hierarchical Parameter Store configuration.
- Type: string
import { VersioningOutputsFactory } from 'cdk-devops'
VersioningOutputsFactory.minimal()Minimal output configuration with only CloudFormation outputs.
import { VersioningOutputsFactory } from 'cdk-devops'
VersioningOutputsFactory.standard(options?: StandardOutputOptions)Standard output configuration with CloudFormation and Parameter Store.
- Type: StandardOutputOptions
- Implements: IVersioningStrategy
Versioning strategy implementation.
| 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}. |
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.buildNumber(config?: BuildNumberConfig)Strategy using build number and commit information Format: build-{commit-count}-{commit-hash:8}.
- Type: BuildNumberConfig
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.commitCount(config?: CommitCountConfig)Strategy using commit count Format: 0.0.{commit-count}.
- Type: CommitCountConfig
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.commitHash()Strategy using commit hash Format: {commit-hash:8}.
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.create(format: string, components?: VersioningStrategyComponents)Create a custom versioning strategy.
- Type: string
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.
- Type: GitTagConfig
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}.
- Type: GitTagConfig
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.packageJson(config?: PackageJsonConfig)Strategy using package.json version Format: {package-version}.
- Type: PackageJsonConfig
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.packageWithBranch(config?: PackageJsonConfig)Strategy combining package version with branch and commit info Format: {package-version}-{branch}.{commit-count}.
- Type: PackageJsonConfig
import { VersioningStrategy } from 'cdk-devops'
VersioningStrategy.semanticWithPatch(config?: PackageJsonConfig)Semantic versioning strategy with automatic patch increment Format: {package-version}.{commit-count}.
- Type: PackageJsonConfig
| 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}. |
public readonly components: VersioningStrategyComponents;Strategy components configuration.
public readonly format: string;- Type: string
Format string for version computation Supports placeholders: {git-tag}, {package-version}, {commit-count}, {commit-hash}, {branch}, {build-number}.
- Implemented By: VersionInfo, IVersionInfo
Version information interface.
| 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). |
public readonly branch: string;- Type: string
Git branch name.
public readonly commitCount: number;- Type: number
Total commit count.
public readonly commitHash: string;- Type: string
Git commit hash.
public readonly deploymentTime: string;- Type: string
Deployment timestamp.
public readonly deploymentUser: string;- Type: string
Deployment username.
public readonly environment: string;- Type: string
Environment/stage name.
public readonly shortCommitHash: string;- Type: string
Git commit hash (short form, typically 8 characters).
public readonly version: string;- Type: string
Computed version string.
public readonly buildNumber: string;- Type: string
Build number (if available).
public readonly packageVersion: string;- Type: string
Package version from package.json (if available).
public readonly pipelineVersion: string;- Type: string
Pipeline version/execution ID.
public readonly repositoryUrl: string;- Type: string
Repository URL.
public readonly tag: string;- Type: string
Git tag (if available).
- Implemented By: VersioningStrategy, IVersioningStrategy
Versioning strategy interface.
| 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}. |
public readonly components: VersioningStrategyComponents;Strategy components configuration.
public readonly format: string;- Type: string
Format string for version computation Supports placeholders: {git-tag}, {package-version}, {commit-count}, {commit-hash}, {branch}, {build-number}.