Add job to automatically announce lf releases 69/13269/6
authorThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 1 Nov 2018 03:39:39 +0000 (23:39 -0400)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Sun, 10 Feb 2019 21:05:51 +0000 (16:05 -0500)
This job triggers when a Gerrit tag is pushed and sends an email to
lf-releng@lists.linuxfoundation.org to notifiy the release.

Change-Id: I5255ac6f3afbcadfc11e9640483613bd2e84250a
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
docs/jjb/lf-release-management-jobs.rst [new file with mode: 0644]
jjb/lf-release-management-jobs.yaml [new file with mode: 0644]
releasenotes/notes/automate-release-announcements-0b9f2c7f854198ff.yaml [new file with mode: 0644]
shell/release-announce.sh [new file with mode: 0644]

diff --git a/docs/jjb/lf-release-management-jobs.rst b/docs/jjb/lf-release-management-jobs.rst
new file mode 100644 (file)
index 0000000..5bf3e93
--- /dev/null
@@ -0,0 +1,20 @@
+---
+Job Templates
+=============
+
+.. _release-announce:
+
+Release Announce
+----------------
+
+Job for lf-releng projects to automate release announcement emails.
+
+:Template Names:
+    - {project-name}-release-announce
+    - gerrit-release-announce
+
+:Required parameters:
+
+    :build-node: The node to run build on.
+    :jenkins-ssh-credential: Credential to use for SSH. (Configured in
+        defaults.yaml)
diff --git a/jjb/lf-release-management-jobs.yaml b/jjb/lf-release-management-jobs.yaml
new file mode 100644 (file)
index 0000000..5bee429
--- /dev/null
@@ -0,0 +1,56 @@
+---
+####################
+# Release Announce #
+####################
+
+- lf_release_announce: &lf_release_announce
+    name: lf-release-announce
+
+    ######################
+    # Default parameters #
+    ######################
+
+    build-days-to-keep: 7
+    build-timeout: 15
+    disable-job: false
+
+    #####################
+    # Job Configuration #
+    #####################
+
+    project-type: freestyle
+    node: '{build-node}'
+    disabled: '{disable-job}'
+
+    properties:
+      - lf-infra-properties:
+          build-days-to-keep: '{build-days-to-keep}'
+
+    builders:
+      - shell: !include-raw-escape: ../shell/release-announce.sh
+
+    wrappers:
+      - lf-infra-wrappers:
+          build-timeout: '{build-timeout}'
+          jenkins-ssh-credential: '{jenkins-ssh-credential}'
+
+    publishers:
+      - lf-infra-publish
+
+
+- job-template:
+    name: '{project-name}-release-announce'
+    id: gerrit-release-announce
+    <<: *lf_release_announce
+
+    triggers:
+      - gerrit:
+          server-name: '{gerrit-server-name}'
+          trigger-on:
+            - ref-updated-event
+          projects:
+            - project-compare-type: 'ANT'
+              project-pattern: '{project-pattern}'
+              branches:
+                - branch-compare-type: 'ANT'
+                  branch-pattern: 'refs/tags/**'
diff --git a/releasenotes/notes/automate-release-announcements-0b9f2c7f854198ff.yaml b/releasenotes/notes/automate-release-announcements-0b9f2c7f854198ff.yaml
new file mode 100644 (file)
index 0000000..15c68a3
--- /dev/null
@@ -0,0 +1,5 @@
+---
+features:
+  - |
+    New job-template **{project-name}-release-announce** for lf-releng projects
+    to automate release announcement emails.
diff --git a/shell/release-announce.sh b/shell/release-announce.sh
new file mode 100644 (file)
index 0000000..fd1afe6
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+# SPDX-License-Identifier: EPL-1.0
+##############################################################################
+# Copyright (c) 2018 The Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+##############################################################################
+
+PROJECT="${GERRIT_PROJECT#releng/}"  # For releng projects strip the prefix
+TAG_NAME="${GERRIT_REFNAME#refs/tags/}"
+
+set -eux -o pipefail
+
+mail_opts=()
+mail_opts+=("-r" "LF Releng <lf-releng@lists.linuxfoundation.org>")
+mail_opts+=("-s" "$PROJECT $TAG_NAME released")
+mail_opts+=("lf-releng@lists.linuxfoundation.org")
+
+mail "${mail_opts[@]}" << EOF
+Hi Everyone,
+
+$PROJECT $TAG_NAME is released. Thanks to everyone who contributed
+to this release. Release notes are available online at:
+
+https://docs.releng.linuxfoundation.org/projects/$PROJECT/en/latest/release-notes.html#${TAG_NAME}
+
+Cheers,
+LF Releng
+EOF