cdkgittagger

package module
v0.0.147 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

CDK Aspect Git Tagger

This is a CDK Aspect that will tag your CDK Stacks with the current git repo location for easier identification of deployed stacks. Will create a .git-url-tagger.json file in the root of your project to store the git url. This file will be used to determine the git url for the stack.

How to install
npm install @jjrawlins/cdk-git-tagger

or

yarn add @jjrawlins/cdk-git-tagger
How to use
import { GitUrlTagger } from '@jjrawlins/cdk-git-tagger';
import { App, Aspects, Stack, StackProps } from 'aws-cdk-lib';
import { Topic } from 'aws-cdk-lib/aws-sns';
import { Construct } from 'constructs';

export class MyStack extends Stack {
    constructor(scope: Construct, id: string, props: StackProps = {}) {
        super(scope, id, props);
        // define resources here...
        new Topic(this, 'MyTopic');
    }
}

const app = new App();

new MyStack(app, 'cdk-aspect-git-tagger-tester');
Aspects.of(app).add(new GitUrlTagger());
app.synth();
Example Output
{
  "Resources": {
    "MyTopic86869434": {
      "Type": "AWS::SNS::Topic",
      "Properties": {
        "Tags": [
          {
            "Key": "GitUrl",
            "Value": "https://github.com/jjrawlins/cdk-cool-construct.git"
          }
        ]
      }
    }
  }
}

Documentation

Overview

CDK Aspect to tag resources with git metadata. This provides a nice connection between the construct and the git repository.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGitUrlTagger_Override

func NewGitUrlTagger_Override(g GitUrlTagger, props *GitUrlTaggerProps)

Types

type GitUrlTagger

type GitUrlTagger interface {
	awscdk.IAspect
	FindGitDirectory() *string
	PutGitUrlInFile(gitUrl *string)
	RetrieveGitUrl() *string
	// All aspects can visit an IConstruct.
	Visit(node constructs.IConstruct)
}

func NewGitUrlTagger

func NewGitUrlTagger(props *GitUrlTaggerProps) GitUrlTagger

type GitUrlTaggerProps

type GitUrlTaggerProps struct {
	// A flag on whether to try to normalize the URL found in the git config If enabled, it will turn ssh urls into https urls.
	// Default: true.
	//
	NormalizeUrl *bool `field:"optional" json:"normalizeUrl" yaml:"normalizeUrl"`
	// The Tag key/name to use.
	// Default: 'GitUrl'.
	//
	TagName *string `field:"optional" json:"tagName" yaml:"tagName"`
}

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL