Merge "Add a job that builds test_server.bin"
diff --git a/playbooks/test-server-build/post.yaml b/playbooks/test-server-build/post.yaml
new file mode 100644
index 0000000..2f3cfe6
--- /dev/null
+++ b/playbooks/test-server-build/post.yaml
@@ -0,0 +1,10 @@
+- hosts: all
+  name: Copy image
+  tasks:
+    - synchronize:
+        dest: "{{ zuul.executor.work_root }}/artifacts/"
+        mode: pull
+        src: "{{ ansible_user_dir }}/test-server"
+        verify_host: true
+        rsync_opts:
+          - "--exclude=/*/*/"
diff --git a/playbooks/test-server-build/run.yaml b/playbooks/test-server-build/run.yaml
new file mode 100644
index 0000000..27eb525
--- /dev/null
+++ b/playbooks/test-server-build/run.yaml
@@ -0,0 +1,20 @@
+- hosts: all
+  tasks:
+    - name: Install dependencies
+      package:
+        name:
+          - golang
+        state: present
+      become: yes
+    - name: Ensure artifacts directory exists
+      file:
+        name: "{{ ansible_user_dir }}/test-server"
+        state: directory
+    - name: Build test_server.bin
+      shell: |
+        source_dir={{ ansible_user_dir }}/src/opendev.org/openstack/octavia-tempest-plugin
+        dest_dir={{ ansible_user_dir }}/test-server
+        CGO_ENABLED=0 GOOS=linux go build \
+            -a -ldflags '-s -w -extldflags -static' \
+            -o ${dest_dir}/test_server-{{ test_server_arch }}.{{ zuul.branch }}.bin \
+            ${source_dir}/octavia_tempest_plugin/contrib/test_server/test_server.go
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 8d16140..ccff60b 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -1064,6 +1064,29 @@
             load_balancer:
               RBAC_test_type: keystone_default_roles
 
+- job:
+    name: publish-openstack-octavia-tempest-plugin-test-server
+    parent: publish-openstack-artifacts
+    description: |
+      Publish octavia-test-plugin test_server.bin application to tarballs.o.o.
+    run: playbooks/test-server-build/run.yaml
+    post-run: playbooks/test-server-build/post.yaml
+    required-projects:
+      - openstack/octavia-tempest-plugin
+    vars:
+      test_server_arch: x86_64
+
+- job:
+    name: octavia-test-server-build
+    parent: base
+    description: |
+      Builds octavia-test-plugin test_server.bin application.
+    run: playbooks/test-server-build/run.yaml
+    required-projects:
+      - openstack/octavia-tempest-plugin
+    vars:
+      test_server_arch: x86_64
+
 ######### Third party jobs ##########
 
 - job:
diff --git a/zuul.d/projects.yaml b/zuul.d/projects.yaml
index 2daabdb..07f0f3c 100644
--- a/zuul.d/projects.yaml
+++ b/zuul.d/projects.yaml
@@ -72,3 +72,6 @@
         - octavia-v2-dsvm-tls-barbican-stable-2025-2
         - octavia-v2-dsvm-tls-barbican-stable-2025-1
         - octavia-v2-dsvm-tls-barbican-stable-2024-2
+    periodic:
+      jobs:
+        - publish-openstack-octavia-tempest-plugin-test-server