From f16f91014e358b6d3d7bac4ec1b83e335acb6695 Mon Sep 17 00:00:00 2001 From: Ashleigh Simonelli Date: Fri, 25 Mar 2022 09:21:04 +0000 Subject: [PATCH] fix: envs for deployment (#6482) * feat: added buildStatus to pipeline list * fix: corrected env in cdk * fix: corrected script envs for hosted zone Co-authored-by: Josh Balfour --- packages/cli/src/commands/pipeline/list.ts | 3 ++- packages/deployment-service/cdk/lib/create-policies.ts | 3 +-- .../src/functions/pipeline/codebuild-executor.ts | 8 ++++++-- .../src/functions/pipeline/pipeline-setup.ts | 2 +- .../src/functions/pipeline/pipeline-tear-down.ts | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/commands/pipeline/list.ts b/packages/cli/src/commands/pipeline/list.ts index 7e8285cba9..4e8da0eb32 100644 --- a/packages/cli/src/commands/pipeline/list.ts +++ b/packages/cli/src/commands/pipeline/list.ts @@ -31,9 +31,10 @@ export class PipelineList extends AbstractCommand { appType: pipeline.appType, appId: pipeline.appId, repository: pipeline.repository, + buildStatus: pipeline.buildStatus, created: shleemy(new Date(pipeline.created as string)).forHumans, })), - ['id', 'name', 'appType', 'version', 'appId', 'repository', 'created'], + ['id', 'name', 'appType', 'version', 'appId', 'buildStatus', 'repository', 'created'], ) } } diff --git a/packages/deployment-service/cdk/lib/create-policies.ts b/packages/deployment-service/cdk/lib/create-policies.ts index 5815d2fab2..5892d787e5 100644 --- a/packages/deployment-service/cdk/lib/create-policies.ts +++ b/packages/deployment-service/cdk/lib/create-policies.ts @@ -63,8 +63,7 @@ export const createPolicies = ({ const route53Policy = new PolicyStatement({ effect: Effect.ALLOW, resources: [ - // TODO: env - 'arn:aws:route53:::hostedzone/Z02367201ZA0CZPSM3N2H', // is this safe to put in without env? + `arn:aws:route53:::hostedzone/${config.HOSTED_ZONE_ID}`, ], actions: [ 'route53:GetHostedZone', diff --git a/packages/deployment-service/src/functions/pipeline/codebuild-executor.ts b/packages/deployment-service/src/functions/pipeline/codebuild-executor.ts index 8d52aafcc9..4d6a13e520 100644 --- a/packages/deployment-service/src/functions/pipeline/codebuild-executor.ts +++ b/packages/deployment-service/src/functions/pipeline/codebuild-executor.ts @@ -6,7 +6,7 @@ import { CodeBuild } from 'aws-sdk' import yaml from 'yaml' import { PackageManagerEnum } from '../../../../foundations-ts-definitions/deployment-schema' import { QueueNames } from '../../constants' -import { sqs, savePipelineRunnerEntity, s3Client, githubApp, getBitBucketToken } from '../../services' +import { sqs, savePipelineRunnerEntity, s3Client, githubApp, getBitBucketToken, pusher } from '../../services' import { PipelineEntity } from '../../entities/pipeline.entity' import fetch from 'node-fetch' import { BitbucketClientData } from '@/entities/bitbucket-client.entity' @@ -231,7 +231,11 @@ export const codebuildExecutor: SQSHandler = async ( pipeline.buildStatus = 'FAILED' pipelineRunner.pipeline = pipeline - await Promise.all([deleteMessage(record.receiptHandle), savePipelineRunnerEntity(pipelineRunner)]) + await Promise.all([ + deleteMessage(record.receiptHandle), + savePipelineRunnerEntity(pipelineRunner), + pusher.trigger(`private-${pipelineRunner.pipeline?.developerId}`, 'pipeline-runner-update', pipelineRunner), + ]) return Promise.reject(error) } diff --git a/packages/deployment-service/src/functions/pipeline/pipeline-setup.ts b/packages/deployment-service/src/functions/pipeline/pipeline-setup.ts index 67229b413c..c50119845c 100644 --- a/packages/deployment-service/src/functions/pipeline/pipeline-setup.ts +++ b/packages/deployment-service/src/functions/pipeline/pipeline-setup.ts @@ -113,7 +113,7 @@ export const pipelineSetup: SQSHandler = async (event: SQSEvent, context: Contex Action: 'UPSERT', ResourceRecordSet: { Type: 'A', - Name: `${pipeline.subDomain}.dev.paas.reapit.cloud`, + Name: `${pipeline.subDomain}.${process.env.NODE_ENV === 'PROD' ? 'prod' : 'dev'}.paas.reapit.cloud`, AliasTarget: { DNSName: frontDomain, EvaluateTargetHealth: false, diff --git a/packages/deployment-service/src/functions/pipeline/pipeline-tear-down.ts b/packages/deployment-service/src/functions/pipeline/pipeline-tear-down.ts index 802c2d6e96..33a752a11c 100644 --- a/packages/deployment-service/src/functions/pipeline/pipeline-tear-down.ts +++ b/packages/deployment-service/src/functions/pipeline/pipeline-tear-down.ts @@ -99,7 +99,7 @@ const tearDownR53 = (domain: string, pipelineId: string, subDomain: string): Pro Action: 'DELETE', ResourceRecordSet: { Type: 'A', - Name: `${subDomain}.dev.paas.reapit.cloud`, + Name: `${subDomain}.${process.env.NODE_ENV === 'PROD' ? 'prod' : 'dev'}.paas.reapit.cloud`, AliasTarget: { DNSName: domain, EvaluateTargetHealth: false,