Skip to content

libhive: client build args and alternative dockerfiles #767

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

Merged
merged 32 commits into from
Jun 2, 2023

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Apr 27, 2023

Allows specifying a --client-file parameter which shall be read in YAML or JSON format and must contain the client build modifiers.

Supported modifiers:

  • client: Name of the client, eg: besu, go-ethereum, etc
  • dockerfile: Dockerfile to use. E.g. using dockerfile: git will build using Dockerfile.git instead of the default Dockerfile
  • build_args: Build arguments passed to the docker build engine to use when building the image

Supported docker image build arguments depend on the client and the docker image being used, but common client build arguments are:

  • tag: Git branch or docker tag name to use during build process.
  • github: The repository containing the client source code (for git-based Dockerfiles)
  • baseimage: The client image name on DockerHub.

Also adds example dockerfiles for go-ethereum: Dockerfile.git, to build from a git branch, and Dockerfile.local to build from a local source path.

This change should allow clients to introduce different Dockerfiles to test using hive in many different environments, such as the CI.

@spencer-tb
Copy link
Contributor

💯 - I am a big fan of this, it will make testing each client much much easier! Especially with Dockerfile.local :D

@marioevz
Copy link
Member Author

marioevz commented May 12, 2023

@fjl Another option for the yaml/json files is to have a build_params key which could basically be a dictionary that contains any build parameter passed to the docker build:

- name: go-ethereum
  dockerfile: git
- name: nethermind
  build_args:
    user: nethermindeth
    repo: hive
    branch: latest
- name: go-ethereum
  dockerfile: local
  build_args:
    local_path: ./path/to/local/code/base/

The problem here would be how to tag each image built.

Right now we simply append the branch to the client's name to form the tag (go-ethereum-master), but with an arbitrary amount of parameters this could become cumbersome.

One possibility could be to create the tag using the source client config yaml/json file name and index of the client in the file.

E.g. for a clients.yaml:

- name: go-ethereum
  dockerfile: git
- name: nethermind
  build_args:
    user: nethermindeth
    repo: hive
    branch: latest
- name: go-ethereum
  dockerfile: local
  build_args:
    local_path: ./path/to/local/code/base/

the client images could be named go-ethereum-clients-1, nethermind-clients-2, go-ethereum-clients-3.

@fjl fjl force-pushed the clients-build-arguments branch from 2f0907c to b386a8a Compare May 30, 2023 21:52
@fjl fjl changed the title libhive,libdocker: JSON/YAML files for clients' build arguments libhive: support for client build args configured in YAML file May 30, 2023
@fjl fjl changed the title libhive: support for client build args configured in YAML file libhive: build args and alternative dockerfiles, configured with YAML file May 30, 2023
@fjl fjl changed the title libhive: build args and alternative dockerfiles, configured with YAML file libhive: client build args and alternative dockerfiles May 30, 2023
@fjl
Copy link
Collaborator

fjl commented May 31, 2023

This is almost ready now, there's just a small issue left:

Before this change, one could run multiple versions of the same client, which can be useful in sync tests, for example. This feature doesn't work anymore. For example, using this commandline

./hive -client go-ethereum,go-ethereum_v1.11.1 --sim ethereum/sync

both client images will be built, but the simulation will only see one client, "go-ethereum". I need to introduce an algorithm that assigns unique names to the clients to fix this.

We could go with the ClientDesignator.String as the name, but then the names would be kind of long. Might be better to find another method.

@marioevz
Copy link
Member Author

marioevz commented May 31, 2023

@fjl how about hashing the names of values of the parameters in the yaml files and do a 4-byte concatenation of this to generate an unique name ?

I can implement this if you'd like.

edit: The main issue is that it might be confusing later when you want to check the logs to find the hash of the specific configuration you want.

Another possibly better solution would be to have a name field in the yaml and use that as the name of the image, if not specified, default to concatenate using the method you described.

@marioevz
Copy link
Member Author

@fjl I pushed this change:

- client: nethermind
  image_name: nethermind-4844
  build_args:
    repo: nethermind
    branch: eip-4844-v6

==
image=hive/clients/nethermind-4844:latest
and

- client: nethermind
  build_args:
    repo: nethermind
    branch: eip-4844-v6

==
image=hive/clients/nethermind_branch_eip-4844-v6_repo_nethermind:latest

Let me know what you think, we can do this or think about another approach :)

@fjl fjl force-pushed the clients-build-arguments branch from 2e9a9d1 to 78e110d Compare June 1, 2023 19:20
fjl added 3 commits June 2, 2023 15:13
Renames "branch" -> "tag" because it's more universal.
Removes "user" / "repo" in favor of "github" and "baseimage".
@fjl fjl merged commit e934b61 into ethereum:master Jun 2, 2023
racytech pushed a commit to racytech/hive that referenced this pull request Apr 4, 2025
🤖 I have created a release *beep* *boop*
---


##
[4.3.0](ethpandaops/ethereum-package@4.2.0...4.3.0)
(2024-09-23)


### Features

* add prefunded accounts
([ethereum#752](ethpandaops/ethereum-package#752))
([1be7efa](ethpandaops/ethereum-package@1be7efa))
* dora - show more infos about all peers on client pages
([ethereum#760](ethpandaops/ethereum-package#760))
([c77d95f](ethpandaops/ethereum-package@c77d95f))


### Bug Fixes

* `metrics-host-allowlist` for Teku
([ethereum#765](ethpandaops/ethereum-package#765))
([ad75fcc](ethpandaops/ethereum-package@ad75fcc))
* built in validator lifecycle test for assertoor
([ethereum#763](ethpandaops/ethereum-package#763))
([6f868cc](ethpandaops/ethereum-package@6f868cc))
* explicitly set client contexts
([ethereum#755](ethpandaops/ethereum-package#755))
([94dc531](ethpandaops/ethereum-package@94dc531))
* no default resource limits
([ethereum#768](ethpandaops/ethereum-package#768))
([4c4831b](ethpandaops/ethereum-package@4c4831b))
* prysm gRPC removal - use http server instead for keymanager
([ethereum#761](ethpandaops/ethereum-package#761))
([ba91174](ethpandaops/ethereum-package@ba91174))
* remove epoch checker for goomy
([ethereum#754](ethpandaops/ethereum-package#754))
([f124bbf](ethpandaops/ethereum-package@f124bbf))
* remove exp RPC API namespace flag from nimbus-eth1 configuration
([ethereum#767](ethpandaops/ethereum-package#767))
([8fec454](ethpandaops/ethereum-package@8fec454))
* reth-builder volume claim
([ethereum#771](ethpandaops/ethereum-package#771))
([4570328](ethpandaops/ethereum-package@4570328))
* update dora config for latest release & remove custom images
([ethereum#748](ethpandaops/ethereum-package#748))
([a433c50](ethpandaops/ethereum-package@a433c50))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants