Skip to content

Commit f0e1b5d

Browse files
authored
build: cater for packages without gapic_version.py in release please config action (googleapis#13436)
The Github Action that updates the [release please configuration](https://github.com/googleapis/google-cloud-python/blob/main/.github/workflows/configure_release_please.yml) recently started failing after PRs googleapis#13425, googleapis#13426 and googleapis#13427 were merged. The reason is that the action expects packages to have a file called `gapic_version.py`, however these packages do not. This PR updates the release please configuration script to exclude packages which do not have this file.
1 parent f47303a commit f0e1b5d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

scripts/configure_release_please/configure_release_please.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
SCRIPT_DIR = Path(__file__).resolve().parent
77
ROOT_DIR = Path(SCRIPT_DIR / ".." / "..").resolve()
88
PACKAGES_DIR = ROOT_DIR / "packages"
9+
PACKAGES_WITHOUT_GAPIC_VERSION = [
10+
"google-cloud-access-context-manager",
11+
"google-cloud-audit-log",
12+
"googleapis-common-protos",
13+
"grpc-google-iam-v1",
14+
]
915

1016

1117
def get_version_for_package(version_path: Path) -> Tuple[int]:
@@ -73,6 +79,8 @@ def configure_release_please_manifest(
7379
if f"packages/{package_dir.name}" not in manifest_json:
7480
manifest_json[f"packages/{package_dir.name}"] = "0.0.0"
7581

82+
if not package_supports_gapic_version(package_dir):
83+
continue
7684
gapic_version_file = next(package_dir.rglob("**/gapic_version.py"), None)
7785
if gapic_version_file is None:
7886
raise Exception("Failed to find gapic_version.py")
@@ -89,6 +97,16 @@ def configure_release_please_manifest(
8997
f.write("\n")
9098

9199

100+
def package_supports_gapic_version(package_dir: str) -> bool:
101+
"""Returns True if the given package directory is expected to have gapic_version.py """
102+
103+
for package in PACKAGES_WITHOUT_GAPIC_VERSION:
104+
if package_dir == Path(PACKAGES_DIR / package):
105+
return False
106+
107+
return True
108+
109+
92110
def configure_release_please_config(
93111
package_dirs: List[Path], root_dir: Path = ROOT_DIR
94112
) -> None:
@@ -111,7 +129,7 @@ def configure_release_please_config(
111129
str(file.relative_to(package_dir))
112130
for file in sorted(package_dir.rglob("**/gapic_version.py"))
113131
]
114-
if len(extra_files) < 1:
132+
if len(extra_files) < 1 and package_supports_gapic_version(package_dir):
115133
raise Exception("Failed to find gapic_version.py")
116134
for json_file in sorted(package_dir.glob("samples/**/*.json")):
117135
sample_json = {}

0 commit comments

Comments
 (0)