-
Notifications
You must be signed in to change notification settings - Fork 16
/
settings
110 lines (94 loc) · 2.79 KB
/
settings
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
105
106
107
108
109
110
if [[ -z $VERSION ]] ; then
echo "VERSION must be set as an environment variable"
exit 1
fi
PROJECT="${PROJECT:-foreman}"
PROJECTDIR="releases/$PROJECT"
RELEASEDIR="${PROJECTDIR}/${VERSION}"
load_settings() {
# load user local settings
if [[ -f "settings.local" ]]; then
. "settings.local"
fi
# load project specific settings first
if [[ -f "${PROJECTDIR}/settings" ]]; then
. "${PROJECTDIR}/settings"
fi
# Load settings per release
# Expected: FULLGPGKEY
# Optional: FULLVERSION
. "$RELEASEDIR/settings"
}
# Prepare settings file
if [[ ! -d "$RELEASEDIR" ]] ; then
mkdir -p "$RELEASEDIR"
echo "FULLVERSION='${VERSION}.0-rc1'" > "$RELEASEDIR/settings"
fi
if [[ $PROJECT != foreman ]]; then
load_settings
if [[ -z "$FOREMAN_VERSION" ]]; then
echo "please set FOREMAN_VERSION in $RELEASEDIR/settings"
exit 1
elif [[ "$FOREMAN_VERSION" != "none" ]]; then
# load foreman settings, which will contain keys etc
. "releases/foreman/${FOREMAN_VERSION}/settings"
fi
else
FOREMAN_VERSION="$VERSION"
fi
SIGNER="[email protected]"
SIGNER_NAME="Foreman Automatic Signing Key"
OSES=""
ARCHES="x86_64 source"
RPMDIR="$RELEASEDIR/rpms"
KEYDIR="$RELEASEDIR/gnupg"
GNUPGHOME="$KEYDIR"
TARDIR="$RELEASEDIR/tarballs"
EXTRASDIR="$RELEASEDIR/extras"
DOWNLOADS_HOSTS="website01.osuosl.theforeman.org,"
RPM_HOST="repo-rpm01.osuosl.theforeman.org"
DOCROOT="/var/www/vhosts/downloads/htdocs"
GOPASS_STORE="theforeman/releases"
PASS_NAME_GPG="$GOPASS_STORE/foreman/$FOREMAN_VERSION-gpg"
PASS_NAME_KEY="$GOPASS_STORE/foreman/$FOREMAN_VERSION-key"
XARGS_JOBS="-n 20 -P 4"
GIT_DIR="${GIT_DIR:-$HOME/dev}"
GIT_USE_WORKTREES=false
GIT_REMOTE="${GIT_REMOTE:-upstream}"
GIT_DEVELOP_BRANCH=develop
GIT_STABLE_BRANCH="${VERSION}-stable"
GITHUB_NAMESPACE=theforeman
PACKAGING_DIR="$GIT_DIR/foreman-packaging"
PACKAGING_GIT_REMOTE=origin
TAR_PROJECTS=""
RPM_PACKAGES=()
PACKAGING_PR=${PACKAGING_PR:-true}
GPG_EXPIRE="1y"
STAGE_LOCAL_BASE="tmp/$PROJECT/$VERSION"
load_settings
HALFGPGKEY="$(echo ${FULLGPGKEY: -16} | tr '[A-Z]' '[a-z]')"
gopass_sync() {
gopass sync --store "$GOPASS_STORE"
}
show_gpg_password() {
gopass show --password "$PASS_NAME_GPG"
}
gpg_with_password() {
gpg2 --pinentry-mode loopback --passphrase-file <(show_gpg_password) "$@"
}
# Invoke ansible-playbook with ansible_become_password set safely
ansible_playbook() {
local password_file
password_file=$(mktemp --suffix=.json)
chmod 0600 "$password_file"
gopass show --password "theforeman/unix" | ruby -rjson -e 'puts({"ansible_become_password" => STDIN.read}.to_json)' > "$password_file"
ansible-playbook --extra-vars="@${password_file}" "$@"
shred --remove "${password_file}"
}
require_fullversion() {
if [[ -z $FULLVERSION ]] ; then
echo "FULLVERSION is required for this script"
exit 1
fi
}
# vim: ft=sh