Skip to content
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

fix: ci github clone edge case #9320

Merged
merged 3 commits into from
Oct 22, 2024
Merged
Changes from 2 commits
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
21 changes: 12 additions & 9 deletions .github/ensure-builder/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,24 @@ runs:
# Set up a context for this run
- name: Copy Repo to Builder
shell: bash
env:
UNPACK: |
[ -d ~/run-$RUN_ID ] || (
mkdir -p ~/run-$RUN_ID-git &&
cd ~/run-$RUN_ID-git && tar xzf - &&
git config --global advice.detachedHead false &&
git clone ~/run-$RUN_ID-git/.git ~/run-$RUN_ID &&
echo ${{ env.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key &&
chmod 600 ~/.ssh/build_instance_key
)
run: |
sudo shutdown -P ${{ steps.select_instance.outputs.ttl }}
set -x
# detect run folder
if ! scripts/run_on_builder "[ -d ~/run-$RUN_ID ]" ; then
echo "Copying local repo to spot"
tar czf - .git | scripts/run_on_builder \
"mkdir -p ~/run-$RUN_ID-git && cd ~/run-$RUN_ID-git && tar xzf -" || true
scripts/run_on_builder "
echo "Unpacking repo"
git config --global advice.detachedHead false
git clone ~/run-$RUN_ID-git/.git ~/run-$RUN_ID
echo ${{ env.BUILD_INSTANCE_SSH_KEY }} | base64 --decode > ~/.ssh/build_instance_key
chmod 600 ~/.ssh/build_instance_key
" || true
(tar czf - .git || true) | scripts/run_on_builder \
"flock ~/git.lock bash -c '$UNPACK'"
fi

- name: Attach EBS Cache Disk
Expand Down
Loading