Skip to content

Commit

Permalink
- test individual executors
Browse files Browse the repository at this point in the history
- comment out buildx for now
- add build and tag jobs
- update workflow
- update script
  • Loading branch information
elipe17 committed Sep 9, 2024
1 parent ea529a1 commit e5115d6
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .circleci/base_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
19 changes: 8 additions & 11 deletions .circleci/deployment/commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<parameters.backend-appname>> <<parameters.frontend-appname>> ./tdrs-backend ./tdrs-frontend $CIRCLE_BUILD_NUM $CIRCLE_SHA1 "$CIRCI_DOCKER_LOGIN" tdp-circi
deploy-cloud-dot-gov:
Expand Down
34 changes: 31 additions & 3 deletions .circleci/deployment/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions .circleci/deployment/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions scripts/build-and-tag-images.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
set -e

if [ "$#" -ne 8 ]; then
echo "Error, this script expects 8 parameters."
Expand All @@ -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
}

Expand Down

0 comments on commit e5115d6

Please sign in to comment.