Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Adding rebase patches step to update-automation workflow #36

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
vpaiu merged 23 commits into aws:main from vpaiu:rebase-patches
Aug 18, 2025

Conversation

Copy link
Contributor

@vpaiu vpaiu commented Aug 18, 2025

Description of changes:

  • Added rebasing logic to scripts/prepare-src.sh. Rebasing is run by adding the --rebase flag when running the script.
  • Added step for running the rebasing for each target in the update-automation workflow.
  • Added new job in update-automation.yaml for handling failures and sending metrics to CW (the job is activated when the update-automation job fails). The logic for sending metrics to CW will be implemented in a following PR.
  • Changed the prepare-src.sh script to be runnable for different targets.
  • Created .json configuration files for each target.
  • The rebasing currently does the following:
    • First, checks for unsaved changes (user forgot to run quilt refresh to save his changes to the patch) and if there are any it exits and informs the user.
    • If there are no unsaved changes, then the script proceeds with doing the rebasing for the patches.
    • The rebasing works by applying patches one by one with quilt push -f -m and if the command fails it captures the missing files or conflicts from the comand output and generates instructions for the user.

Testing:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

vpaiu added 18 commits August 14, 2025 15:36
@@ -24,7 +30,7 @@ jobs:
LATEST_SEMVER=$(git branch -r | grep -E 'origin/[0-9]+\.[0-9]+$' | sed 's/.*origin\///' | sort -V | tail -1)
# For testing purposes
if [ -z "$LATEST_SEMVER" ]; then
LATEST_SEMVER="main"
LATEST_SEMVER="rebase-patches"
Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025

Choose a reason for hiding this comment

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

Should this be main instead of rebase-patches?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The rebase-patches was for testing purposes.

# Test each target sequentially with rebasing
FAILED_TARGETS=()

for target in code-editor-server code-editor-sagemaker-server code-editor-web-embedded; do
Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025

Choose a reason for hiding this comment

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

There's also a 4th one here - code-editor-web-embedded-with-terminal.

Copy link
Contributor Author

@vpaiu vpaiu Aug 18, 2025
edited
Loading

Choose a reason for hiding this comment

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

I didn't add it because I didn't see it in build-targets.yaml should I also add it there?

Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025

Choose a reason for hiding this comment

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

Yup, we can add it over there too.

Comment on lines +130 to +139
handle-failures:
name: Handle Failures
runs-on: ubuntu-latest
needs: update-automation
if: failure()
steps:
- name: Report rebase failures
run: |
# TODO: Implement metric reporting to CW.
exit 1
Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025

Choose a reason for hiding this comment

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

It looks like we have created this as a separate job, independent of the previous update-automation job. From GitHub docs

by default, jobs have no dependencies and run in parallel

If this job runs in parallel with the update-automation job, then failure handling won't work as expected for us. We should move this step as part of the update-automation job itself, right after the rebasing for all targets step. Example here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The needs: attribute of the handle-failures job specifies that it is run after update-automation is finished (they don't run in parallel), and the if attribute activates the job only if update-automation ended in failure. I created it as a separate job because there are multiple points in the update-automation workflow where metrics would need to be sent to CW in case of failure.

Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025

Choose a reason for hiding this comment

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

Makes sense! But we will need to publish a failure metric in case any of the step in the update-automation job fails, and not just if the rebasing step fails.

vpaiu reacted with thumbs up emoji
@@ -0,0 +1,15 @@
{
Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025
edited
Loading

Choose a reason for hiding this comment

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

We should also use version here for all configuration files, just to keep it consistent with the internal ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will add.

Comment on lines 159 to 161
if [[ "$REBASE" == "true" ]]; then
check_unsaved_changes
fi
Copy link
Contributor

@sachinh-amazon sachinh-amazon Aug 18, 2025
edited
Loading

Choose a reason for hiding this comment

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

Instead of using boolean flags here to determine if rebasing should be executed or not, we should use different functions here. Extract all the common functionality to functions and then call them one by one. For example:

apply_overrides() {
 echo "Applying overrides"
 rsync -a "${PRESENT_WORKING_DIR}/overrides/" "${PATCHED_SRC_DIR}"
 rsync -a "${PRESENT_WORKING_DIR}/$overrides_path/" "${PATCHED_SRC_DIR}"
 
 echo "Applying package-lock overrides"
 rsync -a "${PRESENT_WORKING_DIR}/package-lock-overrides/sagemaker.series/" "${PATCHED_SRC_DIR}"
 rsync -a "${PRESENT_WORKING_DIR}/$package_lock_path/" "${PATCHED_SRC_DIR}"
}
prepare_patch_directory() {
 echo "Cleaning build src dir"
 rm -rf "${PATCHED_SRC_DIR}"
 # Copy third party source
 echo "Copying third party source to the patch directory"
 rsync -a "${PRESENT_WORKING_DIR}/third-party-src/" "${PATCHED_SRC_DIR}"
}
# Any more common functionality which can be extracted to a function

And then write different methods for preparing source and rebasing:

prepare-src() {
 prepare_patch_directory
 # Apply patches
 apply_overrides
}
rebase() {
 prepare_patch_directory
 check_unsaved_changes
 rebase
 apply_overrides
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will refactor according to this.


echo "Applying package-lock overrides"
rsync -a "${PRESENT_WORKING_DIR}/package-lock-overrides/sagemaker.series/" "${PATCHED_SRC_DIR}"
rsync -a "${PRESENT_WORKING_DIR}/$package_lock_path/" "${PATCHED_SRC_DIR}"
Copy link
Contributor

Choose a reason for hiding this comment

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

this command is going to fail for code-editor-server and code-editor-web-embedded, because there is no folders package-lock-overrides/web-server.series or package-lock-overrides/web-server.series. We need to add empty folders

vpaiu reacted with thumbs up emoji
@vpaiu vpaiu merged commit adcd6a5 into aws:main Aug 18, 2025
1 check passed
@vpaiu vpaiu deleted the rebase-patches branch August 19, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@aderende aderende aderende approved these changes

@sachinh-amazon sachinh-amazon sachinh-amazon approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /