Skip to content

CmampTask12104_Improve_release_flow_of_prod_image_for_runnable_dir #669

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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

heanhsok
Copy link
Contributor

@heanhsok heanhsok commented May 6, 2025

Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok heanhsok self-assigned this May 6, 2025
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok heanhsok marked this pull request as ready for review May 6, 2025 18:00
heanhsok added 2 commits May 6, 2025 18:09
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok heanhsok added the PR for reviewers The PR needs to be reviewed by RPs label May 6, 2025
heanhsok added 2 commits May 6, 2025 21:38
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
@heanhsok
Copy link
Contributor Author

heanhsok commented May 6, 2025

FYI @PomazkinG
I'm planning to adopt the same approach for the release of the candidate image for our ECS task def

@heanhsok heanhsok requested a review from PomazkinG May 6, 2025 23:30
# to ensure the setup in the `prod` image mirrors that of the `dev` image.
# Use `find_immediate_git_root` instead of `get_git_root` to allow building
# of `prod` image from submodule.
git_root_dir = hgit.find_immediate_git_root()
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we are making the assumptions that 1) runnable dirs are not nested and 2) are only under the git root?

I agree with 1) (although we should document it, since it was implicit), but not sure about 2).

We can have a situation like:

- itsavvy (super-repo)
   - cmamp
      - helpers (sub-repo)
      - app (sub-repo)

In other words, I would call find_git_root and then descend to app doing os.path.relpath to build

Does it make (any) sense? I am a bit confused

Copy link
Contributor Author

@heanhsok heanhsok May 8, 2025

Choose a reason for hiding this comment

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

Oh the runnable dir can be nested and doesn't have to be directly under the git root. But we assume that a runnable dir is in a Git repo.

  • hgit.find_immediate_git_root() is for determining which parent repo to copy (since we want to copy the whole repo). For example, running it on
    • //cmamp//helpers/openai (for openai runnable dir) would return //helpers root
    • //orange//amp/ck_web_app/itsavvy(for itsavvy runnable dir) would return //amp root
  • If we use hgit.find_git_root(), it will return the outermost repo every time. For example,
    • If we want to build helpers, but we are in the submodule //cmamp/helpers, it will copy //cmamp, and not just //helpers
    • If we want to build itsavvy, but we are in the submodule //orange/amp/ck_web_app/itsavvy, it will copy //orange, and not just //cmamp
  • This is not a problem if we build from the super-module every time

Maybe this naming find_immediate_git_root is confusing? It supposes to return the parent repo (not the outermost) of the current runnable dir that we are trying to build

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have renamed it to find_parent_repo and added the explanation to make it clearer

Copy link
Contributor

Choose a reason for hiding this comment

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

Good explanation (yes find_parent_repo is much better).

What is still confusing is that I would expect that to release itsavvy in //orange/amp/ck_web_app/itsavvy, shouldn't the build context be //orange? Otherwise how to we guarantee that //helpers (and other potentially useful code) is covered?

Maybe I'm being too simplistic, but I would always copy all the code from the outermost repo, and have the outermost repo as build context, and build from the runnable dir.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What is still confusing is that I would expect that to release itsavvy in //orange/amp/ck_web_app/itsavvy, shouldn't the build context be //orange? Otherwise how to we guarantee that //helpers (and other potentially useful code) is covered?

I'm thinking because itsavvy is part of //cmamp (which is the parent repo), //cmamp build context should be sufficient.

Maybe I'm being too simplistic, but I would always copy all the code from the outermost repo, and have the outermost repo as build context, and build from the runnable dir.

I see. That would be much simpler. I was trying to make the image the same regardless of where it's built. :)

Assuming we want to build helpers, that would mean the prod image that is built from //helpers (which includes only //helpers code) and //cmamp//helpers (which includes //cmamp code) are different, right?

@heanhsok heanhsok requested a review from gpsaggese May 8, 2025 20:42
heanhsok added 2 commits May 8, 2025 16:56
Pre-commit checks:
- 'check_master' passed
- 'check_author' passed
- 'check_file_size' passed
- 'check_python_compile' passed
- 'check_gitleaks' passed
All checks passed ✅
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR for reviewers The PR needs to be reviewed by RPs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants