From 28aed75e1f53733143247a8b6d7f9cc1ab84c2e8 Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Tue, 16 Aug 2022 17:02:05 -0600 Subject: [PATCH] ci: CircleCI improvements (#44) - Use build params to conditionally push builds to Docker Hub - Use env vars to push both the optimism and optimism-history branches --- .circleci/config.yml | 65 ++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 42 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 514c05cd943c..04bedad9b816 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -26,33 +26,30 @@ jobs: - run: command: go run build/ci.go lint - build-dockerfile: + push-geth: docker: - image: cimg/base:2022.04 - parameters: - image-name: - description: Image name - type: string - image-tag: - description: Image tag - type: string - target: - description: Dockerfile target - type: string - default: "" - dockerfile: - description: Dockerfile to use - type: string steps: - - checkout - - setup_remote_docker: - version: 20.10.12 - - run: - name: Build - command: | - echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin - docker build -t "ethereumoptimism/<>:<>" -f <> <<#parameters.target>>--target <><> . - docker push "ethereumoptimism/<>:<>" + - when: + condition: + or: + - equal: [ optimism, <> ] + - equal: [ optimism-history, <> ] + steps: + - checkout + - setup_remote_docker: + version: 20.10.12 + - run: + name: Build and push + command: | + echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin + docker build -t "ethereumoptimism/reference-optimistic-geth:$CIRCLE_SHA1" -f Dockerfile . + docker tag "ethereumoptimism/reference-optimistic-geth:$CIRCLE_SHA1" "ethereumoptimism/reference-optimistic-geth:$CIRCLE_BRANCH" + docker push "ethereumoptimism/reference-optimistic-geth:$CIRCLE_SHA1" + docker push "ethereumoptimism/reference-optimistic-geth:$CIRCLE_BRANCH" + # Below step is required to prevent CircleCI from barfing on a + # job with no steps + - run: echo 0 workflows: main: @@ -63,21 +60,5 @@ workflows: name: Run unit tests for geth - lint-geth: name: Run linter over geth - - build-dockerfile: - context: - - optimism - filters: - branches: - only: - - optimism - image-name: reference-optimistic-geth - image-tag: latest - dockerfile: Dockerfile - name: Build reference-optimistic-geth develop - - build-dockerfile: - context: - - optimism - image-name: reference-optimistic-geth - image-tag: $CIRCLE_SHA1 - dockerfile: Dockerfile - name: Build reference-optimistic-geth per-commit + - push-geth: + name: Push geth