Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #611 Remove AWS CodeCommit #619

Merged
merged 15 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Deploy environment"
description: "Trigger deployment of the specified environment"

inputs:
environment-name:
required: true
default: "production"
artifacts-s3-bucket:
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'

- name: Set VERSION in environment
shell: bash
run: |
app_version=$(git describe --tags --first-parent --abbrev=11 --long --dirty --always)
echo "VERSION=${app_version}" >> .env

- name: Zip artifact
shell: bash
run: |
artifact_name="${{ inputs.environment-name }}-entrypoint.zip"
zip -r -q $artifact_name .

- name: Send artifact to S3
shell: bash
run: |
artifact_name="${{ inputs.environment-name }}-entrypoint"
aws s3 cp "${artifact_name}.zip" "s3://${{ inputs.artifacts-s3-bucket }}/${artifact_name}"
25 changes: 25 additions & 0 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Deploy to production"

concurrency: Production

on:
workflow_dispatch:

jobs:
deployment:
runs-on: ubuntu-latest
environment: Production
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'

- uses: ./.github/workflows/actions/deploy
with:
environment-name: 'saas-prod'
artifacts-s3-bucket: '${{ secrets.SB_CI_ARTIFACTS_BUCKET }}'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
25 changes: 25 additions & 0 deletions .github/workflows/deploy-qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Deploy to QA"

concurrency: QA

on:
workflow_dispatch:

jobs:
deployment:
runs-on: ubuntu-latest
environment: QA
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: 'true'

- uses: ./.github/workflows/actions/deploy
with:
environment-name: 'saas-qa'
artifacts-s3-bucket: '${{ secrets.SB_CI_ARTIFACTS_BUCKET }}'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
1 change: 0 additions & 1 deletion .github/workflows/infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
infra-lib-name:
- infra-core
- infra-shared
- infra-functions
steps:
- uses: actions/checkout@v3
with:
Expand Down
22 changes: 0 additions & 22 deletions .github/workflows/main.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .versionrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ module.exports = {
filename: './packages/infra/infra-core/package.json',
type: 'json',
},
{
filename: './packages/infra/infra-functions/package.json',
type: 'json',
},
{
filename: './packages/infra/infra-shared/package.json',
type: 'json',
Expand Down
50 changes: 20 additions & 30 deletions bitbucket-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,20 @@ definitions:
--filter=webapp...

steps:
- step: &codecommitPush
name: Push code to CodeCommit
- step: &deploy-current-branch
name: Deploy environment
trigger: manual
clone:
depth: full
script:
- git remote add codecommit "$CODE_COMMIT_REPO"
- git push --force -u codecommit "$BITBUCKET_BRANCH"
- git push codecommit --tags --force
- *setupAwsCli
- sudo apt-get install zip
- |
app_version=$(git describe --tags --first-parent --abbrev=11 --long --dirty --always)
echo "VERSION=${app_version}" >> .env
artifact_name="${SB_DEPLOY_ENVIRONMENT_NAME}-entrypoint"
zip -r -q "${artifact_name}.zip" .
aws s3 cp "${artifact_name}.zip" "s3://${SB_CI_ARTIFACTS_BUCKET}/${artifact_name}"

- step: &webappTest
name: 'webapp: Lint & test'
Expand Down Expand Up @@ -443,21 +449,6 @@ definitions:
- pnpminfrashared
- clis

- step: &infraFunctionsBuild
name: 'infra/infra-functions: Lint & build'
image: atlassian/default-image:4
script:
- *initializeStep
- pnpm install
--include-workspace-root
--frozen-lockfile
--filter=infra-functions...
- pnpm nx run infra-functions:lint
- pnpm nx run infra-functions:build
caches:
- pnpminfrafunctions
- clis

# Internal steps

- step: &internalDocsBuild
Expand Down Expand Up @@ -513,8 +504,6 @@ definitions:
pipelines:
default:
- parallel:
- step: *codecommitPush

- step: *webappTest
- step: *webappBuild
- step: *webappCoreTest
Expand All @@ -535,7 +524,6 @@ pipelines:

- step: *infraCoreBuild
- step: *infraSharedBuild
- step: *infraFunctionsBuild

- step: *internalDocsBuild
- step: *internalStatusDashboardBuild
Expand All @@ -544,8 +532,6 @@ pipelines:
branches:
master:
- parallel:
- step: *codecommitPush

- step: *webappTest
- step: *webappBuild
- step: *webappCoreTest
Expand All @@ -566,12 +552,16 @@ pipelines:

- step: *infraCoreBuild
- step: *infraSharedBuild
- step: *infraFunctionsBuild

- step: *internalDocsBuild
- step: *internalStatusDashboardBuild
- step: *internalToolsBuild
- step:
name: Delete unused branches from CodeCommit
script:
- /bin/bash packages/internal/tools/scripts/clean-codebuild-branches.sh

- step:
<<: *deploy-current-branch
name: Deploy to Production env
deployment: production
- step:
<<: *deploy-current-branch
name: Deploy to QA env
deployment: qa
5 changes: 0 additions & 5 deletions packages/infra/infra-core/src/lib/env-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ declare const process: {
SB_LOAD_BALANCER_CERTIFICATE_ARN: string;
SB_HOSTED_ZONE_ID: string;
SB_HOSTED_ZONE_NAME: string;
SB_DEPLOY_BRANCHES: string;
PROJECT_NAME: string;
ENV_STAGE: string;
VERSION: string;
Expand Down Expand Up @@ -77,7 +76,6 @@ interface CIConfig {

export interface EnvironmentSettings {
appBasicAuth: string | null | undefined;
deployBranches: Array<string>;
domains: EnvConfigFileDomains;
envStage: string;
hostedZone: EnvConfigHostedZone;
Expand All @@ -97,7 +95,6 @@ interface ConfigFileContent {
}

export interface EnvConfigFileContent {
deployBranches: Array<string>;
hostedZone: EnvConfigHostedZone;
basicAuth: string | null | undefined;
domains: EnvConfigFileDomains;
Expand Down Expand Up @@ -163,7 +160,6 @@ async function readEnvConfig(envStage: string): Promise<EnvConfigFileContent> {
id: process.env.SB_HOSTED_ZONE_ID ?? '',
name: hostedZoneName,
},
deployBranches: process.env.SB_DEPLOY_BRANCHES?.split(',') ?? [],
};
}

Expand Down Expand Up @@ -192,7 +188,6 @@ export async function loadEnvSettings(): Promise<EnvironmentSettings> {
appBasicAuth: envConfig.basicAuth,
hostedZone: envConfig.hostedZone,
domains: envConfig.domains,
deployBranches: envConfig.deployBranches,
webAppEnvVariables: {
...(config?.webAppConfig?.envVariables || {}),
...(envConfig?.webAppConfig?.envVariables || {}),
Expand Down
7 changes: 0 additions & 7 deletions packages/infra/infra-functions/.gitignore

This file was deleted.

40 changes: 0 additions & 40 deletions packages/infra/infra-functions/deployment/triggerEntrypoint.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/infra/infra-functions/eslint.config.js

This file was deleted.

19 changes: 0 additions & 19 deletions packages/infra/infra-functions/infra-functions.conf.local.yml

This file was deleted.

32 changes: 0 additions & 32 deletions packages/infra/infra-functions/infra-functions.conf.yml

This file was deleted.

19 changes: 0 additions & 19 deletions packages/infra/infra-functions/package.json

This file was deleted.

Loading
Loading