Initial commit

Change-Id: I172a44b31cabda295f42c12d6a6988563d331495
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 0000000..63b1b49
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,5 @@
+[gerrit]
+host=review.vexxhost.dev
+port=29418
+project=zuul-config.git
+defaultbranch=main
diff --git a/playbooks/base/post-logs.yaml b/playbooks/base/post-logs.yaml
new file mode 100644
index 0000000..060651c
--- /dev/null
+++ b/playbooks/base/post-logs.yaml
@@ -0,0 +1,13 @@
+- hosts: localhost
+  gather_facts: False
+  tasks:
+    - name: Generate Zuul manifest
+      include_role:
+        name: generate-zuul-manifest
+
+    - name: Upload logs
+      include_role:
+        name: upload-logs
+      vars:
+        zuul_log_url: "https://logs.{{ zuul.tenant }}.vexxhost.dev"
+        zuul_logserver_root: "/srv/static/logs/{{ zuul.tenant }}"
diff --git a/playbooks/base/post.yaml b/playbooks/base/post.yaml
new file mode 100644
index 0000000..c4a139d
--- /dev/null
+++ b/playbooks/base/post.yaml
@@ -0,0 +1,11 @@
+- hosts: all
+  roles:
+    - fetch-output
+    - merge-output-to-logs
+
+- hosts: all
+  # NOTE(pabelanger): We ignore_errors for the following tasks as not to fail
+  # successful jobs.
+  ignore_errors: yes
+  roles:
+    - remove-build-sshkey
diff --git a/playbooks/base/pre.yaml b/playbooks/base/pre.yaml
new file mode 100644
index 0000000..066af6a
--- /dev/null
+++ b/playbooks/base/pre.yaml
@@ -0,0 +1,22 @@
+- hosts: localhost
+  name: Create job header and inventory
+  roles:
+    - role: emit-job-header
+      zuul_log_path_shard_build: true
+    - log-inventory
+
+- hosts: all
+  roles:
+    - add-build-sshkey
+    - prepare-workspace
+    - ensure-output-dirs
+
+  tasks:
+    - name: Configure mirrors
+      ansible.builtin.include_role:
+        name: configure-mirrors
+      when:
+        - ansible_os_family == 'Debian'
+      vars:
+        set_apt_mirrors_trusted: True
+        mirror_use_ssl: True
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
new file mode 100644
index 0000000..4e08a0e
--- /dev/null
+++ b/zuul.d/jobs.yaml
@@ -0,0 +1,15 @@
+- job:
+    name: base
+    parent: null
+    timeout: 1800
+    pre-run: playbooks/base/pre.yaml
+    post-run:
+      - playbooks/base/post.yaml
+      - playbooks/base/post-logs.yaml
+    roles:
+      - zuul: opendev.org/zuul/zuul-jobs
+      - zuul: github.com/vexxhost/zuul-jobs
+    nodeset:
+      nodes:
+        - name: ubuntu-jammy
+          label: jammy-2c-8g
diff --git a/zuul.d/pipelines.yaml b/zuul.d/pipelines.yaml
new file mode 100644
index 0000000..fc40d4a
--- /dev/null
+++ b/zuul.d/pipelines.yaml
@@ -0,0 +1,211 @@
+- pipeline:
+    name: check
+    description: |
+      Newly uploaded patchsets enter this pipeline to receive an
+      initial check status.
+    success-message: Build succeeded (check pipeline).
+    failure-message: Build failed (check pipeline).
+    manager: independent
+    precedence: low
+    require:
+      gerrit:
+        open: True
+        current-patchset: True
+    trigger:
+      gerrit:
+        - event: patchset-created
+        - event: change-restored
+        - event: comment-added
+          comment: (?i)^(Patch Set [0-9]+:)?( [\w\\+-]*)*(\n\n)?\s*recheck
+        - event: comment-added
+          approval:
+            - Workflow: 1
+          require:
+            approval:
+              - Verified: [-1, -2]
+                username: zuul
+      github:
+        # Run this pipeline on new/changed pull requests
+        - event: pull_request
+          action:
+            - opened
+            - changed
+            - reopened
+        # Run in response to a pull request comment "recheck"
+        - event: pull_request
+          action: comment
+          comment: (?i)^\s*recheck\s*$
+        # When using the checks API to report results, failed runs
+        # will have a "re-run" button which emits this event.
+        - event: check_run
+          action: rerequested
+          check: .*/check:.*
+    start:
+      github:
+        check: in_progress
+        comment: false
+    success:
+      gerrit:
+        Verified: 1
+      github:
+        check: success
+        comment: false
+    failure:
+      gerrit:
+        Verified: -1
+      github:
+        check: failure
+        comment: false
+    dequeue:
+      github:
+        check: cancelled
+        comment: false
+
+- pipeline:
+    name: gate
+    description: |
+      Changes that have been approved by core reviewers are enqueued
+      in order in this pipeline, and if they pass tests, will be
+      merged. For documentation on how gating with Zuul works, please see
+      https://zuul-ci.org/docs/zuul/latest/gating.html
+    success-message: Build succeeded (gate pipeline).
+    failure-message: Build failed (gate pipeline).
+    manager: dependent
+    precedence: normal
+    post-review: True
+    supercedes: check
+    require:
+      gerrit:
+        open: True
+        current-patchset: True
+        approval:
+          - Workflow: 1
+      github:
+        label: gate
+        open: true
+        current-patchset: true
+    trigger:
+      gerrit:
+        - event: comment-added
+          approval:
+            - Workflow: 1
+        - event: comment-added
+          comment: (?i)^(Patch Set [0-9]+:)?( [\w\\+-]*)*(\n\n)?\s*re(check|verify)
+      github:
+        - event: pull_request_review
+          action: submitted
+          state:
+            - approved
+        - event: pull_request
+          action: comment
+          comment: (?i)^\s*regate\s*$
+        - event: pull_request_review
+          action: dismissed
+          state:
+            - changes_requested
+        - event: pull_request
+          action: status
+          status: ".*:success"
+        - event: check_run
+          action: rerequested
+          check: .*/gate:.*
+        # Enqueue if the check job has completed
+        - event: check_run
+          action: completed
+          check: "atmosphere-ci:atmosphere/check:success"
+        - event: pull_request
+          action: labeled
+          label:
+            - gate
+    start:
+      gerrit:
+        Verified: 0
+      github:
+        check: in_progress
+        comment: false
+    success:
+      gerrit:
+        Verified: 2
+        submit: true
+      github:
+        check: success
+        comment: false
+        merge: true
+    failure:
+      gerrit:
+        Verified: -2
+      github:
+        check: 'failure'
+        comment: false
+    dequeue:
+      github:
+        check: cancelled
+        comment: false
+    window-floor: 20
+    window-increase-factor: 2
+
+- pipeline:
+    name: post
+    description: |
+      This pipeline runs jobs that operate after each change is
+      merged. Queue items are identified by the abbreviated hash (git
+      log --format=%h) of the merge commit.
+    manager: supercedent
+    precedence: high
+    post-review: true
+    trigger:
+      gerrit:
+        - event: ref-updated
+          ref: ^refs/heads/.*$
+      github:
+        - event: push
+          ref: ^refs/heads/.*$
+
+- pipeline:
+    name: promote
+    description: |
+      This pipeline runs jobs that operate after each change is merged
+      in order to promote artifacts generated in the gate
+      pipeline.
+    success-message: Build succeeded (promote pipeline).
+    failure-message: Build failed (promote pipeline).
+    manager: supercedent
+    precedence: high
+    post-review: True
+    require:
+      github:
+        merged: true
+    trigger:
+      gerrit:
+        - event: change-merged
+      github:
+        - event: pull_request
+          action: closed
+    success:
+      gerrit: {}
+    failure:
+      gerrit: {}
+
+- pipeline:
+    name: release
+    description: When a commit is tagged as a release, this pipeline runs jobs that publish archives and documentation.
+    manager: independent
+    precedence: high
+    post-review: True
+    trigger:
+      gerrit:
+        - event: ref-updated
+          ref: ^refs/tags/.*$
+      github:
+        - event: push
+          ref: ^refs/tags/.*$
+
+- pipeline:
+    name: periodic
+    post-review: true
+    description: Jobs in this queue are triggered on a daily timer.
+    manager: independent
+    precedence: low
+    trigger:
+      timer:
+        - time: '0 2 * * *'
diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml
new file mode 100644
index 0000000..5581c38
--- /dev/null
+++ b/zuul.d/projects.yaml
@@ -0,0 +1,14 @@
+- project:
+    name: ^.*$
+    check:
+      jobs: []
+    gate:
+      jobs: []
+
+- project:
+    check:
+      jobs:
+        - noop
+    gate:
+      jobs:
+        - noop