Skip to content

Commit

Permalink
[DOP-4334]: Use dotcomstg
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Feb 20, 2024
1 parent d26a7c6 commit 8671907
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 19 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/clean-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
- closed

name: Cleanup Feature Branch Infrastructure
jobs:
jobs:
destroy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
Expand All @@ -25,11 +25,11 @@ jobs:
run: |
cd cdk-infra/
npm ci
npm run cdk destroy -- -c customFeatureName=enhancedApp-stg-${{github.head_ref}} --force \
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker \
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-queues \
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks
npm run cdk destroy -- -c customFeatureName=enhancedApp-dotcomstg-${{github.head_ref}} --force \
auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-worker \
auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-queues \
auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-webhooks
- name: Delete cache
run: gh cache delete ${{github.head_ref}}
env:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/deploy-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
npm ci
cd cdk-infra/
npm ci
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-queues
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks --outputs-file outputs.json
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=dotcomstg -c customFeatureName=enhancedApp-dotcomstg-${{github.head_ref}} auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-queues
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=dotcomstg -c customFeatureName=enhancedApp-dotcomstg-${{github.head_ref}} auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-worker
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=dotcomstg -c customFeatureName=enhancedApp-dotcomstg-${{github.head_ref}} auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-webhooks --outputs-file outputs.json
- name: Get Webhook URL
uses: mongodb/docs-worker-actions/comment-pr@main
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- synchronize

concurrency:
group: environment-stg-feature-${{ github.ref }}
group: environment-dotcomstg-feature-${{ github.ref }}
cancel-in-progress: true
name: Update Feature Branch Infrastructure
jobs:
Expand Down Expand Up @@ -73,8 +73,8 @@ jobs:
if: steps.filter.outputs.webhooks == 'true'
run: |
cd cdk-infra/
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} \
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=dotcomstg -c customFeatureName=enhancedApp-dotcomstg-${{github.head_ref}} \
auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-webhooks
build-worker:
needs: prep-build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -109,5 +109,5 @@ jobs:
if: steps.filter.outputs.worker == 'true'
run: |
cd cdk-infra/
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} \
auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker
npm run deploy:feature:stack -- -c isFeatureBranch=true -c env=dotcomstg -c customFeatureName=enhancedApp-dotcomstg-${{github.head_ref}} \
auto-builder-stack-enhancedApp-dotcomstg-${{github.head_ref}}-worker
2 changes: 1 addition & 1 deletion cdk-infra/lib/constructs/worker/worker-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { LogGroup } from 'aws-cdk-lib/aws-logs';
import { IQueue } from 'aws-cdk-lib/aws-sqs';
import { Construct } from 'constructs';
import path from 'path';
import { getEnv, isEnhanced } from '../../../utils/env';
import { getEnv } from '../../../utils/env';

interface WorkerConstructProps {
dockerEnvironment: Record<string, string>;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/src/shared/next-gen-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export async function nextGenDeploy({
},
}
);
const output = `COMMAND: yes | mut-publish public ${bucket} --prefix=${mutPrefix} --deploy --deployed-url-prefix=${url} --json --all-subdirectories --dry-run
const output = `COMMAND: yes | mut-publish public ${bucket} --prefix=${mutPrefix} --deploy --deployed-url-prefix=${url} --json --all-subdirectories
\n${outputText} \n ${errorText} \n Hosted at ${url}${mutPrefix}
`;

Expand Down
9 changes: 7 additions & 2 deletions src/job/productionJobHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { IConfig } from 'config';
import type { Job } from '../entities/job';
import { InvalidJobError } from '../errors/errors';
import { DocsetsRepository } from '../repositories/docsetsRepository';
import { JobRepository } from '../repositories/jobRepository';
import { RepoBranchesRepository } from '../repositories/repoBranchesRepository';
Expand Down Expand Up @@ -182,10 +181,16 @@ export class ProductionJobHandler extends JobHandler {
const { mutPrefix, branchName } = this.currJob.payload;
await this.logger.save(this.currJob._id, `${'(prod)'.padEnd(15)} Begin Deploy without makefiles`);

// using this as a way to test deploy with feature branches in dotcomstg (preprod)
const finalMutPrefix =
process.env.IS_FEATURE_BRANCH === 'true' && process.env.FEATURE_NAME
? `${mutPrefix}${process.env.FEATURE_NAME}`
: mutPrefix;

const { bucket, url } = await this.getEnvironmentVariables();
const hasConfigRedirects = await checkRedirects(this.currJob.payload.repoName, this.currJob.payload.directory);

resp = await nextGenDeploy({ mutPrefix, bucket, url, branchName, hasConfigRedirects });
resp = await nextGenDeploy({ mutPrefix: finalMutPrefix, bucket, url, branchName, hasConfigRedirects });
} else {
resp = await this.deployWithMakefiles();
}
Expand Down

0 comments on commit 8671907

Please sign in to comment.