Skip to content

Commit

Permalink
Merge branch 'NVIDIA:main' into auto_cudagraph
Browse files Browse the repository at this point in the history
  • Loading branch information
JimmyZhang12 committed Sep 9, 2024
2 parents 0c33371 + e6f6a48 commit 9ba156c
Show file tree
Hide file tree
Showing 132 changed files with 13,166 additions and 883 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_test_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
steps:
- name: Docker system cleanup
run: |
docker system prune -a --filter "until=48h" --force
docker system prune -a --filter "until=48h" --force || true
- name: Docker pull image
run: |
Expand Down
99 changes: 86 additions & 13 deletions .github/workflows/cherry-pick-release-commit.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,101 @@
name: Create PR to main with cherry-pick from release

on:
pull_request_target:
push:
branches:
- 'r*.*.*'
types: ["closed"]
- main

jobs:
cherry-pick-release-commit:
name: Cherry-pick release commit
main:
runs-on: ubuntu-latest
environment:
name: main
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: github-cherry-pick-action v1.0.3
uses: carloscastrojumo/github-cherry-pick-action@bb0869df47c27be4ae4c7a2d93d22827aa5a0054
with:
branch: main
labels: |
cherry-pick
reviewers: |
${{ github.event.pull_request.user.login }}
token: ${{ secrets.PAT }}


- name: Cherry pick
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
set -x
set +e
git config --global user.email "nemo-bot@nvidia.com"
git config --global user.name "NeMo Bot"
SHA=$(git rev-list --no-merges -n 1 HEAD)
MESSAGE=$(git log -n 1 --pretty=format:%s $SHA)
PR_ID=$(echo $MESSAGE | awk -F'#' '{print $2}' | awk -F')' '{print $1}' )
PR=$(curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NVIDIA/NeMo/pulls/$PR_ID)
LABELS=$(echo -E $PR | jq '.labels | [.[].name] | join(",")' | tr -d '"')
TARGET_BRANCHES=$(echo "$LABELS" | grep -o 'r[^,]*')
if [[ $TARGET_BRANCHES == '' ]]; then
echo Nothing to cherry-pick
exit 0
fi

echo $TARGET_BRANCHES | while read -r RELEASE_BRANCH ; do
TARGET_BRANCH_EXISTS_OK=$([[ "$(git ls-remote --heads origin refs/heads/$RELEASE_BRANCH)" != "" ]] && echo true || echo false)

if [[ "$TARGET_BRANCH_EXISTS_OK" == "false" ]]; then
echo Release branch does not yet exist, will not cherry-pick
continue
fi

(
git fetch origin $RELEASE_BRANCH:$RELEASE_BRANCH
git switch --force-create cherry-pick-$PR_ID-$RELEASE_BRANCH $RELEASE_BRANCH
git cherry-pick $SHA
git push -u origin --force cherry-pick-$PR_ID-$RELEASE_BRANCH
git checkout ${CI_DEFAULT_BRANCH:-main}
)

CHERRYPICK_SUCCESSFUL=$?

if [[ $CHERRYPICK_SUCCESSFUL -eq 0 ]]; then
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/NVIDIA/NeMo/pulls \
-d '{"title":"Cherry-pick '$PR_ID' into '$RELEASE_BRANCH'","head":"cherry-pick-'$PR_ID'-'$RELEASE_BRANCH'","base":"'$RELEASE_BRANCH'"}'

else
URL=https://github.com/NVIDIA/NeMo/pull/${{ github.event.number }}

MESSAGE='{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":alert: Cherrypick bot 🤖: Cherry-pick of <'$URL'|#'${{ github.event.number }}'> failed"
}
}
]
}'

curl -X POST -H "Content-type: application/json" --data "$MESSAGE" ${{ secrets.SLACK_WEBHOOK }}

fi

done



env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 9ba156c

Please sign in to comment.