Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[airflow] Fix Broken Build & Harness #12431

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions projects/airflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

FROM gcr.io/oss-fuzz-base/base-builder-python

RUN apt-get install sqlite3
RUN pip3 install --upgrade pip

RUN git clone https://github.com/apache/airflow
RUN apt-get update && apt-get install -y sqlite3
RUN pip3 install --upgrade pip \
&& pip3 install 'pyinstaller==6.10'
RUN git clone --depth 1 https://github.com/apache/airflow
ENV AIRFLOW_HOME=$SRC/airflow/
WORKDIR airflow
WORKDIR $SRC/airflow

COPY build.sh dag_fuzz.py $SRC/
15 changes: 8 additions & 7 deletions projects/airflow/dag_fuzz.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import atheris
import colorlog
import pendulum
from datetime import datetime, timedelta
with atheris.instrument_imports():
import airflow
from airflow import DAG
from airflow.exceptions import AirflowException
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from airflow.operators.empty import EmptyOperator
from airflow.operators.python import PythonOperator

def py_func():
return
Expand All @@ -32,7 +33,7 @@ def TestInput(input_bytes):
default_args = {
'owner': fdp.ConsumeString(8),
'depends_on_past': fdp.ConsumeBool(),
'start_date': airflow.utils.dates.days_ago(fdp.ConsumeIntInRange(1,5)),
'start_date': pendulum.today('UTC').add(days=-fdp.ConsumeIntInRange(1,5)),
'email': [fdp.ConsumeString(8)],
'email_on_failure': fdp.ConsumeBool(),
'email_on_retry': fdp.ConsumeBool(),
Expand All @@ -41,16 +42,16 @@ def TestInput(input_bytes):
}

try:
with DAG(fdp.ConsumeString(8), schedule_interval='@daily', default_args=default_args) as dag:
dummy_task = DummyOperator(task_id=fdp.ConsumeString(8), retries=fdp.ConsumeIntInRange(1,5))
with DAG(fdp.ConsumeString(8), schedule='@daily', default_args=default_args) as dag:
dummy_task = EmptyOperator(task_id=fdp.ConsumeString(8), retries=fdp.ConsumeIntInRange(1,5))
python_task = PythonOperator(task_id=fdp.ConsumeString(8), python_callable=py_func)

dummy_task >> python_task
except AirflowException:
pass

def main():
atheris.Setup(sys.argv, TestInput, enable_python_coverage=True)
atheris.Setup(sys.argv, TestInput)
atheris.Fuzz()

if __name__ == "__main__":
Expand Down
Loading