-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Backpropagate Cargo.lock updates to all lock files #9180
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2fe5058
Experiment to backpropagate Cargo.lock updates to all lock files
ryoqun 4787391
Move most of dependabot-specific code to its own file
ryoqun c7fe413
Various cleanups
ryoqun f55f194
Fine tune..
ryoqun a092c3f
Clean up shells and stop obscure API...
ryoqun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
cd "$(dirname "$0")/.." | ||
|
||
if ! echo "$BUILDKITE_BRANCH" | grep -E '^pull/[0-9]+/head$'; then | ||
echo "not pull request!?" >&2 | ||
exit 1 | ||
fi | ||
|
||
source ci/rust-version.sh stable | ||
|
||
ci/docker-run.sh $rust_nightly_docker_image ci/dependabot-updater.sh | ||
|
||
if [[ $(git status --short :**/Cargo.lock | wc -l) -eq 0 ]]; then | ||
echo --- ok | ||
exit 0 | ||
fi | ||
|
||
echo --- "(FAILING) Backpropagating dependabot-triggered Cargo.lock updates" | ||
|
||
name="dependabot-buildkite" | ||
api_base="https://api.github.com/repos/solana-labs/solana/pulls" | ||
pr_num=$(echo "$BUILDKITE_BRANCH" | grep -Eo '[0-9]+') | ||
branch=$(curl -s "$api_base/$pr_num" | python -c 'import json,sys;print json.load(sys.stdin)["head"]["ref"]') | ||
|
||
git add :**/Cargo.lock | ||
EMAIL="[email protected]" \ | ||
GIT_AUTHOR_NAME="$name" \ | ||
GIT_COMMITTER_NAME="$name" \ | ||
git commit -m "[auto-commit] Update all Cargo lock files" | ||
git push origin "HEAD:$branch" | ||
|
||
echo "Source branch is updated; failing this build for the next" | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
cd "$(dirname "$0")/.." | ||
source ci/_ | ||
|
||
commit_range="$(git merge-base HEAD origin/master)..HEAD" | ||
parsed_update_args="$( | ||
git log "$commit_range" --author "dependabot-preview" --oneline -n1 | | ||
grep -o 'Bump.*$' | | ||
sed -r 's/Bump ([^ ]+) from [^ ]+ to ([^ ]+)/-p \1 --precise \2/' | ||
)" | ||
package=$(echo "$parsed_update_args" | awk '{print $2}') | ||
if [[ -n $parsed_update_args ]]; then | ||
# shellcheck disable=SC2086 | ||
_ scripts/cargo-for-all-lock-files.sh \ | ||
"$(git grep --files-with-matches "$package" :**/Cargo.lock)" -- \ | ||
update $parsed_update_args | ||
fi | ||
|
||
echo --- ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
shifted_args=() | ||
while [[ -n $1 ]]; do | ||
if [[ $1 = -- ]]; then | ||
escape_marker=found | ||
shift | ||
break | ||
else | ||
shifted_args+=("$1") | ||
shift | ||
fi | ||
done | ||
|
||
# When "--" appear at the first and shifted_args is empty, consume it here | ||
# to unambiguously pass and use any other "--" for cargo | ||
if [[ -n $escape_marker && ${#shifted_args[@]} -gt 0 ]]; then | ||
files="${shifted_args[*]}" | ||
for file in $files; do | ||
if [[ $file = "${file%Cargo.lock}" ]]; then | ||
echo "$0: unrecognizable as Cargo.lock path (prepend \"--\"?): $file" >&2 | ||
exit 1 | ||
fi | ||
done | ||
shifted_args=() | ||
else | ||
files="$(git ls-files :**/Cargo.lock)" | ||
fi | ||
|
||
for lock_file in $files; do | ||
( | ||
set -x | ||
cd "$(dirname "$lock_file")" | ||
cargo "${shifted_args[@]}" "$@" | ||
) | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I really want to do before any our depending crates are compromised. :)