Skip to content

Commit dda9d61

Browse files
authored
Fix release process for Python Client (#58447)
The Python Client of ours was released so far without sources, because it was assumed it uses the same sources as Airflow - but it's not necessarily the same and it can be released with a different cadence and using different sources - for example to fix some client-only issues. This PR updates the release process to also include source tarball snapshot as part of the release and updates breeze and release process description to make sure sources are produced and verified.
1 parent 42805e1 commit dda9d61

File tree

5 files changed

+98
-11
lines changed

5 files changed

+98
-11
lines changed

dev/README_RELEASE_PYTHON_CLIENT.md

Lines changed: 89 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ git log 2.8.0..HEAD --pretty=oneline -- airflow-core/src/airflow/api_fastapi/cor
133133
cd ${AIRFLOW_REPO_ROOT}
134134
rm dist/*
135135
breeze release-management prepare-python-client --distribution-format both --python-client-repo "${CLIENT_REPO_ROOT}" --version-suffix ""
136+
breeze release-management prepare-tarball --tarball-type apache_airflow_python_client --version "${VERSION}" --version-suffix "${VERSION_SUFFIX}"
137+
136138
```
137139

138140
- This should generate both sdist and .whl package in `dist` folder of the Airflow repository. It should
@@ -339,15 +341,34 @@ Airflow Python client supports reproducible builds, which means that the package
339341
sources should produce binary identical packages in reproducible way. You should check if the packages can be
340342
binary-reproduced when built from the sources.
341343

342-
Checkout airflow sources and build packages in dist folder (replace X.Y.Zrc1 with the version + rc candidate)
343-
you are checking):
344+
1) Set versions of the packages to be checked:
345+
346+
```shell script
347+
cd <directory where airflow is checked out>
348+
VERSION=X.Y.Z
349+
VERSION_SUFFIX=rc1
350+
VERSION_RC=${VERSION}${VERSION_SUFFIX}
351+
```
352+
353+
2) Change directory where your airflow sources are checked out
354+
355+
```shell
356+
cd "${AIRFLOW_REPO_ROOT}"
357+
```
358+
359+
3) Check out the ``python-client`` tag (assume apache is the remote name of the repository):
360+
361+
```shell
362+
git fetch apache --tags
363+
git checkout providers/${VERSION_RC}
364+
```
365+
366+
4) Build the distribution and source tarball:
344367

345368
```shell script
346-
VERSION=X.Y.Zrc1
347-
git checkout python-client/${VERSION}
348-
export AIRFLOW_REPO_ROOT=$(pwd)
349369
rm -rf dist/*
350370
breeze release-management prepare-python-client --distribution-format both --version-suffix ""
371+
breeze release-management prepare-tarball --tarball-type apache_airflow_python_client --version "${VERSION}" --version-suffix "${VERSION_SUFFIX}"
351372
```
352373

353374
The last - build step - by default will use Dockerized build and building of Python client packages
@@ -356,13 +377,16 @@ will be done in a docker container. However, if you have `hatch` installed loc
356377

357378
```bash
358379
breeze release-management prepare-python-client --distribution-format both --use-local-hatch --version-suffix ""
380+
breeze release-management prepare-tarball --tarball-type apache_airflow_python_client --version "${VERSION}" --version-suffix "${VERSION_SUFFIX}"
359381
```
360382

361383
This is generally faster and requires less resources/network bandwidth.
362384

363-
Both commands should produce reproducible `.whl`, `.tar.gz` packages in dist folder.
385+
Both commands should produce reproducible `.whl`, `.tar.gz` packages in dist folder and "-source.tar.gz"
386+
file containing airflow sources in dist folder.
364387

365-
Change to the directory where you have the packages from svn:
388+
4) Change to the directory where you have the packages from svn and check if they are identical to the ones
389+
you just built:
366390

367391
```shell script
368392
# First clone the repo if you do not have it
@@ -371,7 +395,7 @@ cd ..
371395
svn update --set-depth=infinity asf-dist/dev/airflow/clients/python
372396

373397
# Then compare the packages
374-
cd asf-dist/dev/airflow/clients/python/${VERSION}
398+
cd asf-dist/dev/airflow/clients/python/${VERSION_RC}
375399
for i in ${AIRFLOW_REPO_ROOT}/dist/*
376400
do
377401
echo "Checking if $(basename $i) is the same as $i"
@@ -386,6 +410,63 @@ In case the files are different, you should see:
386410
Binary files apache_airflow-client-2.9.0.tar.gz and .../apache_airflow-2.9.0.tar.gz differ
387411
```
388412

413+
### Licence check
414+
415+
This can be done with the Apache RAT tool.
416+
417+
Download the latest jar from https://creadur.apache.org/rat/download_rat.cgi (unpack the binary, the jar is inside)
418+
419+
You can run this command to do it for you:
420+
421+
```shell script
422+
wget -qO- https://dlcdn.apache.org//creadur/apache-rat-0.17/apache-rat-0.17-bin.tar.gz | gunzip | tar -C /tmp -xvf -
423+
```
424+
425+
Unpack the release source archive (the `<package + version>-source.tar.gz` file) to a folder
426+
427+
```shell script
428+
rm -rf /tmp/apache/airflow-python-client-src && mkdir -p /tmp/apache-airflow-python-client-src && tar -xzf ${PATH_TO_SVN}/providers/${RELEASE_DATE}/apache_airflow_python_client-*-source.tar.gz --strip-components 1 -C /tmp/apache-airflow-python-client-src
429+
```
430+
431+
Run the check:
432+
433+
```shell script
434+
java -jar /tmp/apache-rat-0.17/apache-rat-0.17.jar --input-exclude-file /tmp/apache-airflow-python-client-src/.rat-excludes /tmp/apache-airflow-python-client-src/ | grep -E "! |INFO: "
435+
```
436+
437+
You should see no files reported as Unknown or with wrong licence and summary of the check similar to:
438+
439+
```
440+
INFO: Apache Creadur RAT 0.17 (Apache Software Foundation)
441+
INFO: Excluding patterns: .git-blame-ignore-revs, .github/*, .git ...
442+
INFO: Excluding MISC collection.
443+
INFO: Excluding HIDDEN_DIR collection.
444+
SLF4J(W): No SLF4J providers were found.
445+
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
446+
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
447+
INFO: RAT summary:
448+
INFO: Approved: 15615
449+
INFO: Archives: 2
450+
INFO: Binaries: 813
451+
INFO: Document types: 5
452+
INFO: Ignored: 2392
453+
INFO: License categories: 2
454+
INFO: License names: 2
455+
INFO: Notices: 216
456+
INFO: Standards: 15609
457+
INFO: Unapproved: 0
458+
INFO: Unknown: 0
459+
```
460+
461+
There should be no files reported as Unknown or Unapproved. The files that are unknown or unapproved should be shown with a line starting with `!`.
462+
463+
For example:
464+
465+
```
466+
! Unapproved: 1 A count of unapproved licenses.
467+
! /CODE_OF_CONDUCT.md
468+
```
469+
389470
## Signature check
390471

391472
Make sure you have imported into your GPG the PGP key of the person signing the release. You can find the valid keys in

dev/breeze/doc/images/output_release-management_prepare-tarball.svg

Lines changed: 2 additions & 2 deletions
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7cb732b47aeebbb6b430cda72776a7a8
1+
1e525a6dd6717f0ce733a5f679c83489

dev/breeze/src/airflow_breeze/commands/release_candidate_command.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ def create_tarball_release(
332332
if not version:
333333
version = date.strftime(date.today(), "%Y-%m-%d")
334334
console_print(f"\n[info]Using current date {version} as tarball version\n")
335+
elif tarball_type == TarBallType.PYTHON_CLIENT:
336+
tag = f"python-client/{version + version_suffix}" if version else "HEAD"
337+
if not version:
338+
version = date.strftime(date.today(), "%Y-%m-%d")
339+
console_print(f"\n[info]Using current date {version} as tarball version\n")
335340
else: # pragma: no cover
336341
console_print(f"[error]Unsupported tarball type: {tarball_type}")
337342
exit(1)

dev/breeze/src/airflow_breeze/global_constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ class TarBallType(Enum):
243243
PROVIDERS = "apache_airflow_providers"
244244
TASK_SDK = "apache_airflow_task_sdk"
245245
AIRFLOW_CTL = "apache_airflow_ctl"
246+
PYTHON_CLIENT = "apache_airflow_python_client"
246247
HELM_CHART = "helm-chart"
247248

248249

0 commit comments

Comments
 (0)