Skip to content

ci: build and publish docker image on tag#1818

Merged
morph-dev merged 4 commits into
ethereum:masterfrom
morph-dev:circleci
May 13, 2025
Merged

ci: build and publish docker image on tag#1818
morph-dev merged 4 commits into
ethereum:masterfrom
morph-dev:circleci

Conversation

@morph-dev
Copy link
Copy Markdown
Collaborator

@morph-dev morph-dev commented May 10, 2025

What was wrong?

We would like to revisit and update our docker image tagging, and simplify release process.

See #1816 for details.

Note: It's my first time doing circleci config.

How was it fixed?

I modified circleci config file in following ways:

  • added parameters to docker-build and docker-publish jobs
    • this allows us to specify which docker file to use (using target parameter, e.g. trin vs bridge) and which tag to set ("latest" vs "vX.Y.Z")
    • allows specifying variable number of tags
    • made docker-build-bridge and docker-publish-bridge no longer needed
  • created workflow that would run only when new tag is pushed on master branch:
    • tag has to start with v
    • this workflow would build and push docker image with <git-tag>-<git-commit>, stable and prod docker tags
  • we use different repository for trin and bridge binaries, which follow the same tagging scheme
    • repositories:
      • portalnetwork/trin
      • portalnetwork/bridge
    • tags:
      • latest - built automatically on every push to master
      • <git-tag>-<git-commit> - version tag (immutable), corresponds to every individual git tag
      • stable - updated automatically to match the latest version tag
      • prod - same as stable, but we use it for deploying for production fleet
        • we could decouple this in the future

I also updated trin book to reflect these changes.

@morph-dev morph-dev requested review from KolbyML and carver May 10, 2025 13:23
@morph-dev morph-dev self-assigned this May 10, 2025
Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look generally look good. I don't think we should be specifying sudo for docker login though.

Comment thread book/src/developers/contributing/releases/deployment.md Outdated
Comment on lines +78 to +80
- State network nodes:
```bash
ansible-playbook playbook.yml --tags state-network
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we wrap up history and I start working on State again, I will likely be doing deploys to the state nodes outside the standard release cycle.

I am just stating this, as this was un-commented out and the warning was removed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed in a call. Will leave the state-network in, and we can remove it once we stop deploying regular releases.

@morph-dev
Copy link
Copy Markdown
Collaborator Author

@KolbyML @carver Ready for a review.

I implemented changes that were discussed in a call.

Copy link
Copy Markdown
Member

@KolbyML KolbyML left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit: looks good

Copy link
Copy Markdown
Contributor

@carver carver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with a fix or two. I'm happy to review again if you want, but no need to block on me if you have solutions you're happy with.

Comment thread book/src/developers/contributing/releases/deployment.md Outdated
git checkout master
git pull --ff-only upstream master
```
```bash
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this indent affect the rendering?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, makes them aligned with bullet points.

Original:
Screenshot from 2025-05-12 23-39-07

My version:
image

Comment thread book/src/developers/contributing/releases/release_checklist.md Outdated
Comment thread .circleci/config.yml
- docker-build:
name: docker_build_trin
target: trin
tags: << pipeline.git.tag >>-$(git rev-parse --short HEAD) stable prod
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't expect this git command to work here. The repo checkout happens as a step inside the job, so I don't think it's available yet.

It does look like pipeline.git.revision should give access to it though. Just need to select the first few characters of it, because that value is the whole SHA hash.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised as well, but it actually works! I used #1817 to test how it works (I remove tag filter and disabled actual publishing).

It worked because it inlined the parameter inside job. Check the result here:
Check: https://app.circleci.com/pipelines/github/ethereum/trin/7758/workflows/77e527f9-b579-49a6-9b04-9392a4a2821f/jobs/37651

image

I also checked that saving and loading image in different job preserves all tags:
https://app.circleci.com/pipelines/github/ethereum/trin/7758/workflows/77e527f9-b579-49a6-9b04-9392a4a2821f/jobs/37653
image

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to use pipeline.git.revision but I didn't know how to extract only first couple of characters (before passing it as a parameter).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised as well, but it actually works! I used #1817 to test how it works (I remove tag filter and disabled actual publishing).

It worked because it inlined the parameter inside job.

Ah, neat! Good to know 👍🏻

I tried to use pipeline.git.revision but I didn't know how to extract only first couple of characters (before passing it as a parameter).

Yeah, there's no reason to use the CI revision value if the git command works 👍🏻

Comment thread .circleci/config.yml
Comment thread .circleci/config.yml Outdated
@morph-dev
Copy link
Copy Markdown
Collaborator Author

Added few clarifying comments, and added explanation for stable tag.

@morph-dev morph-dev merged commit 964e561 into ethereum:master May 13, 2025
17 checks passed
@morph-dev morph-dev deleted the circleci branch May 13, 2025 06:27
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