Skip to content

Commit e274b7d

Browse files
committed
airflow: fix build to solve targets broken
This reverts commit 20ec867.
1 parent 20ec867 commit e274b7d

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

projects/airflow/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ RUN apt-get update && apt-get install -y sqlite3
2020
RUN pip3 install --upgrade pip
2121

2222
RUN git clone --depth 1 https://github.com/apache/airflow $SRC/airflow
23+
2324
WORKDIR airflow
2425

2526
COPY build.sh dag_fuzz.py $SRC/

projects/airflow/build.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ cd $SRC/airflow
2020
pip3 install --upgrade pip
2121
pip3 install colorlog
2222
pip3 install ./task-sdk ./airflow-core .
23+
2324
# Build fuzzers in $OUT.
2425
cd $SRC
25-
compile_python_fuzzer dag_fuzz.py
26+
CONFIG_TEMPLATES_PATH=$(python3 -c "import os, airflow; print(os.path.join(os.path.dirname(airflow.__file__), 'config_templates'))")
27+
compile_python_fuzzer dag_fuzz.py --add-data "$CONFIG_TEMPLATES_PATH:airflow/config_templates" --hidden-import="airflow.utils.log.timezone_aware" --hidden-import="aiosqlite"

projects/airflow/dag_fuzz.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,26 @@
1313
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
16+
import sys
1617
import atheris
1718
import colorlog
1819
from datetime import datetime, timedelta
19-
with atheris.instrument_imports():
20+
21+
with atheris.instrument_imports(include=['airflow'], enable_loader_override=False):
2022
import airflow
2123
from airflow import DAG
2224
from airflow.exceptions import AirflowException
23-
from airflow.operators.dummy_operator import DummyOperator
24-
from airflow.operators.python_operator import PythonOperator
25+
26+
try:
27+
from airflow.providers.standard.operators.empty import EmptyOperator as DummyOperator
28+
from airflow.providers.standard.operators.python import PythonOperator
29+
except ImportError:
30+
try:
31+
from airflow.operators.empty import EmptyOperator as DummyOperator
32+
from airflow.operators.python import PythonOperator
33+
except ImportError:
34+
from airflow.operators.dummy_operator import DummyOperator
35+
from airflow.operators.python_operator import PythonOperator
2536

2637
def py_func():
2738
return
@@ -32,7 +43,7 @@ def TestInput(input_bytes):
3243
default_args = {
3344
'owner': fdp.ConsumeString(8),
3445
'depends_on_past': fdp.ConsumeBool(),
35-
'start_date': airflow.utils.dates.days_ago(fdp.ConsumeIntInRange(1,5)),
46+
'start_date': datetime.now() - timedelta(days=fdp.ConsumeIntInRange(1,5)),
3647
'email': [fdp.ConsumeString(8)],
3748
'email_on_failure': fdp.ConsumeBool(),
3849
'email_on_retry': fdp.ConsumeBool(),
@@ -46,7 +57,7 @@ def TestInput(input_bytes):
4657
python_task = PythonOperator(task_id=fdp.ConsumeString(8), python_callable=py_func)
4758

4859
dummy_task >> python_task
49-
except AirflowException:
60+
except (AirflowException, ValueError, TypeError):
5061
pass
5162

5263
def main():

0 commit comments

Comments
 (0)