Skip to content

Commit

Permalink
Merge branch 'main' into DOP-4288
Browse files Browse the repository at this point in the history
  • Loading branch information
mayaraman19 authored Feb 14, 2024
2 parents c53a2fb + 1d12452 commit 52d36d3
Show file tree
Hide file tree
Showing 36 changed files with 133 additions and 370 deletions.
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
### Stories/Links:

DOP-NNNN

### Notes

### README updates

- [ ] This PR introduces changes that should be reflected in the README, and I have made those updates.
- [ ] This PR does not introduce changes that should be reflected in the README
14 changes: 7 additions & 7 deletions .github/workflows/deploy-feature-branch.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
on:
pull_request:
branches:
- main
- main
types:
- opened
- reopened
name: Initial Feature Branch Deploy
jobs:
jobs:
deploy:
permissions: write-all
runs-on: ubuntu-latest
Expand All @@ -26,12 +26,12 @@ jobs:
npm ci
cd cdk-infra/
npm ci
npm run deploy:feature:stack -- -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 env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-worker
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} auto-builder-stack-enhancedApp-stg-${{github.head_ref}}-webhooks --outputs-file outputs.json
- name: Get Webhook URL
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
- name: Get Webhook URL
uses: mongodb/docs-worker-actions/comment-pr@main
env:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cache root node_modules
id: cache-root
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/deploy-prd-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
npm ci
sls deploy --stage prd
sls deploy --stage dotcomprd
sls deploy --stage legacydotcomprd
- uses: mr-smithers-excellent/docker-build-push@v5
name: build and push to ECR
with:
Expand All @@ -57,19 +56,6 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
# - uses: mr-smithers-excellent/docker-build-push@v5
# name: build and push to ECR Legacy Dotcom
# with:
# image: docs-worker-pool-legacydotcomprd
# tags: latest, ${{ github.sha }}
# registry: ${{ steps.login-ecr.outputs.registry }}
# dockerfile: Dockerfile.legacy
# buildArgs: NPM_EMAIL=${{ secrets.NPM_EMAIL }},NPM_BASE_64_AUTH=${{ secrets.NPM_BASE64_AUTH }}
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
# NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
- name: Deploy ECS
run: |
cd infrastructure/ecs-main
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/deploy-prd-enhanced-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
concurrency:
group: environment-prd-enhanced-cacheUpdate-${{ github.ref }}
cancel-in-progress: true
name: Deploy Production ECS Enhanced Webhooks
name: Run Cache Update Check
jobs:
deploy-prd:
runs-on: ubuntu-latest
Expand All @@ -20,7 +20,7 @@ jobs:
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Rebuild Cache if New Snooty Parser Version
uses: mongodb/docs-worker-actions/rebuild-parse-cache@DOP-4294
env:
uses: mongodb/docs-worker-actions/rebuild-parse-cache@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKSPACE: ${{ github.workspace }}
WORKSPACE: ${{ github.workspace }}
17 changes: 1 addition & 16 deletions .github/workflows/deploy-stg-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- "main"
- "integration"
- "DOP-4306"
concurrency:
group: environment-stg-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -34,7 +35,6 @@ jobs:
npm ci
sls deploy --stage stg
sls deploy --stage dotcomstg
sls deploy --stage legacydotcomstg
- uses: mr-smithers-excellent/docker-build-push@v5
name: build and push to ECR
with:
Expand All @@ -59,30 +59,15 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
- uses: mr-smithers-excellent/docker-build-push@v5
name: build and push to ECR Legacy DOTCOM
with:
image: docs-worker-pool-legacydotcomstg
tags: latest
registry: ${{ steps.login-ecr.outputs.registry }}
dockerfile: Dockerfile.legacy
buildArgs: NPM_EMAIL=${{ secrets.NPM_EMAIL }},NPM_BASE_64_AUTH=${{ secrets.NPM_BASE64_AUTH }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE64_AUTH }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
- name: Deploy ECS
run: |
cd infrastructure/ecs-main
npm ci
sls deploy --stage stg
sls deploy --stage dotcomstg
sls deploy --stage legacydotcomstg
- name: Deploy Lambdas
run: |
npm ci
sls deploy --stage stg
sls deploy --stage dotcomstg
sls deploy --stage legacydotcomstg
sls prune -n 5
3 changes: 1 addition & 2 deletions .github/workflows/deploy-stg-enhanced-worker.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
paths: ["src/**", "cdk-infra/lib/constructs/worker/**", "Dockerfile.enhanced", "modules/**"]
paths: ['src/**', 'cdk-infra/lib/constructs/worker/**', 'Dockerfile', 'modules/**']
branches:
- 'main'
- 'integration'
Expand Down Expand Up @@ -29,4 +29,3 @@ jobs:
npm ci
npm run deploy:feature:stack -- -c env=dotcomstg -c customFeatureName=enhancedApp-dotcomstg auto-builder-stack-enhancedApp-dotcomstg-worker
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg auto-builder-stack-enhancedApp-stg-worker
12 changes: 6 additions & 6 deletions .github/workflows/update-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ concurrency:
group: environment-stg-feature-${{ github.ref }}
cancel-in-progress: true
name: Update Feature Branch Infrastructure
jobs:
jobs:
prep-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
if: steps.filter.outputs.webhooks == 'true'
run: |
cd cdk-infra/
npm run deploy:feature:stack -- -c env=stg -c customFeatureName=enhancedApp-stg-${{github.head_ref}} \
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
build-worker:
needs: prep-build
Expand Down Expand Up @@ -103,11 +103,11 @@ jobs:
worker:
- 'src/!(cache-updater/**)/**'
- 'cdk-infra/lib/constructs/worker/**'
- 'Dockerfile.enhanced'
- 'Dockerfile'
- 'modules/**'
- name: Update Worker Stack
if: steps.filter.outputs.worker == 'true'
run: |
cd cdk-infra/
npm run deploy:feature:stack -- -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}}-worker
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ WORKDIR /home/docsworker-xlarge
COPY config config/
COPY package*.json ./
COPY tsconfig*.json ./
RUN npm install
RUN npm ci --legacy-peer-deps
COPY . ./
RUN npm run build

# install persistence module
RUN cd ./modules/persistence \
&& npm install \
&& npm ci --legacy-peer-deps \
&& npm run build

# Build modules
# OAS Page Builder
RUN cd ./modules/oas-page-builder \
&& npm install \
&& npm ci --legacy-peer-deps \
&& npm run build

# where repo work will happen
Expand Down Expand Up @@ -102,14 +102,14 @@ RUN mkdir -p modules/persistence && chmod 755 modules/persistence
COPY --from=ts-compiler --chown=docsworker-xlarge /home/docsworker-xlarge/modules/persistence/package*.json ./modules/persistence/
COPY --from=ts-compiler --chown=docsworker-xlarge /home/docsworker-xlarge/modules/persistence/dist ./modules/persistence/
ENV PERSISTENCE_MODULE_PATH=${WORK_DIRECTORY}/modules/persistence/index.js
RUN cd ./modules/persistence/ && ls && npm install
RUN cd ./modules/persistence/ && ls && npm ci --legacy-peer-deps

# OAS Page Builder module copy
# Create directory and add permissions to allow node module installation
RUN mkdir -p modules/oas-page-builder && chmod 755 modules/oas-page-builder
COPY --from=ts-compiler --chown=docsworker-xlarge /home/docsworker-xlarge/modules/oas-page-builder/package*.json ./modules/oas-page-builder/
COPY --from=ts-compiler --chown=docsworker-xlarge /home/docsworker-xlarge/modules/oas-page-builder/dist ./modules/oas-page-builder/
RUN cd ./modules/oas-page-builder/ && npm install
RUN cd ./modules/oas-page-builder/ && npm ci --legacy-peer-deps

# Needed for OAS Page Builder module in shared.mk
ENV REDOC_PATH=${WORK_DIRECTORY}/redoc/cli/index.js
Expand Down
120 changes: 0 additions & 120 deletions Dockerfile.enhanced

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile.legacy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
FROM node:14-bullseye-slim

ARG MUT_VERSION=0.10.6

ENV PATH="${PATH}:/opt/mut"

RUN apt-get update && apt-get install -y --no-install-recommends \
Expand Down
2 changes: 1 addition & 1 deletion cdk-infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ To verify the CloudFormation is being generated successfully, you can use the `c
npm run cdk synth -- -c enhanced=true -c customFeatureName=enhancedApp > cdk.out/template.yaml
```

Make sure to update your `~/.aws/credentials` file. The `enhanced` context variable, if set to true, will use the `Dockerfile.enhanced` dockerfile instead of the standard one. The `featureName` context variable is used to provide a different name for a custom stack other than the branch name. In the future for feature branches, the context variable `isFeature` will be used to use the Git branch name and append that to the stack name.
Make sure to update your `~/.aws/credentials` file. The `enhanced` context variable, if set to true, will use the `Dockerfile` dockerfile instead of the standard one. The `featureName` context variable is used to provide a different name for a custom stack other than the branch name. In the future for feature branches, the context variable `isFeature` will be used to use the Git branch name and append that to the stack name.

## MongoDB Enhanced Infrastructure Commands

Expand Down
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 @@ -65,7 +65,6 @@ export class WorkerConstruct extends Construct {
executionRole.addToPolicy(executionRoleSsmPolicy);

const containerProps: AssetImageProps = {
file: isEnhanced() ? 'Dockerfile.enhanced' : undefined,
buildArgs: {
NPM_BASE_64_AUTH: dockerEnvironment.NPM_BASE_64_AUTH,
NPM_EMAIL: dockerEnvironment.NPM_EMAIL,
Expand Down Expand Up @@ -96,6 +95,7 @@ export class WorkerConstruct extends Construct {
taskDefinition.addContainer('workerImage', {
image: ContainerImage.fromAsset(path.join(__dirname, '../../../../'), containerProps),
environment: dockerEnvironment,
command: ['node', '--enable-source-maps', 'enhanced/enhancedApp.js'],
logging: LogDrivers.awsLogs({
streamPrefix: 'autobuilderworker',
logGroup: taskDefLogGroup,
Expand Down
Loading

0 comments on commit 52d36d3

Please sign in to comment.