Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/assertor release workflow #12662

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions .github/workflows/ci-cd-main-branch-docker-images.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: CI-CD build and deploy docker images based on the last commit in the main branch
run-name: "Commit id ${{ github.sha }}: CI-CD build and deploy docker images based on the commit id in the main branch"
name: CI-CD build and deploy docker images based on the last commit in the ref branch
run-name: "Commit id ${{ github.sha }}: CI-CD build and deploy docker images based on the commit id in the ref branch"

env:
APPLICATION: "erigon"
BUILDER_IMAGE: "golang:1.23.1-alpine3.20"
TARGET_BASE_IMAGE: "alpine:3.20.3"
APP_REPO: "erigontech/erigon"
CHECKOUT_REF: "main"
DOCKERHUB_REPOSITORY: "erigontech/erigon"
LABEL_DESCRIPTION: "[docker image built on a last commit id from the main branch] Erigon is an implementation of Ethereum (execution layer with embeddable consensus layer), on the efficiency frontier. Archive Node by default."
LABEL_DESCRIPTION: "[docker image built on a last commit id from the ref branch] Erigon is an implementation of Ethereum (execution layer with embeddable consensus layer), on the efficiency frontier. Archive Node by default."
KEEP_IMAGES: 100

on:
push:
branches:
- 'main'
- 'release/2.61'
paths-ignore:
- '.github/**'
workflow_dispatch:
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
with:
repository: ${{ env.APP_REPO }}
fetch-depth: 1
ref: ${{ env.CHECKOUT_REF }}
ref: ${{ github.ref_name }}
path: 'erigon'

- name: Setup go env and cache
Expand All @@ -60,6 +60,7 @@ jobs:
cd erigon
echo "id=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short_commit_id=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
echo "formatted_ref=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9\.]/-/g')" >> "$GITHUB_OUTPUT"
cd ..

- name: Login to Docker Hub
Expand Down Expand Up @@ -96,9 +97,9 @@ jobs:
${{ env.BUILDER_IMAGE }} \
-c "apk update; apk add make git gcc libstdc++ build-base linux-headers bash ca-certificates; git config --global --add safe.directory /erigon; make GOARCH=amd64 GOAMD64=v2 GOBIN=/erigon-build BUILD_TAGS=nosqlite,noboltdb,nosilkworm erigon integration rpcdaemon"

- name: Build and push multi-platform docker image based on the commit id ${{ steps.getCommitId.outputs.short_commit_id }} in the main branch
- name: Build and push multi-platform docker image based on the commit id ${{ steps.getCommitId.outputs.short_commit_id }} in the ref branch
env:
BUILD_VERSION: "main-${{ steps.getCommitId.outputs.short_commit_id }}"
BUILD_VERSION: "${{ steps.getCommitId.outputs.formatted_ref }}-${{ steps.getCommitId.outputs.short_commit_id }}"
DOCKER_URL: ${{ env.DOCKERHUB_REPOSITORY }}
DOCKERFILE_PATH: Dockerfile.release
run: |
Expand All @@ -107,18 +108,18 @@ jobs:
cd erigon
docker buildx build \
--file ${{ env.DOCKERFILE_PATH }} \
--target ci-cd-main-branch \
--target ci-cd-ref-branch \
--attest type=provenance,mode=max \
--sbom=true \
--build-arg CI_CD_MAIN_TARGET_BASE_IMAGE=${{ env.TARGET_BASE_IMAGE }} \
--build-arg CI_CD_MAIN_BUILDER_IMAGE=${{ env.BUILDER_IMAGE }} \
--build-arg CI_CD_REF_TARGET_BASE_IMAGE=${{ env.TARGET_BASE_IMAGE }} \
--build-arg CI_CD_REF_BUILDER_IMAGE=${{ env.BUILDER_IMAGE }} \
--tag ${{ env.DOCKER_URL }}:${{ env.BUILD_VERSION }} \
--tag ${{ env.DOCKER_URL }}:main-latest \
--tag ${{ env.DOCKER_URL }}:${{ steps.getCommitId.outputs.formatted_ref }}-latest \
--label org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--label org.opencontainers.image.authors="https://github.com/erigontech/erigon/graphs/contributors" \
--label org.opencontainers.image.url="https://github.com/erigontech/erigon/blob/main/Dockerfile" \
--label org.opencontainers.image.documentation="https://github.com/erigontech/erigon/blob/main/Dockerfile" \
--label org.opencontainers.image.source="https://github.com/erigontech/erigon/blob/main/Dockerfile" \
--label org.opencontainers.image.url="https://github.com/erigontech/erigon/blob/${{ github.ref_name }}/Dockerfile" \
--label org.opencontainers.image.documentation="https://github.com/erigontech/erigon/blob/${{ github.ref_name }}/Dockerfile" \
--label org.opencontainers.image.source="https://github.com/erigontech/erigon/blob/${{ github.ref_name }}/Dockerfile" \
--label org.opencontainers.image.version=${{ steps.getCommitId.outputs.id }} \
--label org.opencontainers.image.revision=${{ steps.getCommitId.outputs.id }} \
--label org.opencontainers.image.vcs-ref-short=${{ steps.getCommitId.outputs.short_commit_id }} \
Expand All @@ -131,30 +132,30 @@ jobs:
- name: export and print docker build tag, cleanup old docker images
id: built_tag_export
env:
BUILD_VERSION: "main-${{ steps.getCommitId.outputs.short_commit_id }}"
BUILD_VERSION: "${{ steps.getCommitId.outputs.formatted_ref }}-${{ steps.getCommitId.outputs.short_commit_id }}"
run: |
echo "docker_build_tag=${{ env.BUILD_VERSION }}" >> $GITHUB_OUTPUT
echo The following docker images have been published:
echo "${{ env.DOCKERHUB_REPOSITORY }}:main-${{ env.BUILD_VERSION }}"
echo "${{ env.DOCKERHUB_REPOSITORY }}:main-latest"
echo "${{ env.DOCKERHUB_REPOSITORY }}:${{ env.BUILD_VERSION }}"
echo "${{ env.DOCKERHUB_REPOSITORY }}:${{ steps.getCommitId.outputs.formatted_ref }}-latest"
echo
echo "Cleanup old docker images matching pattern tag ~= main-XXXXXXX"
echo "Cleanup old docker images matching pattern tag ~= ${{ steps.getCommitId.outputs.formatted_ref }}-XXXXXXX"
curl_cmd="curl -s -H \"Authorization: JWT ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_TOKEN }}\" "
dockerhub_url='https://hub.docker.com/v2/namespaces/erigontech/repositories/erigon'
my_list () {
# First page:
next_page="$dockerhub_url/tags?page=1&page_size=100"
while [ "$next_page" != "null" ]
do
# Print tags and push dates for tags matching "main-":
$curl_cmd $next_page | jq -r '.results|.[]|.name + " " + .tag_last_pushed' | grep 'main-'
# Print tags and push dates for tags matching "${{ steps.getCommitId.outputs.formatted_ref }}-":
$curl_cmd $next_page | jq -r '.results|.[]|.name + " " + .tag_last_pushed' | grep '${{ steps.getCommitId.outputs.formatted_ref }}-'
next_page=`$curl_cmd $next_page | jq '.next' | sed -e 's/^\"//' -e 's/\"$//'`
done
}

my_list | tail -n+${{ env.KEEP_IMAGES }} | while read line; do
echo -n "Removing docker image/published - $line "
current_image=$(echo $line | sed -e 's/^\(main-.\{7\}\) .*/\1/')
current_image=$(echo $line | sed -e 's/^\(${{ steps.getCommitId.outputs.formatted_ref }}-.\{7\}\) .*/\1/')
output_code=$(curl --write-out %{http_code} --output curl-output.log \
-s -X DELETE -H "Accept: application/json" \
-H "Authorization: JWT ${{ secrets.ORG_DOCKERHUB_ERIGONTECH_TOKEN }}" \
Expand All @@ -170,8 +171,10 @@ jobs:

run-kurtosis-assertoor:
needs: [define_matrix, Build]
uses: erigontech/erigon/.github/workflows/test-kurtosis-assertoor.yml@main
# TODO: change @feat/assertor-release-workflow to @main before merging
uses: erigontech/erigon/.github/workflows/test-kurtosis-assertoor.yml@feat/assertor-release-workflow
with:
checkout_ref: ${{ github.sha }}
os: ${{ needs.define_matrix.outputs.os }}
docker_build_tag: ${{ needs.Build.outputs.docker_build_tag }}
enable_pectra_tests: ${{ github.ref_name == 'release/2.61' }}
29 changes: 29 additions & 0 deletions .github/workflows/kurtosis/config-pectra.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
participants_matrix:
el:
- el_type: geth
- el_type: erigon
el_image: <<ERIGON_IMAGE_PLACEHOLDER>>
- el_type: nethermind
cl:
- cl_type: lighthouse
- cl_type: nimbus
network_params:
#electra_fork_epoch: 1
min_validator_withdrawability_delay: 1
shard_committee_period: 1
additional_services:
- assertoor
snooper_enabled: true
assertoor_params:
run_stability_check: false
run_block_proposal_check: false
tests:
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/all-opcodes-test.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/blob-transactions-test.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/dencun-opcodes-test.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/eoa-transactions-test.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/synchronized-check.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/validator-exit-test.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/block-proposal-check.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/stability-check.yaml
- https://raw.githubusercontent.com/ethpandaops/assertoor-test/master/assertoor-tests/pectra-dev/all.yaml
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,4 @@ jobs:
--title "${{ inputs.release_version }}" \
--notes "**Improvements:**<br>- ...coming soon <br><br>**Bugfixes:**<br><br>- ...coming soon<br><br>**Docker images:**<br><br>Docker image released:<br> ${{ env.DOCKER_TAGS }}<br><br>... coming soon<br>" \
"${{ inputs.release_version }}" \
*.tar.gz ${HOME}/${{ env.APPLICATION }}_${{ inputs.release_version }}_checksums.txt
*.tar.gz ${HOME}/${{ env.APPLICATION }}_${{ inputs.release_version }}_checksums.txt
15 changes: 15 additions & 0 deletions .github/workflows/test-kurtosis-assertoor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
docker_build_tag:
required: true
type: string
enable_pectra_tests:
required: false
type: boolean
default: false

jobs:
assertoor_test:
Expand Down Expand Up @@ -63,13 +67,24 @@ jobs:
run: sudo apt update && sudo apt install build-essential

- name: download kurtosis config
if: ${{ !inputs.enable_pectra_tests }}
env:
BUILD_VERSION: ${{ inputs.docker_build_tag }}
DOCKER_URL: ${{ env.DOCKERHUB_REPOSITORY }}
run: |
wget -O kurtosis_config_with_p.yaml https://raw.githubusercontent.com/erigontech/erigon/main/.github/workflows/kurtosis/config.properties
sed 's#<<ERIGON_IMAGE_PLACEHOLDER>>#${{ env.DOCKER_URL }}:${{ env.BUILD_VERSION }}#g' kurtosis_config_with_p.yaml > kurtosis_config.yaml

- name: download kurtosis config - with pectra
if: ${{ inputs.enable_pectra_tests }}
env:
BUILD_VERSION: ${{ inputs.docker_build_tag }}
DOCKER_URL: ${{ env.DOCKERHUB_REPOSITORY }}
# TODO: update the path to the config file with main branch before PR is merged
run: |
wget -O kurtosis_config_with_p.yaml https://raw.githubusercontent.com/erigontech/erigon/feat/assertor-release-workflow/.github/workflows/kurtosis/config-pectra.properties
sed 's#<<ERIGON_IMAGE_PLACEHOLDER>>#${{ env.DOCKER_URL }}:${{ env.BUILD_VERSION }}#g' kurtosis_config_with_p.yaml > kurtosis_config.yaml

- name: Run Kurtosis + assertoor tests
uses: ethpandaops/kurtosis-assertoor-github-action@v1
with:
Expand Down
14 changes: 7 additions & 7 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG RELEASE_DOCKER_BASE_IMAGE="alpine:3.20.1" \
CI_CD_MAIN_BUILDER_IMAGE="golang:1.22-bookworm" \
CI_CD_MAIN_TARGET_BASE_IMAGE="alpine:3.20.1" \
CI_CD_REF_BUILDER_IMAGE="golang:1.22-bookworm" \
CI_CD_REF_TARGET_BASE_IMAGE="alpine:3.20.1" \
EXPOSED_PORTS="8545 \
8551 \
8546 \
Expand Down Expand Up @@ -58,8 +58,8 @@ ENTRYPOINT [ "/usr/local/bin/erigon" ]
### End of Release Dockerfile


### CI-CD : main branch docker image publishing for each new commit id
FROM ${CI_CD_MAIN_BUILDER_IMAGE} AS ci-cd-main-branch-builder
### CI-CD : ref branch docker image publishing for each new commit id
FROM ${CI_CD_REF_BUILDER_IMAGE} AS ci-cd-ref-branch-builder

COPY /build-amd64 /build-amd64/
COPY /build-arm64 /build-arm64/
Expand All @@ -69,13 +69,13 @@ RUN echo "DEBUG: content of build-amd64" && ls -l /build-amd64 && \
echo "DEBUG: content of build-arm64" && ls -l /build-arm64


FROM ${CI_CD_MAIN_TARGET_BASE_IMAGE} AS ci-cd-main-branch
FROM ${CI_CD_REF_TARGET_BASE_IMAGE} AS ci-cd-ref-branch
ARG USER=erigon \
GROUP=erigon \
TARGETARCH \
EXPOSED_PORTS

RUN --mount=type=bind,from=ci-cd-main-branch-builder,source=/build-${TARGETARCH},target=/tmp/erigon \
RUN --mount=type=bind,from=ci-cd-ref-branch-builder,source=/build-${TARGETARCH},target=/tmp/erigon \
apk add --no-cache ca-certificates tzdata libstdc++ && \
addgroup ${GROUP} && \
adduser -D -h /home/${USER} -G ${GROUP} ${USER} && \
Expand All @@ -90,4 +90,4 @@ EXPOSE ${EXPOSED_PORTS}

ENTRYPOINT [ "/usr/local/bin/erigon" ]

### End of CI-CD : main branch docker image publishing for each new commit id
### End of CI-CD : ref branch docker image publishing for each new commit id
Loading