Skip to content

Move ee files from OSS to private repo script #5858

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 4 commits into from
Jun 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move ee files option
  • Loading branch information
diegoimbert committed Jun 3, 2025
commit 7b7bfc44bea62d785201271ff13f8d198eecee4c
24 changes: 23 additions & 1 deletion backend/substitute_ee_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ root_dirpath="$(cd "${script_dirpath}/.." && pwd)"

REVERT="NO"
COPY="NO"
MOVE_NEW_FILES="NO"
EE_CODE_DIR="../windmill-ee-private/"

while [[ $# -gt 0 ]]; do
Expand All @@ -15,6 +16,7 @@ while [[ $# -gt 0 ]]; do
# this to work (commit hooks should prevent this from happening, as well as the fact
# that we're using symlinks by default).
REVERT="YES"
MOVE_NEW_FILES="YES"
Copy link
Contributor

Choose a reason for hiding this comment

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

It appears that the -r|--revert case automatically sets MOVE_NEW_FILES="YES", which doesn't align with the expected behavior. This forces the move functionality to run whenever reverting, even if not explicitly requested. Consider removing this line to keep the revert functionality focused on its primary purpose, allowing users to explicitly combine flags when needed.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

intended

shift
;;
-c|--copy)
Expand All @@ -25,6 +27,11 @@ while [[ $# -gt 0 ]]; do
COPY="YES"
shift # past argument
;;
-m|--move-new-files)
# This moves all new EE files from the public repository to the private repository.
MOVE_NEW_FILES="YES"
shift # past argument
;;
-d|--dir)
# Path to the local directory of the windmill-ee-private repository. By defaults, it
# assumes it is cloned next to the Windmill OSS repo.
Expand Down Expand Up @@ -64,7 +71,7 @@ if [ "$REVERT" == "YES" ]; then
ce_file="${root_dirpath}/backend/${ce_file}"
rm ${ce_file}
done
else
elif [ "$MOVE_NEW_FILES" == "NO" ]; then
# This replaces all files in current repo with alternative EE files in windmill-ee-private
for ee_file in $(find "${EE_CODE_DIR}" -name "*ee.rs"); do
ce_file="${ee_file/${EE_CODE_DIR}/}"
Expand All @@ -78,3 +85,18 @@ else
fi
done
fi

if [ "$MOVE_NEW_FILES" == "YES" ]; then
for ce_file in $(find "${root_dirpath}"/backend/windmill-*/src/ -name "*ee.rs"); do
backend_dirpath="${root_dirpath}/backend/"
ee_file="${ce_file/${backend_dirpath}/}"
ee_file="${EE_CODE_DIR}${ee_file}"
if [ ! -f "${ee_file}" ]; then\
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a trailing backslash at the end of this condition that should be removed:

if [ ! -f "${ee_file}" ]; then\

Should be:

if [ ! -f "${ee_file}" ]; then

The backslash is typically used for line continuation in shell scripts, but it's unnecessary here and could cause syntax errors since the line already ends with a complete shell construct.

Suggested change
if [ ! -f "${ee_file}" ]; then\
if [ ! -f "${ee_file}" ]; then\

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the stray backslash at the end of the if condition to prevent syntax errors.

Suggested change
if [ ! -f "${ee_file}" ]; then\
if [ ! -f "${ee_file}" ]; then

mv "${ce_file}" "${ee_file}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure the target directory for the moved file exists (e.g., use mkdir -p $(dirname "${ee_file}")) before executing mv.

Suggested change
mv "${ce_file}" "${ee_file}"
mkdir -p "$(dirname \"${ee_file}\")" && mv "${ce_file}" "${ee_file}"

if [ ! "$REVERT" == "YES" ]; then
ln -s "${ee_file}" "${ce_file}"
fi
echo "File moved '${ce_file} -->> '${ee_file}'"
Copy link
Contributor

Choose a reason for hiding this comment

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

Fix the echo quoting; likely intended to be: "File moved '${ce_file}' -->> '${ee_file}'".

Suggested change
echo "File moved '${ce_file} -->> '${ee_file}'"
echo "File moved '${ce_file}' -->> '${ee_file}'"

fi
done
fi