Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly load inherited foreman settings #419

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions export_gpg_private
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

. settings

require_pass_name_key

if [[ ! -d $KEYDIR ]] ; then
echo "Keydir $KEYDIR doesn't exist"
exit 1
Expand Down
2 changes: 2 additions & 0 deletions generate_gpg
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ if [[ -n $FULLGPGKEY ]] ; then
exit 2
fi

require_pass_name_gpg

mkdir -m 0700 $KEYDIR

( gopass show --password "$PASS_NAME_GPG" 2> /dev/null || gopass generate "$PASS_NAME_GPG" 20 ) > /dev/null
Expand Down
2 changes: 2 additions & 0 deletions import_gpg_private
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

. settings

require_pass_name_key

if [[ ! -d "$KEYDIR" ]] ; then
mkdir -p -m 0700 "$KEYDIR"
fi
Expand Down
14 changes: 11 additions & 3 deletions releases/foreman/settings
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
TAR_PROJECTS="foreman foreman-proxy foreman-installer foreman-selinux"
RPM_PACKAGES=(foreman foreman-installer foreman-proxy foreman-release foreman-selinux)
PACKAGING_SUBDIR="packages/foreman"
# This deals with inheritance with other projects
if [[ -z $FOREMAN_VERSION ]] ; then
TAR_PROJECTS="foreman foreman-proxy foreman-installer foreman-selinux"
RPM_PACKAGES=(foreman foreman-installer foreman-proxy foreman-release foreman-selinux)
PACKAGING_SUBDIR="packages/foreman"
else
FOREMAN_VERSION=$VERSION
fi

PASS_NAME_GPG="theforeman/releases/foreman/${FOREMAN_VERSION}-gpg"
PASS_NAME_KEY="theforeman/releases/foreman/${FOREMAN_VERSION}-key"
41 changes: 26 additions & 15 deletions settings
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ load_settings() {
# Expected: FULLGPGKEY
# Optional: FULLVERSION
. "$RELEASEDIR/settings"

if [[ $PROJECT != foreman ]]; then
ekohl marked this conversation as resolved.
Show resolved Hide resolved
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/settings
. "releases/foreman/${FOREMAN_VERSION}/settings"
Copy link
Member Author

@evgeni evgeni Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mhh, no, this overwrites OSes that have been set in client/(version/)?settings before. damn.

fi
fi
}

# Prepare settings file
Expand All @@ -29,19 +40,6 @@ if [[ ! -d "$RELEASEDIR" ]] ; then
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=""
Expand All @@ -52,8 +50,6 @@ TARDIR="$RELEASEDIR/tarballs"
EXTRASDIR="$RELEASEDIR/extras"
HOSTS="web01.osuosl.theforeman.org,"
DOCROOT="/var/www/vhosts/downloads/htdocs"
PASS_NAME_GPG="theforeman/releases/foreman/$FOREMAN_VERSION-gpg"
PASS_NAME_KEY="theforeman/releases/foreman/$FOREMAN_VERSION-key"
XARGS_JOBS="-n 20 -P 4"
GIT_DIR="${GIT_DIR:-$HOME/dev}"
GIT_USE_WORKTREES=false
Expand All @@ -72,7 +68,22 @@ load_settings

HALFGPGKEY="$(echo ${FULLGPGKEY: -16} | tr '[A-Z]' '[a-z]')"

require_pass_name_gpg() {
if [[ -z $PASS_NAME_GPG ]] ; then
echo "Set PASS_NAME_GPG in the settings"
exit 1
fi
}

require_pass_name_key() {
if [[ -z $PASS_NAME_KEY ]] ; then
echo "Set PASS_NAME_KEY in the settings"
exit 1
fi
}

show_gpg_password() {
require_pass_name_gpg
gopass show --password "$PASS_NAME_GPG"
}

Expand Down
Loading