This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 6c4d88411ad Add SBOM generation to publish-docs workflows (#52759)
6c4d88411ad is described below
commit 6c4d88411ad9f96f8213256a5126d7e185749366
Author: GPK <[email protected]>
AuthorDate: Thu Jul 3 17:18:54 2025 +0100
Add SBOM generation to publish-docs workflows (#52759)
* Add sboms generation into publish-docs workflow
* Add sboms generation into publish-docs workflow
---
.github/workflows/publish-docs-to-s3.yml | 22 ++++++++++++++++++++++
.../src/airflow_breeze/commands/sbom_commands.py | 1 +
.../airflow_breeze/commands/workflow_commands.py | 1 +
dev/breeze/src/airflow_breeze/utils/cdxgen.py | 12 +++++++++---
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/publish-docs-to-s3.yml
b/.github/workflows/publish-docs-to-s3.yml
index c8d963724ff..f4f3754e148 100644
--- a/.github/workflows/publish-docs-to-s3.yml
+++ b/.github/workflows/publish-docs-to-s3.yml
@@ -47,6 +47,11 @@ on: # yamllint disable-line rule:truthy
required: false
default: false
type: boolean
+ build-sboms:
+ description: "Build SBOMs"
+ required: false
+ default: 'false'
+ type: string
permissions:
contents: read
@@ -63,11 +68,13 @@ jobs:
EXCLUDE_DOCS: ${{ inputs.exclude-docs }}
DESTINATION: ${{ inputs.destination }}
SKIP_WRITE_TO_STABLE_FOLDER: ${{ inputs.skip-write-to-stable-folder }}
+ BUILD_SBOMS: ${{ inputs.build-sboms }}
outputs:
include-docs: ${{ inputs.include-docs == 'all' && '' ||
inputs.include-docs }}
destination-location: ${{ steps.parameters.outputs.destination-location
}}
destination: ${{ steps.parameters.outputs.destination }}
extra-build-options: ${{ steps.parameters.outputs.extra-build-options }}
+ airflow-version: ${{ steps.parameters.outputs.airflow-version }}
# yamllint disable rule:line-length
skip-write-to-stable-folder: ${{ inputs.skip-write-to-stable-folder &&
'--skip-write-to-stable-folder' || '' }}
if: contains(fromJSON('[
@@ -92,6 +99,7 @@ jobs:
echo "Exclude docs: '${EXCLUDE_DOCS}'"
echo "Destination: '${DESTINATION}'"
echo "Skip write to stable folder: '${SKIP_WRITE_TO_STABLE_FOLDER}'"
+ echo "Build SBOMs: '${BUILD_SBOMS}'"
if [[ "${DESTINATION}" == "auto" ]]; then
if [[ "${REF}" =~ ^.*[0-9]*\.[0-9]*\.[0-9]*$ ]]; then
echo "${REF} looks like final release, using live destination"
@@ -107,6 +115,12 @@ jobs:
else
echo
"destination-location=s3://staging-docs-airflow-apache-org/docs/" >>
${GITHUB_OUTPUT}
fi
+ if [[ " ${INCLUDE_DOCS} " =~ " apache-airflow " ]]; then
+ AIRFLOW_VERSION=$(echo "${REF}" | grep -oE
'[0-9]+\.[0-9]+\.[0-9]+')
+ echo "airflow-version=${AIRFLOW_VERSION}" >> ${GITHUB_OUTPUT}
+ else
+ echo "airflow-version=no-airflow" >> ${GITHUB_OUTPUT}
+ fi
build-docs:
needs: [build-info]
@@ -154,6 +168,14 @@ jobs:
INCLUDE_COMMITS: ${{ startsWith(inputs.ref, 'providers') && 'true'
|| 'false' }}
run: >
breeze build-docs ${INCLUDE_DOCS} --docs-only
+ - name: "Build SBOMS"
+ env:
+ AIRFLOW_VERSION: ${{ needs.build-info.outputs.airflow-version }}
+ run: >
+ breeze sbom update-sbom-information --airflow-version
${AIRFLOW_VERSION} \
+ --force --all-combinations --run-in-parallel --airflow-root-path
"${GITHUB_WORKSPACE}"
+ if: inputs.build-sboms == 'true'
+
- name: Check disk space available
run: df -H
# Here we will create temp airflow-site dir to publish docs
diff --git a/dev/breeze/src/airflow_breeze/commands/sbom_commands.py
b/dev/breeze/src/airflow_breeze/commands/sbom_commands.py
index 8eb29258792..cfcd0a66925 100644
--- a/dev/breeze/src/airflow_breeze/commands/sbom_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/sbom_commands.py
@@ -483,6 +483,7 @@ def core_jobs(
f"[warning]The {destination_dir} already exists and
generation is not forced. "
f"Skipping for airflow version {airflow_v}"
)
+ destination_dir.mkdir(parents=True, exist_ok=True)
if not destination_dirs:
get_console().print(
f"[warning]All directories already exist and generation is not
forced. Skipping {airflow_v}"
diff --git a/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
b/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
index 0fb8c4fc5d9..8488ac6ad2c 100644
--- a/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
+++ b/dev/breeze/src/airflow_breeze/commands/workflow_commands.py
@@ -122,6 +122,7 @@ def workflow_run_publish(
"include-docs": " ".join(doc_packages),
"exclude-docs": exclude_docs,
"skip-write-to-stable-folder": skip_write_to_stable_folder,
+ "build-sboms": "true" if "apache-airflow" in doc_packages else "false",
}
trigger_workflow_and_monitor(
diff --git a/dev/breeze/src/airflow_breeze/utils/cdxgen.py
b/dev/breeze/src/airflow_breeze/utils/cdxgen.py
index cd92a0f4721..ae746c6a650 100644
--- a/dev/breeze/src/airflow_breeze/utils/cdxgen.py
+++ b/dev/breeze/src/airflow_breeze/utils/cdxgen.py
@@ -371,15 +371,21 @@ class SbomCoreJob(SbomApplicationJob):
def download_dependency_files(self, output: Output | None, github_token:
str | None) -> bool:
source_dir = self.get_files_directory(self.application_root_path)
source_dir.mkdir(parents=True, exist_ok=True)
- lock_file_relative_path = "airflow/www/yarn.lock"
+ version_number = int(self.airflow_version.split(".")[0])
+ lock_file_relative_path = (
+ "airflow-core/src/airflow/ui/package.json" if version_number >= 3
else "airflow/www/yarn.lock"
+ )
+ source_dir_with_file = (
+ (source_dir / "package.json") if version_number >= 3 else
(source_dir / "yarn.lock")
+ )
if self.include_npm:
download_file_from_github(
reference=self.airflow_version,
path=lock_file_relative_path,
- output_file=source_dir / "yarn.lock",
+ output_file=source_dir_with_file,
)
else:
- (source_dir / "yarn.lock").unlink(missing_ok=True)
+ source_dir_with_file.unlink(missing_ok=True)
if self.include_python:
if not download_constraints_file(
constraints_reference=f"constraints-{self.airflow_version}",