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
6 changes: 4 additions & 2 deletions .github/workflows/helm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ jobs:
run: ./dev/sign.sh dist/airflow-*.tgz dist/airflow-*-source.tar.gz
env:
SIGN_WITH: dev@airflow.apache.org
- name: "Fetch Git Tags"
run: git fetch --tags
- name: "Test helm chart issue generation automatically"
# Adding same tags for now, will address in a follow-up
run: >
breeze release-management generate-issue-content-helm-chart
--previous-release helm-chart/0.0.0dev0 --current-release helm-chart/0.0.0dev0
breeze release-management generate-issue-content-helm-chart --limit-pr-count 10
--latest --verbose
- name: "Upload Helm artifacts"
uses: actions/upload-artifact@v4
with:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
66451b1e0d4897113e3763e04d73b65e
3e0e080fa8422853ed7df3967725b35f
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
run_command,
)
from airflow_breeze.utils.shared_options import get_dry_run, get_verbose
from airflow_breeze.utils.version_utils import get_latest_airflow_version, get_latest_helm_chart_version
from airflow_breeze.utils.versions import is_pre_release
from airflow_breeze.utils.virtualenv_utils import create_pip_command, create_venv

Expand Down Expand Up @@ -2290,13 +2291,11 @@ def print_issue_content(
@click.option(
"--previous-release",
type=str,
required=True,
help="commit reference (for example hash or tag) of the previous release.",
)
@click.option(
"--current-release",
type=str,
required=True,
help="commit reference (for example hash or tag) of the current release.",
)
@click.option("--excluded-pr-list", type=str, help="Coma-separated list of PRs to exclude from the issue.")
Expand All @@ -2306,13 +2305,19 @@ def print_issue_content(
default=None,
help="Limit PR count processes (useful for testing small subset of PRs).",
)
@click.option(
"--latest",
is_flag=True,
help="Run the command against latest released version of airflow helm charts",
)
@option_verbose
def generate_issue_content_helm_chart(
github_token: str,
previous_release: str,
current_release: str,
excluded_pr_list: str,
limit_pr_count: int | None,
latest: bool,
):
generate_issue_content(
github_token,
Expand All @@ -2321,7 +2326,7 @@ def generate_issue_content_helm_chart(
excluded_pr_list,
limit_pr_count,
is_helm_chart=True,
latest=False,
latest=latest,
)


Expand Down Expand Up @@ -3264,18 +3269,25 @@ def generate_issue_content(
current = current_release

if latest:
import requests

response = requests.get("https://pypi.org/pypi/apache-airflow/json")
response.raise_for_status()
latest_released_version = response.json()["info"]["version"]
previous = str(latest_released_version)
current = os.getenv("VERSION", "HEAD")
if current == "HEAD":
get_console().print(
"\n[warning]Environment variable VERSION not set, setting current release "
"version as 'HEAD'\n"
)
if is_helm_chart:
latest_helm_version = get_latest_helm_chart_version()
get_console().print(f"\n[info] Latest stable version of helm chart is {latest_helm_version}\n")
previous = f"helm-chart/{latest_helm_version}"
current = os.getenv("VERSION", "HEAD")
if current == "HEAD":
get_console().print(
"\n[warning]Environment variable VERSION not set, setting current release "
"version as 'HEAD' for helm chart release\n"
)
else:
latest_airflow_version = get_latest_airflow_version()
previous = str(latest_airflow_version)
current = os.getenv("VERSION", "HEAD")
if current == "HEAD":
get_console().print(
"\n[warning]Environment variable VERSION not set, setting current release "
"version as 'HEAD'\n"
)

changes = get_changes(verbose, previous, current, is_helm_chart)
change_prs = [change.pr for change in changes]
Expand Down Expand Up @@ -3342,4 +3354,4 @@ def generate_issue_content(
users[pr_number].add(linked_issue.user.login)
progress.advance(task)

print_issue_content(current_release, pull_requests, linked_issues, users, is_helm_chart)
print_issue_content(current, pull_requests, linked_issues, users, is_helm_chart)
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"--current-release",
"--excluded-pr-list",
"--limit-pr-count",
"--latest",
],
}
],
Expand Down
37 changes: 37 additions & 0 deletions dev/breeze/src/airflow_breeze/utils/version_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import annotations


def get_latest_helm_chart_version():
import requests

response = requests.get("https://airflow.apache.org/_gen/packages-metadata.json")
data = response.json()
for package in data:
if package["package-name"] == "helm-chart":
stable_version = package["stable-version"]
return stable_version


def get_latest_airflow_version():
import requests

response = requests.get("https://pypi.org/pypi/apache-airflow/json")
response.raise_for_status()
latest_released_version = response.json()["info"]["version"]
return latest_released_version