From cf1adb66a0ec991159b4443b4a6eed02de1b9884 Mon Sep 17 00:00:00 2001
From: Monty Taylor <mordred@inaugust.com>
Date: Mon, 28 Aug 2017 18:41:28 -0500
Subject: [PATCH] Add release-announce job and publish-to-pypi template

This one is refreshingly easy.

We also have all the jobs needed now, so add a project-template
that matches the v2 publish-to-pypi template.

Depends-On: I901331a6b2dd7d269d5e356e76674ef9635924b5
Change-Id: Id9e346aefd6e783a184f3a4bb5d4b256a7448799
---
 playbooks/release/announce.yaml |  6 ++++++
 playbooks/release/pre.yaml      | 15 +++++++++++++++
 zuul.yaml                       | 30 ++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+)
 create mode 100644 playbooks/release/announce.yaml
 create mode 100644 playbooks/release/pre.yaml

diff --git a/playbooks/release/announce.yaml b/playbooks/release/announce.yaml
new file mode 100644
index 00000000..54b1f72e
--- /dev/null
+++ b/playbooks/release/announce.yaml
@@ -0,0 +1,6 @@
+- hosts: all
+  tasks:
+    - name: Send release announcement
+      command: >
+        src/git.openstack.org/openstack-infra/release-tools/announce.sh
+          src/{{ zuul.project.canonical_name }} {{ zuul.tag }}
diff --git a/playbooks/release/pre.yaml b/playbooks/release/pre.yaml
new file mode 100644
index 00000000..52fc8a6b
--- /dev/null
+++ b/playbooks/release/pre.yaml
@@ -0,0 +1,15 @@
+- hosts: all
+  roles:
+    - role: bindep
+      bindep_profile: test
+      bindep_dir: "src/{{ zuul.project.canonical_name }}"
+      # TODO(mordred) When we have site-local variables, these should go there
+      bindep_command: /usr/bindep-env/bin/bindep
+      bindep_fallback: /usr/local/jenkins/common_data/bindep-fallback.txt
+    - role: bindep
+      bindep_profile: test
+      bindep_dir: src/git.openstack.org/openstack-infra/release-tools
+      # TODO(mordred) When we have site-local variables, these should go there
+      bindep_command: /usr/bindep-env/bin/bindep
+      bindep_fallback: /usr/local/jenkins/common_data/bindep-fallback.txt
+    - revoke-sudo
diff --git a/zuul.yaml b/zuul.yaml
index bd292deb..ed98d86a 100644
--- a/zuul.yaml
+++ b/zuul.yaml
@@ -44,6 +44,36 @@
     pre-run: playbooks/python-tarball/pre
     run: playbooks/python-tarball/run
 
+- job:
+    name: announce-release
+    description:
+      Send a release announcement after publishing a project
+    pre-run: playbooks/release/pre
+    run: playbooks/release/announce
+    required-projects:
+      - openstack-infra/release-tools
+
+- project-template:
+    name: publish-to-pypi
+    pre-release:
+      jobs:
+        - publish-openstack-python-tarball
+        - announce-release:
+            dependencies:
+              - publish-openstack-python-tarball
+        - propose-update-constraints:
+            dependencies:
+              - publish-openstack-python-tarball
+    release:
+      jobs:
+        - publish-openstack-python-tarball
+        - announce-release:
+            dependencies:
+              - publish-openstack-python-tarball
+        - propose-update-constraints:
+            dependencies:
+              - publish-openstack-python-tarball
+
 - project:
     name: openstack-infra/openstack-zuul-jobs
     check: