From e5115d6dd395e46d6859b038ac0204963646ecbb Mon Sep 17 00:00:00 2001 From: Eric Lipe Date: Mon, 9 Sep 2024 15:57:47 -0400 Subject: [PATCH] - test individual executors - comment out buildx for now - add build and tag jobs - update workflow - update script --- .circleci/base_config.yml | 5 +++++ .circleci/deployment/commands.yml | 19 +++++++---------- .circleci/deployment/jobs.yml | 34 +++++++++++++++++++++++++++--- .circleci/deployment/workflows.yml | 22 +++++++++++++++++++ scripts/build-and-tag-images.sh | 5 +++-- 5 files changed, 69 insertions(+), 16 deletions(-) diff --git a/.circleci/base_config.yml b/.circleci/base_config.yml index 9c1e6c7ff..91dbffd88 100644 --- a/.circleci/base_config.yml +++ b/.circleci/base_config.yml @@ -20,6 +20,11 @@ executors: docker_layer_caching: false image: ubuntu-2204:2024.01.1 resource_class: large + arm-docker-executor: + docker: + - image: cimg/python:3.10.4 + user: root + resource_class: arm.large parameters: build_and_test_all: diff --git a/.circleci/deployment/commands.yml b/.circleci/deployment/commands.yml index 66e76b8c0..62488b2d3 100644 --- a/.circleci/deployment/commands.yml +++ b/.circleci/deployment/commands.yml @@ -15,20 +15,17 @@ type: string steps: - setup_remote_docker - - run: - name: Install Buildx - command: | - docker version - export DOCKER_CLI_EXPERIMENTAL=enabled - sudo apt update - sudo apt-get install -y containerd docker.io docker-buildx - docker buildx create --driver docker-container --use --bootstrap + # - run: + # name: Install Buildx + # command: | + # docker version + # export DOCKER_CLI_EXPERIMENTAL=enabled + # sudo apt update + # sudo apt-get install -y containerd docker.io docker-buildx + # docker buildx create --driver docker-container --use --bootstrap - run: name: Build and tag images command: | - cat /etc/docker/daemon.json - echo '{"max-concurrent-uploads": 1}' > /etc/docker/daemon.json - sudo systemctl restart docker ./scripts/build-and-tag-images.sh <> <> ./tdrs-backend ./tdrs-frontend $CIRCLE_BUILD_NUM $CIRCLE_SHA1 "$CIRCI_DOCKER_LOGIN" tdp-circi deploy-cloud-dot-gov: diff --git a/.circleci/deployment/jobs.yml b/.circleci/deployment/jobs.yml index 58b1f4fa5..c8b29dc55 100644 --- a/.circleci/deployment/jobs.yml +++ b/.circleci/deployment/jobs.yml @@ -6,13 +6,41 @@ working_directory: ~/tdp-deploy steps: - init-deploy - - build-and-tag-images: - backend-appname: tdp-backend-<< parameters.target_env >> - frontend-appname: tdp-frontend-<< parameters.target_env >> + # - build-and-tag-images: + # backend-appname: tdp-backend-<< parameters.target_env >> + # frontend-appname: tdp-frontend-<< parameters.target_env >> # - deploy-cloud-dot-gov: # backend-appname: tdp-backend-<< parameters.target_env >> # frontend-appname: tdp-frontend-<< parameters.target_env >> + build-and-tag-arm: + parameters: + backend-appname: + type: string + frontend-appname: + type: string + executor: arm-docker-executor + working_directory: ~/tdp-deploy + steps: + - init-deploy + - build-and-tag-images: + backend-appname: << parameters.backend-appname >> + frontend-appname: << parameters.frontend-appname >> + + build-and-tag: + parameters: + backend-appname: + type: string + frontend-appname: + type: string + executor: docker-executor + working_directory: ~/tdp-deploy + steps: + - init-deploy + - build-and-tag-images: + backend-appname: tdp-backend-<< parameters.backend-appname >> + frontend-appname: tdp-frontend-<< parameters.frontend-appname >> + deploy-staging: executor: docker-executor working_directory: ~/tdp-deploy diff --git a/.circleci/deployment/workflows.yml b/.circleci/deployment/workflows.yml index 8a4269c04..26d4ab146 100644 --- a/.circleci/deployment/workflows.yml +++ b/.circleci/deployment/workflows.yml @@ -93,6 +93,28 @@ - develop - main - master + - build-and-tag-arm: + backend-appname: tdp-backend-<< pipeline.parameters.target_env >> + frontend-appname: tdp-frontend-<< pipeline.parameters.target_env >> + requires: + - deploy-infrastructure-dev + filters: + branches: + ignore: + - develop + - main + - master + - build-and-tag: + backend-appname: tdp-backend-<< pipeline.parameters.target_env >> + frontend-appname: tdp-frontend-<< pipeline.parameters.target_env >> + requires: + - deploy-infrastructure-dev + filters: + branches: + ignore: + - develop + - main + - master - deploy-develop: requires: - deploy-infrastructure-staging diff --git a/scripts/build-and-tag-images.sh b/scripts/build-and-tag-images.sh index b35744967..7d5b52dd7 100755 --- a/scripts/build-and-tag-images.sh +++ b/scripts/build-and-tag-images.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e if [ "$#" -ne 8 ]; then echo "Error, this script expects 8 parameters." @@ -21,8 +22,8 @@ export DOCKER_CLI_EXPERIMENTAL=enabled build_and_tag() { echo "$DOCKER_LOGIN" | docker login https://tdp-docker.dev.raftlabs.tech -u $DOCKER_USER --password-stdin - docker buildx build --push --platform linux/amd64,linux/arm64 -t tdp-docker.dev.raftlabs.tech/$BACKEND_APP_NAME:$TAG -t tdp-docker.dev.raftlabs.tech/$BACKEND_APP_NAME:latest "$BACKEND_PATH" - docker buildx build --push --platform linux/amd64,linux/arm64 -t tdp-docker.dev.raftlabs.tech/$FRONTEND_APP_NAME:$TAG -t tdp-docker.dev.raftlabs.tech/$FRONTEND_APP_NAME:latest "$FRONTEND_PATH" + docker build --push -t tdp-docker.dev.raftlabs.tech/$BACKEND_APP_NAME:$TAG -t tdp-docker.dev.raftlabs.tech/$BACKEND_APP_NAME:latest "$BACKEND_PATH" + docker build --push -t tdp-docker.dev.raftlabs.tech/$FRONTEND_APP_NAME:$TAG -t tdp-docker.dev.raftlabs.tech/$FRONTEND_APP_NAME:latest "$FRONTEND_PATH" docker logout }