Skip to content

Commit

Permalink
adding check for gnused (gsed) for MacOS users
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-viles committed Oct 3, 2024
1 parent 5259116 commit 9b6ef92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Useful shiz for developing Unikorn.
## Prerequisites

* GNU `make`
* GNU `sed` (default on Linux, `brew install gnused` on MacOS)
* `go`
* `kubectl`
* `jq`
Expand All @@ -32,7 +33,7 @@ A special `global.yaml` file allows global parameters to be set for all deployme
The deploy command has the following flags that may be of use:

* `-e <environment>` choose the environment to use defined in `~/.config/unikorn/${environment}` when looking up values files.
* `-t` dump the deployment out as raw resources, useful for piping into `kubeclt diff -f -` to make sure nothing untoward has changed.
* `-t` dump the deployment out as raw resources, useful for piping into `kubectl diff -f -` to make sure nothing untoward has changed.
* `-p` do a production deployment using the actual helm repository, as opposed to the local source tree.

### restart
Expand Down
11 changes: 9 additions & 2 deletions deploy
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
# has been bumped, otherwise you will need to manually restart all
# the pods with kubectl.
#
# NOTE: must be run from the compenent's root directory.
# NOTE: must be run from the component's root directory.

# Check if gsed is available for MacOS users, otherwise fallback to sed
if command -v gsed &> /dev/null; then
SED_CMD="gsed"
else
SED_CMD="sed"
fi

# Get the environemnt.
ENVIRONMENT="local"
Expand Down Expand Up @@ -44,7 +51,7 @@ GIT_REPO=""
if [[ -f go.mod ]]; then
GIT_REPO="$(head -n1 go.mod | awk '{print $2}')"
elif [[ -f package.json ]]; then
GIT_REPO="$(jq -r .repository.url package.json | sed 's,http[s]\?://,,')"
GIT_REPO="$(jq -r .repository.url package.json | $SED_CMD 's,http[s]\?://,,')"
fi
GIT_ORG_NAME=$(echo -n "${GIT_REPO}" | cut -d '/' -f 2)
GIT_REPO_NAME=$(echo -n "${GIT_REPO}" | cut -d '/' -f 3)
Expand Down

0 comments on commit 9b6ef92

Please sign in to comment.