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

[bk] Update individual package publish pipeline to handle rcs #25352

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re
from pathlib import Path
from typing import List

from dagster_buildkite.python_version import AvailablePythonVersion
Expand All @@ -17,14 +15,6 @@ def build_prerelease_package_steps() -> List[BuildkiteStep]:
+ _get_uncustomized_pkg_roots("examples/experimental", [])
)

# Get only packages that have a fixed version in setup.py
filtered_packages = []
for package in packages:
setup_file = Path(package) / "setup.py"
contents = setup_file.read_text()
if re.findall(r"version=\"[\d\.]+\"", contents):
filtered_packages.append(package)

input_step: BlockStep = {
"block": ":question: Choose package",
"prompt": None,
Expand All @@ -39,7 +29,7 @@ def build_prerelease_package_steps() -> List[BuildkiteStep]:
else package,
"value": package,
}
for package in filtered_packages
for package in packages
],
"hint": None,
"default": None,
Expand Down
24 changes: 23 additions & 1 deletion scripts/build_and_publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ if [ -z "$PACKAGE_TO_RELEASE_PATH" ]; then
echo "Please provide the path to the package to release."
exit 1
fi

EXISTING_VERSION=$(grep 'version=' $PACKAGE_TO_RELEASE_PATH/setup.py)
HAS_FIXED_VERSION=0
if [[ $EXISTING_VERSION == *"\""* ]]; then
HAS_FIXED_VERSION=1
fi

if [ -z "$VERSION_TO_RELEASE" ]; then
if [ $HAS_FIXED_VERSION -eq 0 ]; then
echo "Package does not have a fixed version in setup.py, please provide release candidate version to release."
exit 1
fi
echo "Inferring version to release from package."
EXISTING_VERSION=$(grep 'version=' $PACKAGE_TO_RELEASE_PATH/setup.py)
echo "Existing version: $EXISTING_VERSION"
Expand All @@ -20,6 +31,12 @@ if [ -z "$VERSION_TO_RELEASE" ]; then
echo "Going to release version $VERSION_TO_RELEASE"
fi

if [ $HAS_FIXED_VERSION -eq 0 ] && [[ $VERSION_TO_RELEASE != *"rc"* ]]; then
echo "Since this package is published weekly, you must provide a release candidate version to release."
exit 1
fi


# Update both a hardcoded version, if set, in setup.py, and
# find where __version__ is set and update it
echo "Updating version in source..."
Expand Down Expand Up @@ -48,4 +65,9 @@ git commit -m "$PACKAGE_NAME $VERSION_TO_RELEASE"

git tag "$PACKAGE_NAME/v$VERSION_TO_RELEASE"
git push origin "$PACKAGE_NAME/v$VERSION_TO_RELEASE"
git push origin $BUILDKITE_BRANCH

# only push to branch if there is a fixed version
if [ $HAS_FIXED_VERSION -eq 1 ]; then
git push origin $BUILDKITE_BRANCH
exit 0
fi