Closed huonw closed 3 months ago
should I take this up? I assume this would just be a one line change right?
should I take this up? I assume this would just be a one line change right?
you are more than welcome to. I'm not sure if there's any deprecations that may need adressing, but if not, yes it's a one line change.
Thanks for offering @Kaushik-Iyer. Don't feel like you need to do all of them, any that you can chip away at would be great!
Is this something that could be scriptable from an action? Or setup those repos with hooks to auto-update when a new version is pushed? I noticed that some are a few versions back.
Edit: Not perfect, but not bad either 🤷🏽 - I just pushed a few PRs from this
Edit edit: Gist (https://gist.github.com/sureshjoshi/2260f08a1d81e7209f7b5d0901c955ad)
#! /bin/bash
VERSION="$1"
OWNER="${2:-sureshjoshi}"
echo "Updating all repos to use pants version $VERSION for owner $OWNER"
if [ -z "$VERSION" ]; then
echo "Please provide a version string as the first argument."
exit 1
fi
REPOS=(
"example-adhoc"
"example-codegen"
"example-django"
"example-docker"
"example-golang"
"example-javascript"
"example-jvm"
"example-kotlin"
"example-python"
"example-serverless"
"example-visibility"
)
for repo in "${REPOS[@]}"; do
echo ""
echo "********** Updating $repo **********"
echo ""
rm -rf $repo
# Sync your personal fork with pantsbuild in case it's out of date
gh repo sync "$OWNER/$repo"
# Clone your personal fork
gh repo clone "$OWNER/$repo"
(cd $repo
# Updates the pants_version inside of pants.toml
sed -i '' "s/pants_version = .*/pants_version = \"$VERSION\"/g" pants.toml
# Check if there were any changes
if [[ $(git status -s) == "" ]]; then
echo "*** No changes to commit for $repo with version $VERSION... Continuing..."
continue
fi
# Run a sanity check to make sure the repo is still in a good state
if ! $(pants lint test ::); then
echo "*** pants sanity check failed for $repo with version $VERSION. This repo will not be updated... $result"
continue
fi
# Commit the changes
git add pants.toml
git commit -m "Upgrade to Pants $VERSION"
# Push the changes to your personal fork, and create a PR to pantsbuild
git push
gh pr create --title "Upgrade to Pants $VERSION" --body ""
)
done
Just a note, codegen and golang fail on my machine, as I don't have the required dependencies. So, if someone else can tackle those.
one day, when I get a bit more experienced, hopefully I also get the thoughts and skills to do such stuff @sureshjoshi :D
Thanks everyone for jumping in! Last upgrade at https://github.com/pantsbuild/setup/pull/147
Now that 2.20.0 is released, we should update all the example- repos to use it, by adjusting their
pants.toml
to havepants_version = "2.20.0"
: https://github.com/pantsbuild?q=example&type=all&language=&sort=name(NB. not https://github.com/pantsbuild/example-plugin)
Bonus points (repos that use pants but aren't examples):