Skip to content

Commit b8c82d7

Browse files
github-actions[bot]potiuk
authored andcommitted
[v3-1-test] Fix release process for Python Client (#58447) (#58471)
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. (cherry picked from commit dda9d61) Co-authored-by: Jarek Potiuk <[email protected]>
1 parent ab91441 commit b8c82d7

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
@@ -120,6 +120,8 @@ git log 2.8.0..HEAD --pretty=oneline -- airflow-core/src/airflow/api_fastapi/cor
120120
cd ${AIRFLOW_REPO_ROOT}
121121
rm dist/*
122122
breeze release-management prepare-python-client --distribution-format both --python-client-repo "${CLIENT_REPO_ROOT}" --version-suffix ""
123+
breeze release-management prepare-tarball --tarball-type apache_airflow_python_client --version "${VERSION}" --version-suffix "${VERSION_SUFFIX}"
124+
123125
```
124126

125127
- This should generate both sdist and .whl package in `dist` folder of the Airflow repository. It should
@@ -326,15 +328,34 @@ Airflow Python client supports reproducible builds, which means that the package
326328
sources should produce binary identical packages in reproducible way. You should check if the packages can be
327329
binary-reproduced when built from the sources.
328330

329-
Checkout airflow sources and build packages in dist folder (replace X.Y.Zrc1 with the version + rc candidate)
330-
you are checking):
331+
1) Set versions of the packages to be checked:
332+
333+
```shell script
334+
cd <directory where airflow is checked out>
335+
VERSION=X.Y.Z
336+
VERSION_SUFFIX=rc1
337+
VERSION_RC=${VERSION}${VERSION_SUFFIX}
338+
```
339+
340+
2) Change directory where your airflow sources are checked out
341+
342+
```shell
343+
cd "${AIRFLOW_REPO_ROOT}"
344+
```
345+
346+
3) Check out the ``python-client`` tag (assume apache is the remote name of the repository):
347+
348+
```shell
349+
git fetch apache --tags
350+
git checkout providers/${VERSION_RC}
351+
```
352+
353+
4) Build the distribution and source tarball:
331354

332355
```shell script
333-
VERSION=X.Y.Zrc1
334-
git checkout python-client/${VERSION}
335-
export AIRFLOW_REPO_ROOT=$(pwd)
336356
rm -rf dist/*
337357
breeze release-management prepare-python-client --distribution-format both --version-suffix ""
358+
breeze release-management prepare-tarball --tarball-type apache_airflow_python_client --version "${VERSION}" --version-suffix "${VERSION_SUFFIX}"
338359
```
339360

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

344365
```bash
345366
breeze release-management prepare-python-client --distribution-format both --use-local-hatch --version-suffix ""
367+
breeze release-management prepare-tarball --tarball-type apache_airflow_python_client --version "${VERSION}" --version-suffix "${VERSION_SUFFIX}"
346368
```
347369

348370
This is generally faster and requires less resources/network bandwidth.
349371

350-
Both commands should produce reproducible `.whl`, `.tar.gz` packages in dist folder.
372+
Both commands should produce reproducible `.whl`, `.tar.gz` packages in dist folder and "-source.tar.gz"
373+
file containing airflow sources in dist folder.
351374

352-
Change to the directory where you have the packages from svn:
375+
4) Change to the directory where you have the packages from svn and check if they are identical to the ones
376+
you just built:
353377

354378
```shell script
355379
# First clone the repo if you do not have it
@@ -358,7 +382,7 @@ cd ..
358382
svn update --set-depth=infinity asf-dist/dev/airflow/clients/python
359383

360384
# Then compare the packages
361-
cd asf-dist/dev/airflow/clients/python/${VERSION}
385+
cd asf-dist/dev/airflow/clients/python/${VERSION_RC}
362386
for i in ${AIRFLOW_REPO_ROOT}/dist/*
363387
do
364388
echo "Checking if $(basename $i) is the same as $i"
@@ -373,6 +397,63 @@ In case the files are different, you should see:
373397
Binary files apache_airflow-client-2.9.0.tar.gz and .../apache_airflow-2.9.0.tar.gz differ
374398
```
375399

400+
### Licence check
401+
402+
This can be done with the Apache RAT tool.
403+
404+
Download the latest jar from https://creadur.apache.org/rat/download_rat.cgi (unpack the binary, the jar is inside)
405+
406+
You can run this command to do it for you:
407+
408+
```shell script
409+
wget -qO- https://dlcdn.apache.org//creadur/apache-rat-0.17/apache-rat-0.17-bin.tar.gz | gunzip | tar -C /tmp -xvf -
410+
```
411+
412+
Unpack the release source archive (the `<package + version>-source.tar.gz` file) to a folder
413+
414+
```shell script
415+
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
416+
```
417+
418+
Run the check:
419+
420+
```shell script
421+
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: "
422+
```
423+
424+
You should see no files reported as Unknown or with wrong licence and summary of the check similar to:
425+
426+
```
427+
INFO: Apache Creadur RAT 0.17 (Apache Software Foundation)
428+
INFO: Excluding patterns: .git-blame-ignore-revs, .github/*, .git ...
429+
INFO: Excluding MISC collection.
430+
INFO: Excluding HIDDEN_DIR collection.
431+
SLF4J(W): No SLF4J providers were found.
432+
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
433+
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
434+
INFO: RAT summary:
435+
INFO: Approved: 15615
436+
INFO: Archives: 2
437+
INFO: Binaries: 813
438+
INFO: Document types: 5
439+
INFO: Ignored: 2392
440+
INFO: License categories: 2
441+
INFO: License names: 2
442+
INFO: Notices: 216
443+
INFO: Standards: 15609
444+
INFO: Unapproved: 0
445+
INFO: Unknown: 0
446+
```
447+
448+
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 `!`.
449+
450+
For example:
451+
452+
```
453+
! Unapproved: 1 A count of unapproved licenses.
454+
! /CODE_OF_CONDUCT.md
455+
```
456+
376457
## Signature check
377458

378459
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
@@ -239,6 +239,7 @@ class TarBallType(Enum):
239239
PROVIDERS = "apache_airflow_providers"
240240
TASK_SDK = "apache_airflow_task_sdk"
241241
AIRFLOW_CTL = "apache_airflow_ctl"
242+
PYTHON_CLIENT = "apache_airflow_python_client"
242243
HELM_CHART = "helm-chart"
243244

244245

0 commit comments

Comments
 (0)