Skip to content
Merged
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
1 change: 0 additions & 1 deletion ci/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ jobs:
path: /usr/bin/python3
args: ["ci/scripts/autobump-dependencies.py"]
params:
REPO_ROOT: git
PR_BASE: master
PR_ORG: cloudfoundry
PR_LABEL: run-ci
Expand Down
61 changes: 58 additions & 3 deletions ci/scripts/autobump-dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ def fetch_latest_release(self) -> Release:
"""
raise NotImplementedError

def get_release_notes(self) -> str:
"""
Obtain changelog for the given current and latest release difference. This is useful to attach to the PR.
"""
raise NotImplementedError

def remove_current_blob(self):
current_blob_path = f"{self.package}/{self.name}-{self.current_version}.tar.gz"
if self._check_blob_exists(current_blob_path):
Expand Down Expand Up @@ -184,7 +190,7 @@ def open_pr_exists(self) -> bool:

for pr in self.remote_repo.get_pulls(
state="open", base=PR_BASE, head=f"{PR_ORG}:{self.pr_branch}"
): # theoretically there shold never be more than one open PR, print them anyways
): # theoretically there should never be more than one open PR, print them anyways
print(f"Open {self.pr_branch} PR exists: {pr.html_url}")
prs_exist = True
return prs_exist
Expand All @@ -196,8 +202,8 @@ def create_pr(self):
Automatic bump from version {self.current_version} to version {self.latest_release.version}, downloaded from {self.latest_release.url}.

After merge, consider releasing a new version of haproxy-boshrelease.
"""
)
""") + self.get_release_notes()

if not DRY_RUN:
self._create_branch(self.remote_repo, self.pr_branch)

Expand Down Expand Up @@ -285,6 +291,9 @@ def get_release_download_url(rel):

return latest_release

def get_release_notes(self) -> str:
return ""


@dataclass
class WebLinkDependency(Dependency):
Expand Down Expand Up @@ -320,6 +329,9 @@ def fetch_latest_release(self) -> Release:

raise Exception(f"Failed to get latest {self.name} version from {self.root_url}")

def get_release_notes(self) -> str:
return ""


@dataclass
class HaproxyDependency(Dependency):
Expand All @@ -344,6 +356,49 @@ def fetch_latest_release(self) -> Release:
version.parse(latest_version),
)

def get_release_notes(self) -> str:
current_version = self.current_version
latest_version = self.latest_release.version

if (current_version == latest_version):
raise Exception(f"""Changelog requested but current and latest versions are the same: {current_version}""")

releaseNote = textwrap.dedent(f"""
[Changelog for HAProxy {latest_version}](https://www.haproxy.org/download/{HAPROXY_VERSION}/src/CHANGELOG).

Please also check list of [known open bugs for HAProxy {latest_version}](https://www.haproxy.org/bugs/bugs-{latest_version}.html).

The developer's summary for this release can be found in [the Announcement post for the HAProxy {latest_version} release](https://www.mail-archive.com/search?l=haproxy%40formilux.org&q=announce+subject%3A%22[ANNOUNCE]+haproxy-{latest_version}%22+-subject%3A%22re:%22).
""")

wget(f"""https://www.haproxy.org/download/{HAPROXY_VERSION}/src/CHANGELOG""", "HAPROXY-CHANGELOG")
with open('HAPROXY-CHANGELOG', 'r') as file:
releaseNote += textwrap.dedent(f"""
<details>

<summary>HAPROXY CHANGELOG between {latest_version} and {current_version}</summary>

```
""")

startCopy = False
for line in file:
if (line.endswith(str(latest_version)+"\n")): # Start copying from latest version head
startCopy = True
if (line.endswith(str(current_version)+"\n")): # Stop when reaching current version
break
if not startCopy:
continue
releaseNote += line

releaseNote += textwrap.dedent(f"""
```

</details>""")

return releaseNote



def wget(url: str, path: str, auth: Optional[Tuple[str, str]] = None):
"""
Expand Down