Skip to content

Commit

Permalink
Logging Changes for Promote, Reject actions (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsubramanianaks authored Jul 6, 2022
1 parent a17f35b commit 72a09f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
24 changes: 16 additions & 8 deletions src/actions/promote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,30 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {

// In case of SMI traffic split strategy when deployment is promoted, first we will redirect traffic to
// canary deployment, then update stable deployment and then redirect traffic to stable deployment
core.info('Redirecting traffic to canary deployment')
core.startGroup('Redirecting traffic to canary deployment')
await SMICanaryDeploymentHelper.redirectTrafficToCanaryDeployment(
kubectl,
manifests
)
core.endGroup()

core.info('Deploying input manifests with SMI canary strategy')
core.startGroup('Deploying input manifests with SMI canary strategy')
await deploy.deploy(kubectl, manifests, DeploymentStrategy.CANARY)
core.endGroup()

core.info('Redirecting traffic to stable deployment')
core.startGroup('Redirecting traffic to stable deployment')
await SMICanaryDeploymentHelper.redirectTrafficToStableDeployment(
kubectl,
manifests
)
core.endGroup()
} else {
core.info('Deploying input manifests')
core.startGroup('Deploying input manifests')
await deploy.deploy(kubectl, manifests, DeploymentStrategy.CANARY)
core.endGroup()
}

core.info('Deleting canary and baseline workloads')
core.startGroup('Deleting canary and baseline workloads')
try {
await canaryDeploymentHelper.deleteCanaryDeployment(
kubectl,
Expand All @@ -97,6 +101,7 @@ async function promoteCanary(kubectl: Kubectl, manifests: string[]) {
ex
)
}
core.endGroup()
}

async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
Expand All @@ -109,7 +114,7 @@ async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
core.getInput('route-method', {required: true})
)

core.info('Deleting old deployment and making new one')
core.startGroup('Deleting old deployment and making new one')
let result
if (routeStrategy == RouteStrategy.INGRESS) {
result = await promoteBlueGreenIngress(kubectl, manifestObjects)
Expand All @@ -118,9 +123,10 @@ async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
} else {
result = await promoteBlueGreenService(kubectl, manifestObjects)
}
core.endGroup()

// checking stability of newly created deployments
core.info('Checking manifest stability')
core.startGroup('Checking manifest stability')
const deployedManifestFiles = result.newFilePaths
const resources: Resource[] = getResources(
deployedManifestFiles,
Expand All @@ -129,8 +135,9 @@ async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
])
)
await KubernetesManifestUtility.checkManifestStability(kubectl, resources)
core.endGroup()

core.info(
core.startGroup(
'Routing to new deployments and deleting old workloads and services'
)
if (routeStrategy == RouteStrategy.INGRESS) {
Expand Down Expand Up @@ -170,4 +177,5 @@ async function promoteBlueGreen(kubectl: Kubectl, manifests: string[]) {
manifestObjects.deploymentEntityList
)
}
core.endGroup()
}
9 changes: 6 additions & 3 deletions src/actions/reject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,26 @@ async function rejectCanary(kubectl: Kubectl, manifests: string[]) {
core.getInput('traffic-split-method', {required: true})
)
if (trafficSplitMethod == TrafficSplitMethod.SMI) {
core.info('Rejecting deployment with SMI canary strategy')
core.startGroup('Rejecting deployment with SMI canary strategy')
includeServices = true
await SMICanaryDeploymentHelper.redirectTrafficToStableDeployment(
kubectl,
manifests
)
core.endGroup()
}

core.info('Deleting baseline and canary workloads')
core.startGroup('Deleting baseline and canary workloads')
await canaryDeploymentHelper.deleteCanaryDeployment(
kubectl,
manifests,
includeServices
)
core.endGroup()
}

async function rejectBlueGreen(kubectl: Kubectl, manifests: string[]) {
core.info('Rejecting deployment with blue green strategy')
core.startGroup('Rejecting deployment with blue green strategy')

const routeStrategy = parseRouteStrategy(
core.getInput('route-method', {required: true})
Expand All @@ -65,4 +67,5 @@ async function rejectBlueGreen(kubectl: Kubectl, manifests: string[]) {
} else {
await rejectBlueGreenService(kubectl, manifests)
}
core.endGroup()
}

0 comments on commit 72a09f4

Please sign in to comment.