Skip to content
Snippets Groups Projects
Select Git revision
  • 0fed580ddd8b329a3f9f209e59772f059b47d20e
  • dev default protected
  • prod protected
  • 1.0.58
  • 1.0.57
  • 1.0.52
  • 1.0.56
  • 1.0.51
  • 1.0.50
  • 1.0.33
  • 1.0.32
  • 1.0.31
  • 1.0.30
  • 1.0.29
  • 1.0.28
  • 1.0.27
  • 1.0.26
  • 1.0.25
  • 1.0.24
  • 1.0.23
  • 1.0.22
  • 1.0.21
  • 1.0.20
23 results

module.xml

Blame
  • cdk.go 5.71 KiB
    package _magefile
    
    import (
    	_ "embed"
    	"fmt"
    	"io/ioutil"
    	"os"
    	"os/exec"
    	"strconv"
    	"strings"
    
    	"gopkg.in/yaml.v2"
    )
    
    func CDKCompileTypeScript(cdkDir string) error {
    	fmt.Println("Compiling Typescript")
    
    	cmd := exec.Command("tsc")
    	cmd.Stdout = os.Stdout
    	cmd.Stderr = os.Stderr
    	cmd.Dir = cdkDir
    	err := cmd.Run()
    
    	if err != nil {
    		return err
    	}
    	return nil
    }
    
    func CDKDiff(cdkDir string, env string, stack string, local bool, profile string) error {
    	fmt.Println("Getting Diff for: " + stack)
    
    	commandArgs := []string{
    		`diff`,
    		stack,
    		`-c`,
    		fmt.Sprintf(`config=%v`, env),
    		`-c`,
    		fmt.Sprintf(`exclusively=%v`, stack),
    		`-c`,
    		`aws-cdk:enableDiffNoFail=true`,
    	}
    
    	if local {
    		commandArgs = append(commandArgs, fmt.Sprintf(`--profile=%v`, profile))
    	}
    
    	commandArgs = append(commandArgs,
    		`--require-approval=never`,
    		`--exclusively=true`,
    		`--progress=events`)
    
    	fmt.Println(fmt.Sprintf("Running command: cdk %s", strings.Join(commandArgs, " ")))
    	cmd := exec.Command("cdk", commandArgs...)
    	cmd.Dir = cdkDir
    
    	output, err := cmd.CombinedOutput()
    	if err != nil {
    		fmt.Println(string(output))
    		return err
    	}
    	fmt.Println(string(output))
    	return nil
    }
    
    func CDKDeploy(cdkDir string, env string, stack string, exclusively bool, local bool, profile string) error {
    	commandArgs := []string{
    		`deploy`,
    		fmt.Sprintf(`"%s"`, stack),
    		`-c`,