Skip to content

Reduce the amount of data copied to the workflow pod#293

Merged
nikola-jokic merged 12 commits intomainfrom
nikola-jokic/reduce-copy
Dec 10, 2025
Merged

Reduce the amount of data copied to the workflow pod#293
nikola-jokic merged 12 commits intomainfrom
nikola-jokic/reduce-copy

Conversation

@nikola-jokic
Copy link
Copy Markdown
Collaborator

@nikola-jokic nikola-jokic commented Dec 4, 2025

Fixes #274

@nikola-jokic nikola-jokic changed the title Nikola jokic/reduce copy Reduce the amount of data copied to the workflow pod Dec 7, 2025
@nikola-jokic nikola-jokic marked this pull request as ready for review December 8, 2025 11:00
@nikola-jokic nikola-jokic requested a review from a team as a code owner December 8, 2025 11:00
Copilot AI review requested due to automatic review settings December 8, 2025 11:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR optimizes data copying to workflow pods by implementing a selective merge strategy instead of bulk copying all temporary files. The changes introduce a staging directory approach where only modified _runner_file_commands are overwritten and other files are appended only if missing, reducing unnecessary data transfer.

Key changes:

  • Implemented a two-stage copy process with a temporary staging directory (/_temp_pre) that merges into the final directory (/_temp)
  • Enhanced fixArgs() to preserve shell command arguments for sh -c patterns without re-tokenizing
  • Removed unnecessary quote wrapping from shell commands passed to execPodStep

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
packages/k8s/src/hooks/run-script-step.ts Implements new merge strategy with staging directory and selective file copying to reduce data transfer
packages/k8s/src/k8s/utils.ts Adds special handling in fixArgs to preserve sh -c command arguments without re-tokenizing
packages/k8s/src/k8s/index.ts Removes unnecessary quotes from Alpine detection shell command
packages/k8s/tests/prepare-job-test.ts Updates test to use recursive directory creation and removes unnecessary quote wrapping

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// - Append files not already present elsewhere
const mergeCommands = [
'set -e',
'mkdir -p /__w/_temp /__w/_temp_pre',
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The directories /__w/_temp and /__w/_temp_pre are already created in lines 30-39 before this merge command runs. The mkdir -p on this line is redundant and can be removed to simplify the code.

Suggested change:

'set -e',
'SRC=/__w/_temp_pre',
'DST=/__w/_temp',
Suggested change
'mkdir -p /__w/_temp /__w/_temp_pre',

Copilot uses AI. Check for mistakes.
Comment thread packages/k8s/src/hooks/run-script-step.ts Outdated
Comment thread packages/k8s/src/hooks/run-script-step.ts Outdated
nikola-jokic and others added 4 commits December 8, 2025 12:15
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

Severe slowdown in k8s-novolume hooks due to _temp scan and cross-pod sync with actions/setup-go

3 participants