Skip to content

Commit 1a2eedb

Browse files
committed
Publish docs to s3 uses current version of workflows/scripts
In case we built docs for past version of airflow we checkout both - current (main) version of code to use latest environment and tag version of code to build the documentation. The workflow mixed sub-workflows and run them from the "tag" version of workflow rather than from current. We are moving SBOM building to the publishing job, and we are also pre-processing the generated docs to include the right stable versions - including Airflow 2 compatibility
1 parent 0131897 commit 1a2eedb

File tree

2 files changed

+300
-61
lines changed

2 files changed

+300
-61
lines changed

.github/workflows/publish-docs-to-s3.yml

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,15 @@ jobs:
182182
with:
183183
persist-credentials: false
184184
path: current-version
185+
- name: "Free up disk space"
186+
shell: bash
187+
run: ./current-version/scripts/tools/free_up_disk_space.sh
188+
- name: "Make /mnt writeable"
189+
run: ./current-version/scripts/ci/make_mnt_writeable.sh
190+
- name: "Move docker to /mnt"
191+
run: ./current-version/scripts/ci/move_docker_to_mnt.sh
192+
- name: "Copy the version retrieval script"
193+
run: cp ./current-versionscripts/ci/docs/store_stable_versions.py /tmp/store_stable_versions.py
185194
# We are checking repo for both - breeze and docs from the ref provided as input
186195
# This will take longer as we need to rebuild CI image and it will not use cache
187196
# but it will build the CI image from the version of Airflow that is used to check out things
@@ -190,15 +199,7 @@ jobs:
190199
with:
191200
persist-credentials: false
192201
ref: ${{ inputs.ref }}
193-
fetch-depth: 0
194202
fetch-tags: true
195-
- name: "Free up disk space"
196-
shell: bash
197-
run: ./scripts/tools/free_up_disk_space.sh
198-
- name: "Make /mnt writeable"
199-
run: ./scripts/ci/make_mnt_writeable.sh
200-
- name: "Move docker to /mnt"
201-
run: ./scripts/ci/move_docker_to_mnt.sh
202203
- name: "Apply patch commits if provided"
203204
run: |
204205
if [[ "${APPLY_COMMITS}" != "" ]]; then
@@ -242,63 +243,24 @@ jobs:
242243
INCLUDE_COMMITS: ${{ startsWith(inputs.ref, 'providers') && 'true' || 'false' }}
243244
run: >
244245
breeze build-docs ${INCLUDE_DOCS} --docs-only
245-
- name: "Checkout current version to run SBOM generation"
246-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
247-
with:
248-
persist-credentials: false
249-
fetch-depth: 0
250-
fetch-tags: true
251-
path: current-version
252-
if: inputs.build-sboms
253-
- name: "Reinstall breeze from the current version"
254-
run: |
255-
breeze setup self-upgrade --use-current-airflow-sources
256-
if: inputs.build-sboms
257-
working-directory: current-version
258-
- name: "Make sure SBOM dir exists and has the right permissions"
259-
run: |
260-
sudo mkdir -vp ./files/sbom
261-
sudo chown -R "${USER}" .
262-
working-directory: current-version
263-
if: inputs.build-sboms
264-
- name: "Prepare SBOMs using current version of Breeze"
265-
env:
266-
AIRFLOW_VERSION: ${{ needs.build-info.outputs.airflow-version }}
267-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
268-
PYTHON_VERSION: "${{ needs.build-info.outputs.default-python-version }}"
269-
FORCE: "true"
270-
run: >
271-
breeze sbom update-sbom-information
272-
--airflow-version ${AIRFLOW_VERSION} --remote-name origin --force
273-
--all-combinations --run-in-parallel --airflow-root-path "${GITHUB_WORKSPACE}"
274-
working-directory: current-version
275-
if: inputs.build-sboms
276-
- name: "Generated SBOM files"
277-
run: |
278-
echo "Generated SBOM files:"
279-
find ./generated/_build/docs/apache-airflow/stable/sbom/ -type f | sort
280-
if: inputs.build-sboms
281-
- name: "Reinstall breeze from ${{ inputs.ref }} reference"
282-
run:
283-
breeze setup self-upgrade --use-current-airflow-sources
284-
if: inputs.build-sboms
285-
- name: Check disk space available
286-
run: df -H
287-
# Here we will create temp airflow-site dir to publish docs
288-
- name: Create /mnt/airflow-site directory
246+
- name: "Store stable versions"
247+
run: uv run /tmp/store_stable_versions.py
248+
- name: "Saving build docs folder"
289249
run: |
290-
sudo mkdir -p /mnt/airflow-site && sudo chown -R "${USER}" /mnt/airflow-site
291-
echo "AIRFLOW_SITE_DIRECTORY=/mnt/airflow-site/" >> "$GITHUB_ENV"
292-
- name: "Publish docs to /mnt/airflow-site directory using ${{ inputs.ref }} reference breeze"
293-
env:
294-
INCLUDE_DOCS: ${{ needs.build-info.outputs.include-docs }}
295-
run: >
296-
breeze release-management publish-docs --override-versioned --run-in-parallel ${INCLUDE_DOCS}
250+
if [ -d "generated/_build/" ]; then
251+
mv "generated/_build/" "/mnt/_build"
252+
elif [ -d "docs/_build/" ]; then
253+
# handle Airflow 2 case
254+
mv "docs/_build/" "/mnt/_build"
255+
else
256+
echo "No build docs found to save"
257+
exit 1
258+
fi
297259
- name: "Upload build docs"
298260
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
299261
with:
300262
name: airflow-docs
301-
path: /mnt/airflow-site
263+
path: /mnt/_build
302264
retention-days: '7'
303265
if-no-files-found: 'error'
304266
overwrite: 'true'
@@ -324,10 +286,12 @@ jobs:
324286
# We are checking repo for both - breeze and docs from the "workflow' branch
325287
# This will take longer as we need to rebuild CI image and it will not use cache
326288
# but it will build the CI image from the version of Airflow that is used to check out things
289+
# We also fetch the whole history to be able to prepare SBOM files
327290
- name: "Checkout ${{ inputs.ref }} "
328291
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
329292
with:
330293
persist-credentials: false
294+
fetch-depth: 0
331295
- name: "Make /mnt writeable and cleanup"
332296
shell: bash
333297
run: ./scripts/ci/make_mnt_writeable.sh
@@ -337,7 +301,42 @@ jobs:
337301
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
338302
with:
339303
name: airflow-docs
340-
path: /mnt/airflow-site
304+
path: /mnt/_build
305+
- name: "Move doscs to generated folder"
306+
run: mv /mnt/_build generated/_build
307+
- name: "Make sure SBOM dir exists and has the right permissions"
308+
run: |
309+
sudo mkdir -vp ./files/sbom
310+
sudo chown -R "${USER}" .
311+
if: inputs.build-sboms
312+
- name: "Prepare SBOMs"
313+
env:
314+
AIRFLOW_VERSION: ${{ needs.build-info.outputs.airflow-version }}
315+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
316+
PYTHON_VERSION: "${{ needs.build-info.outputs.default-python-version }}"
317+
FORCE: "true"
318+
run: >
319+
breeze sbom update-sbom-information
320+
--airflow-version ${AIRFLOW_VERSION} --remote-name origin --force
321+
--all-combinations --run-in-parallel --airflow-root-path "${GITHUB_WORKSPACE}"
322+
if: inputs.build-sboms
323+
- name: "Generated SBOM files"
324+
run: |
325+
echo "Generated SBOM files:"
326+
find ./generated/_build/docs/apache-airflow/stable/sbom/ -type f | sort
327+
if: inputs.build-sboms
328+
- name: Check disk space available
329+
run: df -H
330+
# Here we will create temp airflow-site dir to publish docs
331+
- name: Create /mnt/airflow-site directory
332+
run: |
333+
sudo mkdir -p /mnt/airflow-site && sudo chown -R "${USER}" /mnt/airflow-site
334+
echo "AIRFLOW_SITE_DIRECTORY=/mnt/airflow-site/" >> "$GITHUB_ENV"
335+
- name: "Publish docs to /mnt/airflow-site directory using ${{ inputs.ref }} reference breeze"
336+
env:
337+
INCLUDE_DOCS: ${{ needs.build-info.outputs.include-docs }}
338+
run: >
339+
breeze release-management publish-docs --override-versioned --run-in-parallel ${INCLUDE_DOCS}
341340
- name: Check disk space available
342341
run: df -H
343342
- name: "Update watermarks"

0 commit comments

Comments
 (0)