From 58c59554eb4a18496494a8361c56b5806737e355 Mon Sep 17 00:00:00 2001 From: Wojciech Zieba Date: Sun, 1 Oct 2023 12:45:01 +0200 Subject: [PATCH] Trigger to test --- .github/workflows/ci-cd-pipeline.yml | 52 +++++++++++++----- .../workflows/docker-build-publish-amd.yml | 37 ------------- .../workflows/docker-build-publish-arm.yml | 42 -------------- .github/workflows/docker-image-build-push.yml | 55 +++++++++++++++++-- 4 files changed, 87 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/docker-build-publish-amd.yml delete mode 100644 .github/workflows/docker-build-publish-arm.yml diff --git a/.github/workflows/ci-cd-pipeline.yml b/.github/workflows/ci-cd-pipeline.yml index 9749499dc3..8175a9c5bb 100644 --- a/.github/workflows/ci-cd-pipeline.yml +++ b/.github/workflows/ci-cd-pipeline.yml @@ -2,23 +2,45 @@ name: CI/CD on: push: - branches: [main] + branches: [main, wojciechos/cleanup-ci] tags: [v*] - + jobs: - docker_build_and_publish_amd: + docker_build_and_publish: runs-on: ubuntu-latest + outputs: + IMAGE_TAG: ${{ steps.image_tag.outputs.IMAGE_TAG }} steps: - - name: Call AMD Build Workflow - id: amd_build - uses: ./.github/workflows/docker-build-publish-amd.yml + - name: Checkout + uses: actions/checkout@v4 with: - tag: ${{ github.ref }} - outputs: - AMD_IMAGE_TAG: ${{ steps.amd_build.outputs.AMD_IMAGE_TAG }} + fetch-depth: 0 + + - name: Define_docker_image_tag + id: image_tag + run: | + echo "DOCKER_IMAGE_TAG=$(git describe --tags)" >> $GITHUB_ENV + echo "IMAGE_TAG=$(git describe --tags)" >> "$GITHUB_OUTPUT" + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + platforms: 'linux/amd64' + push: true + tags: nethermindeth/juno:${{ env.DOCKER_IMAGE_TAG }} deploy_to_dev: - needs: [docker_build_and_publish_amd] + needs: [docker_build_and_publish] runs-on: ubuntu-latest environment: name: Development @@ -26,7 +48,7 @@ jobs: - name: Repository Dispatch Dev env: EVENT_NAME: juno-dev - IMAGE_TAG: ${{ needs.docker_build_and_publish_amd.outputs.AMD_IMAGE_TAG }} + IMAGE_TAG: ${{ needs.docker_build_and_publish.outputs.IMAGE_TAG }} GOERLI: apps/juno-dev/overlays/dev-goerli-1/config.yaml INTEGRATION: apps/juno-dev/overlays/dev-integration/config.yaml MAINNET: apps/juno-dev/overlays/dev-mainnet/config.yaml @@ -63,7 +85,7 @@ jobs: REPOSITORY_DISPATCH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }} deploy_to_staging: - needs: [docker_build_and_publish_amd, deploy_to_dev] + needs: [deploy_to_dev] runs-on: ubuntu-latest environment: name: Staging @@ -71,7 +93,7 @@ jobs: - name: Repository Dispatch Staging env: EVENT_NAME: juno-staging - IMAGE_TAG: ${{ needs.docker_build_and_publish_amd.outputs.AMD_IMAGE_TAG }} + IMAGE_TAG: ${{ needs.docker_build_and_publish.outputs.IMAGE_TAG }} GOERLI: apps/juno-staging/overlays/staging-goerli-1/config.yaml INTEGRATION: apps/juno-staging/overlays/staging-integration/config.yaml MAINNET: apps/juno-staging/overlays/staging-mainnet/config.yaml @@ -108,7 +130,7 @@ jobs: REPOSITORY_DISPATCH_TOKEN: ${{ secrets.REPOSITORY_DISPATCH_TOKEN }} deploy_to_production: - needs: [docker_build_and_publish_amd, deploy_to_staging] + needs: [deploy_to_staging] runs-on: ubuntu-latest environment: name: Production @@ -116,7 +138,7 @@ jobs: - name: Repository Dispatch Prod env: EVENT_NAME: juno-prod - IMAGE_TAG: ${{ needs.docker_build_and_publish_amd.outputs.AMD_IMAGE_TAG }} + IMAGE_TAG: ${{ needs.docker_build_and_publish.outputs.IMAGE_TAG }} GOERLI: apps/juno-prod/overlays/prod_goerli-1/config.yaml INTEGRATION: apps/juno-prod/overlays/prod_integration/config.yaml MAINNET: apps/juno-prod/overlays/prod_mainnet/config.yaml diff --git a/.github/workflows/docker-build-publish-amd.yml b/.github/workflows/docker-build-publish-amd.yml deleted file mode 100644 index fad3403898..0000000000 --- a/.github/workflows/docker-build-publish-amd.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Docker Build and Publish AMD - -on: - workflow_call: - -jobs: - build_and_push_amd: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push AMD image - uses: docker/build-push-action@v4 - with: - context: . - platforms: 'linux/amd64' - push: true - tags: nethermindeth/juno:${{ github.ref }} - - - name: Set Output - id: set_output - run: echo "AMD_IMAGE_TAG=${{ github.ref }}" >> $GITHUB_ENV - - outputs: - AMD_IMAGE_TAG: ${{ steps.set_output.outputs.AMD_IMAGE_TAG }} diff --git a/.github/workflows/docker-build-publish-arm.yml b/.github/workflows/docker-build-publish-arm.yml deleted file mode 100644 index 55a5789f34..0000000000 --- a/.github/workflows/docker-build-publish-arm.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Docker Build and Publish ARM - -on: - workflow_call: - -jobs: - build_and_push_arm: - if: github.repository_owner == 'NethermindEth' - runs-on: self-hosted - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push ARM image - uses: docker/build-push-action@v4 - with: - context: . - platforms: 'linux/arm64' - push: true - tags: nethermindeth/juno:${{ github.event.inputs.tag }}-arm64 - - - name: Cleanup self-hosted - run: | - docker system prune -af - - - name: Set Output - id: set_output - run: echo "ARM_IMAGE_TAG=${{ github.event.inputs.tag }}-arm64" >> $GITHUB_ENV - - outputs: - ARM_IMAGE_TAG: ${{ steps.set_output.outputs.ARM_IMAGE_TAG }} \ No newline at end of file diff --git a/.github/workflows/docker-image-build-push.yml b/.github/workflows/docker-image-build-push.yml index 220a03d3b8..e10ccf15ed 100644 --- a/.github/workflows/docker-image-build-push.yml +++ b/.github/workflows/docker-image-build-push.yml @@ -17,16 +17,60 @@ on: jobs: build_and_push_docker_image_amd: + if: github.repository_owner == 'NethermindEth' runs-on: ubuntu-latest steps: - - name: Call AMD Build Workflow - uses: ./.github/workflows/docker-build-publish-amd.yml + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: 'linux/amd64' + push: true + tags: nethermindeth/juno:${{ github.event.inputs.tag }} build_and_push_docker_image_arm: + if: github.repository_owner == 'NethermindEth' runs-on: self-hosted steps: - - name: Call ARM Build Workflow - uses: ./.github/workflows/docker-build-publish-arm.yml + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push ARM + uses: docker/build-push-action@v4 + with: + context: . + platforms: 'linux/arm64' + push: true + tags: nethermindeth/juno:${{ github.event.inputs.tag }}-arm64 + + - name: Cleanup self-hosted + run: | + docker system prune -af create_and_push_official_image: if: github.repository_owner == 'NethermindEth' && github.event.inputs.repo_type == 'official' @@ -51,4 +95,5 @@ jobs: - name: Clean up environment if: always() run: | - rm -f ${HOME}/.docker/config.json \ No newline at end of file + rm -f ${HOME}/.docker/config.json + \ No newline at end of file