Overview

This documentation provides a step-by-step guide for deploying CI/CD within the ConsenSys Quorum project. Currently, the CI/CD is not yet set up in the project. To establish a CI/CD pipeline, follow the outlined steps below for environment configuration, build setup, and continuous integration deployment.

Next Steps for CI/CD Setup

  1. Select a CI/CD Tool: Choose a CI/CD tool that aligns with your team’s workflow. Popular choices include GitHub Actions, GitLab CI/CD, CircleCI, Jenkins, and Travis CI.

  2. Create Configuration Files: Depending on the chosen tool, create the appropriate configuration files. For instance, if using GitHub Actions, create a .github/workflows/ci.yml.

  3. Implement Build Steps: Configure the build steps inside the CI/CD configuration file. Leverage the Dockerfile for consistent builds across environments.

  4. Set Up Tests: Ensure unit tests are implemented following the build constraints. Notably, the gofuzz build tag can be used for running tests.

  5. Deployment Strategies: Decide on deployment strategies, whether rolling updates, blue-green deployments, or canary releases.

  6. Monitor and Iterate: After initial setup and deployment, monitor the CI/CD performance and iterate on improvements.

CI/CD Configuration Example

Dockerfile Configuration

The following Dockerfile is utilized to build the Go binaries for the ConsenSys Quorum project:

# Support setting various labels on the final image
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""

# Build Geth in a stock Go builder container
FROM golang:1.22-alpine as builder

RUN apk add --no-cache gcc musl-dev linux-headers git

# Get dependencies - will also be cached if we won't change go.mod/go.sum
COPY go.mod /go-ethereum/
COPY go.sum /go-ethereum/
RUN cd /go-ethereum && go mod download

ADD . /go-ethereum
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/geth
RUN cd /go-ethereum && go run build/ci.go install -static ./cmd/bootnode

# Pull Geth into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache ca-certificates curl
RUN apk add --no-cache openssl # quorum (6 may 2024): 3.1.4-r5 is the installed openssl version, want 3.1.4-r6 to get fix for CVE-2024-2511
COPY --from=builder /go-ethereum/build/bin/geth /usr/local/bin/
COPY --from=builder /go-ethereum/build/bin/bootnode /usr/local/bin/

EXPOSE 8545 8546 30303 30303/udp
ENTRYPOINT ["geth"]

# Add some metadata labels to help programatic image consumption
ARG COMMIT=""
ARG VERSION=""
ARG BUILDNUM=""

LABEL commit="$COMMIT" version="$VERSION" buildnum="$BUILDNUM"

Makefile Utilization

The Makefile serves as a build orchestration tool with various available functions. It allows you to specify targets for different environments. Below is a section of the available functions:

Available functions in Makefile: 
geth-linux, bootnode, geth-linux-amd64, geth-darwin, android, evm, 
geth-linux-386, devtools, geth-linux-arm-5, clean, geth-windows-386, 
lint, geth-linux-arm64, geth-linux-arm-7, all, geth-linux-mips64, 
geth-windows, ios, geth-darwin-amd64, geth-linux-mips64le, 
geth-cross, geth-darwin-386, geth-linux-arm, test, 
geth-linux-mips, geth-linux-arm-6, geth-linux-mipsle, 
geth, geth-windows-amd64 

Example CI/CD Workflow

Here is an example of a GitHub Actions workflow configuration that outlines the basic CI process:

name: CI Build and Test

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      
      - name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: '1.22'
          
      - name: Install dependencies
        run: |
          cd /go-ethereum
          go mod download

      - name: Build
        run: |
          cd /go-ethereum 
          go run build/ci.go install -static ./cmd/geth
          
      - name: Run Tests
        run: |
          cd /go-ethereum
          go test -tags=gofuzz ./...

Conclusion

In summary, while the ConsenSys Quorum project currently lacks an established CI/CD process, the above steps and examples provide a foundation for implementing continuous integration and deployment through containerized builds and automated testing practices.

Source: Dockerfile, Makefile, GitHub Actions configuration