Loading .circleci/config.yml +100 −75 Original line number Diff line number Diff line Loading @@ -9,9 +9,17 @@ remote_docker: &remote_docker reusable: true version: 17.09.0-ce build_steps: &build_steps steps: import_image: &import_image name: Import Docker image command: | set -ex docker load --input "workspace/${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tar" jobs: build: <<: *defaults steps: - setup_remote_docker: <<: *remote_docker Loading @@ -34,62 +42,79 @@ build_steps: &build_steps paths: - "*.tar" push_steps: &push_steps push_master: <<: *defaults steps: - add_ssh_keys: fingerprints: # Stored in 1password Team:SETI vault `id_rsa_circleci_circleci` - "5e:7e:b1:3a:b0:65:dc:7c:07:52:fd:dd:a2:87:02:fc" - setup_remote_docker: <<: *remote_docker - checkout - attach_workspace: at: workspace - run: <<: *import_image - run: name: Tag the git commit command: | # This fails if the tag already exists # preventing a push to the docker hub. git tag "$(cat VERSION)" git push --tags - run: name: Log in to Docker repository command: docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} - run: name: Push the image command: docker push $(./image) push_staging: <<: *defaults steps: - add_ssh_keys: fingerprints: # Stored in 1password Team:SETI vault `id_rsa_circleci_circleci` - "5e:7e:b1:3a:b0:65:dc:7c:07:52:fd:dd:a2:87:02:fc" - setup_remote_docker: <<: *remote_docker - checkout - attach_workspace: at: workspace - run: name: Load CI Image command: | docker load --input "workspace/${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tar" <<: *import_image - run: name: Push to Image Repository command: | `print_env ${ENVIRONMENT_NAME}` `print_env ${ENVIRONMENT_APP_NAME}` push_image_to_ecr \ --image-name "${CIRCLE_PROJECT_REPONAME}" \ --ecr-repo ${AWS_ECR_REPO_URL} \ --aws-region ${AWS_ECR_REPO_REGION} filter_staging: &filter_staging name: Log in to Docker repository command: docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} - run: name: Push the image command: docker push $(./image):staging master_only: &master_only filters: branches: only: - staging - master filter_production: &filter_production staging_only: &staging_only filters: branches: only: - master jobs: build: <<: *defaults <<: *build_steps push_staging: <<: *defaults <<: *push_steps environment: ENVIRONMENT_APP_NAME: nginx_sidecar ENVIRONMENT_NAME: staging push_production: <<: *defaults <<: *push_steps environment: ENVIRONMENT_APP_NAME: nginx_sidecar ENVIRONMENT_NAME: production - staging workflows: version: 2 Loading @@ -98,12 +123,12 @@ workflows: jobs: - build - push_staging: <<: *filter_staging - push_master: <<: *master_only requires: - build - push_production: <<: *filter_production - push_staging: <<: *staging_only requires: - build VERSION 0 → 100644 +1 −0 Original line number Diff line number Diff line 0.0.1 No newline at end of file Loading
.circleci/config.yml +100 −75 Original line number Diff line number Diff line Loading @@ -9,9 +9,17 @@ remote_docker: &remote_docker reusable: true version: 17.09.0-ce build_steps: &build_steps steps: import_image: &import_image name: Import Docker image command: | set -ex docker load --input "workspace/${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tar" jobs: build: <<: *defaults steps: - setup_remote_docker: <<: *remote_docker Loading @@ -34,62 +42,79 @@ build_steps: &build_steps paths: - "*.tar" push_steps: &push_steps push_master: <<: *defaults steps: - add_ssh_keys: fingerprints: # Stored in 1password Team:SETI vault `id_rsa_circleci_circleci` - "5e:7e:b1:3a:b0:65:dc:7c:07:52:fd:dd:a2:87:02:fc" - setup_remote_docker: <<: *remote_docker - checkout - attach_workspace: at: workspace - run: <<: *import_image - run: name: Tag the git commit command: | # This fails if the tag already exists # preventing a push to the docker hub. git tag "$(cat VERSION)" git push --tags - run: name: Log in to Docker repository command: docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} - run: name: Push the image command: docker push $(./image) push_staging: <<: *defaults steps: - add_ssh_keys: fingerprints: # Stored in 1password Team:SETI vault `id_rsa_circleci_circleci` - "5e:7e:b1:3a:b0:65:dc:7c:07:52:fd:dd:a2:87:02:fc" - setup_remote_docker: <<: *remote_docker - checkout - attach_workspace: at: workspace - run: name: Load CI Image command: | docker load --input "workspace/${CIRCLE_PROJECT_REPONAME}-${CIRCLE_SHA1}.tar" <<: *import_image - run: name: Push to Image Repository command: | `print_env ${ENVIRONMENT_NAME}` `print_env ${ENVIRONMENT_APP_NAME}` push_image_to_ecr \ --image-name "${CIRCLE_PROJECT_REPONAME}" \ --ecr-repo ${AWS_ECR_REPO_URL} \ --aws-region ${AWS_ECR_REPO_REGION} filter_staging: &filter_staging name: Log in to Docker repository command: docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} - run: name: Push the image command: docker push $(./image):staging master_only: &master_only filters: branches: only: - staging - master filter_production: &filter_production staging_only: &staging_only filters: branches: only: - master jobs: build: <<: *defaults <<: *build_steps push_staging: <<: *defaults <<: *push_steps environment: ENVIRONMENT_APP_NAME: nginx_sidecar ENVIRONMENT_NAME: staging push_production: <<: *defaults <<: *push_steps environment: ENVIRONMENT_APP_NAME: nginx_sidecar ENVIRONMENT_NAME: production - staging workflows: version: 2 Loading @@ -98,12 +123,12 @@ workflows: jobs: - build - push_staging: <<: *filter_staging - push_master: <<: *master_only requires: - build - push_production: <<: *filter_production - push_staging: <<: *staging_only requires: - build
VERSION 0 → 100644 +1 −0 Original line number Diff line number Diff line 0.0.1 No newline at end of file