-
Notifications
You must be signed in to change notification settings - Fork 25
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
Enable building specified components #265
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PhilippeMoussalli
I would like to be able to build the build_components.sh
script for example components as well. So I would propose to add the following arguments:
-d, --components-dir
directory with components to build, defaults tocomponents
-co, --component
specific component to build in the components dir, defaults to all
Note that currently we are passing in the first tag
as the fondant version as well, which is used as pip install git+https://github.com/ml6team/fondant@$tag
. So this will not work with arbitrary tags. They actually need to be refs available on the github repository. This script was made for usage in CI/CD and I'm not sure how well it will work outside it.
I can add the component directory argument in this PR. Regarding the other issue, I am still tagging them with the latest release tag and then using the |
Not sure if I understand what you mean with this, but outside of the CI/CD pipeline, we should never tag images with:
As these have special meaning in our release flow. |
bcd4fca
to
c08a6d8
Compare
Updated to add the directory as an argument to enable building custom images. I see, so if we want to avoid tagging image with the |
I don't think arbitrary tags will work, but (remote) commit hashes will. Eg. if you run
|
yes, the tagging I mentioned was mainly related to running the
Do you agree with this workflow? Anything else that needs to be done in this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the nits on the help message, but I want to make sure we are talking about the same things :)
scripts/build_components.sh
Outdated
echo " -t, --tag=<value> Tag to add to image, repeatable | ||
The first tag is set in the component specifications" | ||
echo " -h, --help Display this help message" | ||
echo " -t, --tag=<value> Tag to add to image, repeatable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo " -t, --tag=<value> Tag to add to image, repeatable | |
echo " -t, --tag <value> Tag to add to image, repeatable |
I don't think we handle =
correctly. This was already documented incorrectly in the past.
scripts/build_components.sh
Outdated
echo " -t, --tag=<value> Tag to add to image, repeatable | ||
The first tag is set in the component specifications" | ||
echo " -c, --cache <value> Use registry caching when building the components (default:false)" | ||
echo " -d, --component-dirs <value> Directory where the component is built from the root directory (default:components)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo " -d, --component-dirs <value> Directory where the component is built from the root directory (default:components)" | |
echo " -d, --component-dirs <value> Directory containing components to build as subdirectories. The path should be relative to the root directory (default:components)" |
scripts/build_components.sh
Outdated
The first tag is set in the component specifications" | ||
echo " -c, --cache <value> Use registry caching when building the components (default:false)" | ||
echo " -d, --component-dirs <value> Directory where the component is built from the root directory (default:components)" | ||
echo " -n, --namespace <value> Set the namespace (default: ml6team)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo " -n, --namespace <value> Set the namespace (default: ml6team)" | |
echo " -n, --namespace <value> The namespace for the built images, should match the github organization (default: ml6team)" |
scripts/build_components.sh
Outdated
-d |--components-dir ) components_dir="$2"; shift;; | ||
-r |--repo) repo="$2"; shift;; | ||
-t |--tag) tags+=("$2"); shift;; | ||
-co|--component) component="$2"; shift;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this repeatable so you can specify multiple components?
scripts/build_components.sh
Outdated
echo " -co, --component <value> Set the component name. Pass the component folder name to build | ||
a certain components or 'all' to build all components in the components | ||
directory (default: all)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo " -co, --component <value> Set the component name. Pass the component folder name to build | |
a certain components or 'all' to build all components in the components | |
directory (default: all)" | |
echo " -co, --component <value> Specific component to build. Pass the component subdirecotry name | |
to build a certain components or 'all' to build all components in the components | |
directory (default: all)" |
scripts/build_components.sh
Outdated
pushd "$dir" | ||
|
||
BASENAME=${dir%/} | ||
BASENAME=${BASENAME##*/} | ||
if [[ "$BASENAME" == "${component}" ]] || [[ "${component}" == "all" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do this a bit different? Python pseudo code:
components = [dir in components_dir] if component == "all" else [component]
print(f"building components {components}")
for component in components:
...
I think this would be easier to understand and debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @PhilippeMoussalli! Looks good to me apart from some formatting issues.
scripts/build_components.sh
Outdated
@@ -75,5 +99,6 @@ for dir in "$component_dir"/*/; do | |||
--label org.opencontainers.image.source=https://github.com/${namespace}/${repo} \ | |||
. | |||
|
|||
popd | |||
popd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation
scripts/build_components.sh
Outdated
cache_name=ghcr.io/${namespace}/${BASENAME}:build-cache | ||
echo "Caching from/to ${cache_name}" | ||
echo "Caching from/to ${cache_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation
scripts/build_components.sh
Outdated
@@ -61,10 +84,11 @@ for dir in "$component_dir"/*/; do | |||
args+=(-t "$tag") | |||
done | |||
|
|||
# Add cache arguments if caching is enabled | |||
# # Add cache arguments if caching is enabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double comment
scripts/build_components.sh
Outdated
*) echo "Unknown parameter passed: $1"; exit 1;; | ||
esac; shift; done | ||
|
||
# Check for required argument | ||
if [ -z "${tags}" ]; then | ||
if [ ${#tags[@]} -eq 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question was mainly meant to learn, not to ask you to revert 😅
But if they're equivalent, both are fine for me.
Seems like you have a conflict @PhilippeMoussalli. Feel free to merge after you resolve it. |
PR that enables specifying components during the build and tagging process, this makes it easier to build and push specific components during remote development.
PR that enables specifying components during the build and tagging process, this makes it easier to build and push specific components during remote development.