-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
3 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,9 @@ | ||
version: 2.1 | ||
orbs: | ||
aws-ecr: circleci/[email protected] | ||
aws-cli: circleci/[email protected] | ||
aws-s3: circleci/[email protected] | ||
|
||
executors: | ||
amd64: | ||
machine: | ||
image: ubuntu-2004:current | ||
docker_layer_caching: true | ||
resource_class: medium | ||
arm64: | ||
machine: | ||
image: ubuntu-2004:current | ||
docker_layer_caching: true | ||
resource_class: arm.medium | ||
ci-aws: | ||
docker: | ||
- image: cimg/aws:2024.03 | ||
|
@@ -49,94 +38,6 @@ commands: | |
--paths <<parameters.paths>> --profile <<parameters.profile>> | ||
jobs: | ||
build_container_image_and_push: | ||
executor: << parameters.architecture >> | ||
environment: | ||
AWS_ECR_REGISTRY_ID: $AWS_ECR_REGISTRY_ID | ||
parameters: | ||
app: | ||
description: application to build | ||
type: string | ||
default: webdemo | ||
architecture: | ||
description: architecture to build | ||
type: enum | ||
enum: ['amd64', 'arm64'] | ||
build_path: | ||
description: the path to execute docker build | ||
type: string | ||
dockerfile: | ||
description: dockerfile name to use in docker build | ||
type: string | ||
default: Dockerfile | ||
repo: | ||
description: ECR repository name to push container image | ||
type: string | ||
aws_region: | ||
description: AWS region of ECR repository to push container image | ||
type: enum | ||
enum: ['us-east-1', 'us-west-2'] | ||
extra_build_args: | ||
description: extra build args to pass to docker build | ||
type: string | ||
steps: | ||
- checkout | ||
- attach_workspace: | ||
# Must be absolute path or relative path from working_directory | ||
at: . | ||
- aws-ecr/build-and-push-image: | ||
dockerfile: << parameters.dockerfile >> | ||
new-profile-name: ci-ops | ||
path: << parameters.build_path >> | ||
build-path: << parameters.build_path >> | ||
platform: linux/<< parameters.architecture >> | ||
profile-name: default | ||
region: << parameters.aws_region >> | ||
repo: << parameters.repo >> | ||
role-arn: $CI_ROLE_ARN | ||
tag: '$CIRCLE_TAG-<< parameters.app >>-<< parameters.architecture >>' | ||
extra-build-args: << parameters.extra_build_args >> | ||
push_arch_integrated_manifest: | ||
executor: arm64 | ||
parameters: | ||
aws_region: | ||
description: AWS region of ECR repository to push container image | ||
type: enum | ||
enum: ['us-east-1', 'us-west-2'] | ||
repo: | ||
description: ECR repository name to push container image | ||
type: string | ||
environment: | ||
DOCKER_CLI_EXPERIMENTAL: enabled | ||
ECR_REPO: $AWS_ECR_REGISTRY_ID.dkr.ecr.<<parameters.aws_region>>.amazonaws.com/<<parameters.repo>> | ||
steps: | ||
- aws-cli/setup: | ||
profile-name: default | ||
configure-default-region: false | ||
- aws-cli/role-arn-setup: | ||
profile-name: ci-ops | ||
source-profile: default | ||
role-arn: $CI_ROLE_ARN | ||
- run: | ||
name: Login in docker registry | ||
command: | | ||
aws ecr get-login-password --region <<parameters.aws_region>> --profile ci-ops | docker login --username AWS --password-stdin $ECR_REPO | ||
- run: | ||
name: Push image manifest | ||
command: | | ||
docker manifest create "$ECR_REPO:$CIRCLE_TAG-webdemo" "$ECR_REPO:$CIRCLE_TAG-webdemo-amd64" "$ECR_REPO:$CIRCLE_TAG-webdemo-arm64" | ||
docker manifest push "$ECR_REPO:$CIRCLE_TAG-webdemo" | ||
scan_credentials: | ||
docker: | ||
- image: $SEC_THOG_SCANNER_IMAGE | ||
aws_auth: | ||
aws_access_key_id: $SEC_AWS_ID_FOR_THOG_ECR | ||
aws_secret_access_key: $SEC_AWS_KEY_FOR_THOG_ECR | ||
resource_class: small | ||
steps: | ||
- run: | ||
name: Scan credentials | ||
command: sh scan.sh | ||
build: | ||
executor: node | ||
steps: | ||
|
@@ -183,52 +84,15 @@ jobs: | |
profile: ci-web-prod | ||
|
||
workflows: | ||
build_and_push: | ||
deploy_to_s3: | ||
jobs: | ||
- build_container_image_and_push: | ||
name: build_app-<<matrix.architecture>> | ||
- build: | ||
name: build | ||
filters: &only_version_tag_trigger | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
matrix: &amd64_and_arm64_matrix | ||
parameters: | ||
architecture: | ||
- amd64 | ||
- arm64 | ||
build_path: '.' | ||
aws_region: us-west-2 | ||
repo: aiwidget/app | ||
dockerfile: Dockerfile.webdemo | ||
extra_build_args: | | ||
--build-arg VITE_CHAT_WIDGET_APP_ID=AE8F7EEA-4555-4F86-AD8B-5E0BD86BFE67 \ | ||
--build-arg VITE_CHAT_WIDGET_BOT_ID=khan-academy-bot \ | ||
--build-arg VITE_WEB_DEMO_APP_ID=6E1B01A5-517F-4F68-A74A-8427F3DE904C \ | ||
--build-arg VITE_WIDGET_DEMO_APP_ID=58F00FA8-C48E-461D-975E-18D33C8778AB | ||
context: | ||
- circleci-dashboard-bot | ||
- push_arch_integrated_manifest: | ||
name: integrate_manifest_app | ||
filters: *only_version_tag_trigger | ||
requires: | ||
- build_app-amd64 | ||
- build_app-arm64 | ||
aws_region: us-west-2 | ||
repo: aiwidget/app | ||
context: | ||
- circleci-dashboard-bot | ||
- scan_credentials: | ||
filters: *only_version_tag_trigger | ||
context: | ||
- devsecops | ||
requires: | ||
- integrate_manifest_app | ||
deploy_to_s3: | ||
jobs: | ||
- build: | ||
name: build | ||
filters: *only_version_tag_trigger | ||
- upload_to_s3_and_invalidate_cache: | ||
name: upload_to_s3_and_invalidate_cache | ||
filters: *only_version_tag_trigger | ||
|
This file was deleted.
Oops, something went wrong.