forked from kubernetes/release
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release-notify
executable file
·104 lines (94 loc) · 3.47 KB
/
release-notify
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
#
# Copyright 2018 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Set PROGram name
PROG=${0##*/}
########################################################################
#+
#+ NAME
#+ $PROG - Kubernetes Release Notification Tool
#+
#+ SYNOPSIS
#+ $PROG <version> [--nomock] [--mailto=<user>,...]
#+ [--security_layer=/path/to/pointer/to/script]
#+ $PROG [--helpshort|--usage|-?]
#+ $PROG [--help|-man]
#+
#+ DESCRIPTION
#+ Kubernetes releases produced on GCB are not able to send email
#+ notifications. Use this helper tool to quickly send out a standard
#+ release notification after a release. You can also see from the logs
#+ on GCB exactly the command to issue to send a notification following
#+ a GCB-based release.
#+
#+ OPTIONS
#+ [--nomock] - Notifications to lists
#+ [--security_layer=] - A file containing a path to a script to
#+ source/include:
#+ FLAGS_security_layer=/path/to/script
#+ [--mailto=] - Useful for sending to self in --nomock mode
#+ [--help | -man] - display man page for this script
#+ [--usage | -?] - display in-line usage
#+
#+ EXAMPLES
#+
#+ FILES
#+ gs://kubernetes-release{,-$USER,-gcb}/archive/<version/announcement.html
#+
#+ SEE ALSO
#+ common.sh - common function definitions
#+ gitlib.sh - git/jenkins function definitions
#+ releaselib.sh - release/push-specific functions
#+
#+ BUGS/TODO
#+
########################################################################
# If NO ARGUMENTS should return usage, uncomment the following line:
usage=${1:-yes}
# Deal with OSX limitations out the gate for anyone that tries this there
BASE_ROOT=$(dirname $(readlink -e "$BASH_SOURCE" 2>&1)) \
|| BASE_ROOT="$BASH_SOURCE"
source $BASE_ROOT/lib/common.sh
source $TOOL_LIB_PATH/gitlib.sh
source $TOOL_LIB_PATH/releaselib.sh
# Validate command-line
common::argc_validate 1 || common::exit 1 "Exiting..."
# Set positional args
RELEASE_VERSION=${POSITIONAL_ARGV[0]}
###############################################################################
# MAIN
###############################################################################
# Default mode is a mocked release workflow
: ${FLAGS_nomock:=0}
##############################################################################
# Initialize logs
##############################################################################
# Initialize and save up to 10 (rotated logs)
if ((FLAGS_stage)); then
LOGFILE=$TMPDIR/$PROG-stage.log
else
LOGFILE=$TMPDIR/$PROG.log
fi
common::logfileinit $LOGFILE 10
# BEGIN script
common::timestamp begin
# Additional functionality
common::security_layer
security_layer::auth_check 1 || common::exit 1
common::set_cloud_binaries
release::set_globals
release::send_announcement || common::exit 1
common::timestamp end