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

fix: ensure UC_REPO/UC_DEPLOY are set correctly #84

Merged
merged 1 commit into from
May 7, 2024
Merged
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: 1 addition & 1 deletion docs/gitops-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ To avoid defining many environment variables we'll simplify by creating an
place it where we've cloned understack. A complete file would like like

```bash title="/path/to/uc-deploy/my-k3s.env"
UC_DEPLOY="$(pwd)/$(dirname ${BASH_SOURCE[0]})"
UC_DEPLOY="$(cd "$(dirname ${BASH_SOURCE[0]})" && git rev-parse --show-toplevel)"
DEPLOY_NAME="my-k3s"
[email protected]:myorg/uc-deploy.git
UC_DEPLOY_SSH_FILE="$HOME/devel/uc-deploy-key"
Expand Down
9 changes: 8 additions & 1 deletion scripts/gitops-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ if [ $# -ne 1 ]; then
usage
fi

SCRIPTS_DIR=$(dirname "$0")

if [ ! -f "$1" ]; then
echo "Did not get a file with environment variables." >&2
usage
fi

# set temp path so we can reset it after import
UC_REPO_PATH="$(cd "${SCRIPTS_DIR}" && git rev-parse --show-toplevel)"
export UC_REPO="${UC_REPO_PATH}"

. "$1"

export UC_REPO="$(git rev-parse --show-toplevel)"
# set the value again after import
export UC_REPO="${UC_REPO_PATH}"

if [ ! -d "${UC_REPO}" ]; then
echo "UC_REPO not set to a path." >&2
Expand Down
7 changes: 6 additions & 1 deletion scripts/gitops-secrets-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ if [ ! -f "$1" ]; then
usage
fi

# set temp path so we can reset it after import
UC_REPO_PATH="$(cd "${SCRIPTS_DIR}" && git rev-parse --show-toplevel)"
export UC_REPO="${UC_REPO_PATH}"

. "$1"

export UC_REPO="$(git rev-parse --show-toplevel)"
# set the value again after import
export UC_REPO="${UC_REPO_PATH}"

if [ ! -d "${UC_DEPLOY}" ]; then
echo "UC_DEPLOY not set to a path." >&2
Expand Down
Loading