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

fix: make BUILD_BRANCH as a dynamic argument for the Dockerfile inste… #4716

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

mur-me
Copy link
Collaborator

@mur-me mur-me commented Jul 22, 2024

Issue

Previously, when we run main_hotfix CI build to create an image.
One of our users noticed that image still has previous version inside.

After quick investigation, I found the root cause:

RUN git clone https://github.com/harmony-one/harmony.git harmony \
&& git clone https://github.com/harmony-one/bls.git bls \
&& git clone https://github.com/harmony-one/mcl.git mcl \
&& git clone https://github.com/harmony-one/go-sdk.git go-sdk

We have hard-coded main branch inside the Dockerfile.

What I've done to fix this:

  1. Added new argument BUILD_BRANCH with default main
  2. Added this new argument both to ci-tag.yaml and ci.yaml
  3. Used github.ref_name from Github actions default-environment-variables list which will give the short ref name of the branch or tag that triggered the workflow run and propagated as BUILD_BRANCH to the docker file.
    Details below:
flowchart TD
     id0(Triggered_build) --> id1(github.ref_name populated in Github action)  --> id2(BUILD_BRANCH provided as build-arg to the docker build) --> id3(default ARG is rewritten) --> id4(image build for the custom branch)
Loading

Test

I've tested locally the default and custom build argument propagation:
Default:

user@laptop:~/go/src/github.com/harmony-one/harmony/scripts/docker$ docker buildx build .
...
 => [builder 4/6] RUN git clone --branch main https://github.com/harmony-one/harmony.git harmony
user@laptop:~/go/src/github.com/harmony-one/harmony/scripts/docker$ docker buildx build --build-arg BUILD_BRANCH=dev 
...
 => [builder 4/6] RUN git clone --branch dev https://github.com/harmony-one/harmony.git harmony

End to end testing on my fork

Idea was to remove everything in CI around the changed github action and test the integration of ARG BUILD_BRANCH and github.ref_name - and value was passed though to the docker itself == test passed ✔️ :

https://github.com/mur-me/harmony/actions/runs/10092656255/job/27906739083#step:5:458

Unit Test Coverage

Test/Run Logs

Operational Checklist

  1. Does this PR introduce backward-incompatible changes to the on-disk data structure and/or the over-the-wire protocol?. (If no, skip to question 8.)

    YES|NO

  2. Describe the migration plan.. For each flag epoch, describe what changes take place at the flag epoch, the anticipated interactions between upgraded/non-upgraded nodes, and any special operational considerations for the migration.

  3. Describe how the plan was tested.

  4. How much minimum baking period after the last flag epoch should we allow on Pangaea before promotion onto mainnet?

  5. What are the planned flag epoch numbers and their ETAs on Pangaea?

  6. What are the planned flag epoch numbers and their ETAs on mainnet?

    Note that this must be enough to cover baking period on Pangaea.

  7. What should node operators know about this planned change?

  8. Does this PR introduce backward-incompatible changes NOT related to on-disk data structure and/or over-the-wire protocol? (If no, continue to question 11.)

    YES|NO

  9. Does the existing node.sh continue to work with this change?

  10. What should node operators know about this change?

  11. Does this PR introduce significant changes to the operational requirements of the node software, such as >20% increase in CPU, memory, and/or disk usage?

TODO

@mur-me mur-me force-pushed the fix/docker_build_for_releases branch from a025a95 to 96deed1 Compare July 24, 2024 09:52
@mur-me mur-me force-pushed the fix/docker_build_for_releases branch from 96deed1 to 74f5199 Compare July 24, 2024 14:39
@mur-me mur-me marked this pull request as ready for review July 25, 2024 08:26
@sophoah sophoah merged commit 6b25283 into dev Jul 26, 2024
4 checks passed
@mur-me mur-me deleted the fix/docker_build_for_releases branch July 26, 2024 12:31
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