Skip to content

Conversation

@nailo2c
Copy link
Contributor

@nailo2c nailo2c commented Dec 12, 2025

Closes #56545

Why

When using an image without root permissions, the task fails with the following error:

mkdir: cannot create directory ‘/airflow’: Permission denied\n"

How

Skip mkdir when do_xcom_push is set to False.

What

The test DAG ran successfully on my local machine with a local k8s cluster.

Test DAG:

from airflow.decorators import dag, task
from datetime import datetime

@dag(start_date=datetime(2024, 1, 1), schedule=None)
def test_dag():
    @task.kubernetes(image="apache/airflow:3.1.0")
    def example_task():
        print("Hello from Airflow task")

    example_task()

test_dag()
image

@potiuk
Copy link
Member

potiuk commented Dec 13, 2025

Nice!

@potiuk potiuk merged commit 3b6a24b into apache:main Dec 13, 2025
101 checks passed
TempestShaw pushed a commit to TempestShaw/airflow that referenced this pull request Dec 24, 2025
…) (apache#59347)

* Fix XCom directory creation logic in Kubernetes decorator and add tests for do_xcom_push behavior (apache#56545)

* fix CI test error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:cncf-kubernetes Kubernetes (k8s) provider related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@task.kubernetes fails on non-root images due to /airflow/xcom directory creation

2 participants