From ea3e6fd847fbfef9d60c4dfda15ecad6168e802f Mon Sep 17 00:00:00 2001
From: Mohammed Naser <mnaser@vexxhost.com>
Date: Wed, 16 Jun 2021 16:37:11 -0400
Subject: [PATCH 1/4] Added basic jobs to convert to Zuul

---
 .travis.yml                   | 29 --------------------------
 zuul.d/jobs.yaml              | 39 +++++++++++++++++++++++++++++++++++
 zuul.d/playbooks/.zuul.ignore |  0
 zuul.d/playbooks/pre.yaml     | 18 ++++++++++++++++
 zuul.d/playbooks/run.yaml     |  6 ++++++
 5 files changed, 63 insertions(+), 29 deletions(-)
 delete mode 100755 .travis.yml
 create mode 100644 zuul.d/jobs.yaml
 create mode 100644 zuul.d/playbooks/.zuul.ignore
 create mode 100644 zuul.d/playbooks/pre.yaml
 create mode 100644 zuul.d/playbooks/run.yaml

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100755
index 569ae27b6..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-language: c
-sudo: required
-services:
-    - docker
-addons:
-    apt:
-        sources:
-            - ubuntu-toolchain-r-test
-            - llvm-toolchain-precise-3.7
-        packages:
-            - lcov
-            - clang-3.7
-            - libev-dev
-            - libc-ares-dev
-            - libstdc++-4.8-dev
-            - libidn2-0-dev
-            - libssh2-1-dev
-            - krb5-user
-            - pkg-config
-
-matrix:
-    include:
-        - env: T=mainline
-        - env: T=codecoverage
-        - env: T=codeprofile
-        - env: T=travisoss
-
-script:
-    - ./${T}.sh
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
new file mode 100644
index 000000000..ac2d6743a
--- /dev/null
+++ b/zuul.d/jobs.yaml
@@ -0,0 +1,39 @@
+- job:
+    name: curl-fuzz-base
+    abstract: true
+    pre-run: zuul.d/playbooks/pre.yaml
+    run: zuul.d/playbooks/run.yaml
+    nodeset: ubuntu-focal
+
+- job:
+    name: curl-fuzz-mainline
+    parent: curl-fuzz-base
+    vars:
+      curl_test: mainline
+
+- job:
+    name: curl-fuzz-code-coverage
+    parent: curl-fuzz-base
+    vars:
+      curl_test: codecoverage
+
+- job:
+    name: curl-fuzz-code-profile
+    parent: curl-fuzz-base
+    vars:
+      curl_test: codeprofile
+
+- job:
+    name: curl-fuzz-oss
+    parent: curl-fuzz-base
+    vars:
+      curl_test: oss-fuzz
+      curl_script: travisoss
+
+- project:
+    check:
+      jobs:
+        - curl-fuzz-mainline
+        - curl-fuzz-code-coverage
+        - curl-fuzz-code-profile
+        - curl-fuzz-oss
\ No newline at end of file
diff --git a/zuul.d/playbooks/.zuul.ignore b/zuul.d/playbooks/.zuul.ignore
new file mode 100644
index 000000000..e69de29bb
diff --git a/zuul.d/playbooks/pre.yaml b/zuul.d/playbooks/pre.yaml
new file mode 100644
index 000000000..7a9e30051
--- /dev/null
+++ b/zuul.d/playbooks/pre.yaml
@@ -0,0 +1,18 @@
+- hosts: all
+  roles:
+    - role: ensure-docker
+      when: curl_test == 'oss-fuzz'
+  tasks:
+    - name: Install dependencies
+      become: true
+      apt:
+        name:
+          - lcov
+          - clang-3.7
+          - libev-dev
+          - libc-ares-dev
+          - libstdc++-4.8-dev
+          - libidn2-0-dev
+          - libssh2-1-dev
+          - krb5-user
+          - pkg-config
\ No newline at end of file
diff --git a/zuul.d/playbooks/run.yaml b/zuul.d/playbooks/run.yaml
new file mode 100644
index 000000000..5e458dbb6
--- /dev/null
+++ b/zuul.d/playbooks/run.yaml
@@ -0,0 +1,6 @@
+- hosts: all
+  tasks:
+    - name: Run job
+      shell: ./{{ curl_script | default(curl_test) }}.sh
+      environment:
+        TRAVIS_BRANCH: "{{ zuul.branch }}"
\ No newline at end of file

From d645dec96372cd6c23597e69407d018a96b85420 Mon Sep 17 00:00:00 2001
From: Mohammed Naser <mnaser@vexxhost.com>
Date: Wed, 16 Jun 2021 16:58:59 -0400
Subject: [PATCH 2/4] Install llvm instead of clang-3.7

It seems like the package no longer exists under that name
in Bionic so we'll have to do transition to this package
instead.
---
 zuul.d/playbooks/pre.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zuul.d/playbooks/pre.yaml b/zuul.d/playbooks/pre.yaml
index 7a9e30051..26287c720 100644
--- a/zuul.d/playbooks/pre.yaml
+++ b/zuul.d/playbooks/pre.yaml
@@ -8,7 +8,7 @@
       apt:
         name:
           - lcov
-          - clang-3.7
+          - llvm
           - libev-dev
           - libc-ares-dev
           - libstdc++-4.8-dev

From 00e30fe26ea75d927b5a710609f4fdc8eda29e5b Mon Sep 17 00:00:00 2001
From: Mohammed Naser <mnaser@vexxhost.com>
Date: Wed, 16 Jun 2021 17:34:37 -0400
Subject: [PATCH 3/4] Switch to libstdc++-7-dev meta-package

---
 zuul.d/playbooks/pre.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zuul.d/playbooks/pre.yaml b/zuul.d/playbooks/pre.yaml
index 26287c720..35f5d9dcf 100644
--- a/zuul.d/playbooks/pre.yaml
+++ b/zuul.d/playbooks/pre.yaml
@@ -11,7 +11,7 @@
           - llvm
           - libev-dev
           - libc-ares-dev
-          - libstdc++-4.8-dev
+          - libstdc++-7-dev
           - libidn2-0-dev
           - libssh2-1-dev
           - krb5-user

From 912fcd2406775caafc185fbad39695451de9eb39 Mon Sep 17 00:00:00 2001
From: Mohammed Naser <mnaser@vexxhost.com>
Date: Wed, 16 Jun 2021 19:44:36 -0400
Subject: [PATCH 4/4] Run inside directory

---
 zuul.d/playbooks/run.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/zuul.d/playbooks/run.yaml b/zuul.d/playbooks/run.yaml
index 5e458dbb6..899ed11b0 100644
--- a/zuul.d/playbooks/run.yaml
+++ b/zuul.d/playbooks/run.yaml
@@ -2,5 +2,7 @@
   tasks:
     - name: Run job
       shell: ./{{ curl_script | default(curl_test) }}.sh
+      args:
+        chdir: "{{ zuul.project.src_dir }}"
       environment:
         TRAVIS_BRANCH: "{{ zuul.branch }}"
\ No newline at end of file