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

Improve portability, explicitly use GNU/make on macOS #7

Open
wants to merge 2 commits into
base: main
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
10 changes: 8 additions & 2 deletions build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# All Unikorn components use the same build system, so can be built in a generic
# manner. This does the build and pushes it into KinD.
Expand All @@ -8,4 +8,10 @@
CHART="$(ls charts)"
CHART_META="charts/${CHART}/Chart.yaml"

make images-kind-load VERSION="$(yq .version "${CHART_META}")"
if [[ "$(uname)" == "Darwin" ]]; then
MAKECMD="gmake"
Copy link
Member

Choose a reason for hiding this comment

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

I mean, given

[Wed 19 Jun 11:34:08 BST 2024] simon@symphony ~/src/github.com/unikorn-cloud/scripts which gmake
/usr/bin/gmake

I wouldn't be opposed to just changing the command rather than having a sprawling mess of control flow

Copy link
Member Author

Choose a reason for hiding this comment

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

Well now that you mention it, what I actually want to do is to state that developers on macOS should use Colima, and then this build command becomes gmake build images.

Copy link
Member

Choose a reason for hiding this comment

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

Well then, given kubeclt version doesn't give away the platform, and a special flag will be intrusive to someone, I'd consider switching the command based on a config file, say ~/.config/unikorn/scipts.yaml. That would look like...

platform: kind

Then do

MAKE_TARGET=images

if [[ "$(yq .platform /.config/unikorn/scipts.yaml)" == "kind" ]]; then
  MAKE_TARGET=images-kind-load
fi

gmake "${MAKE_TARGET}" ...blah

else
MAKECMD="make"
fi

$MAKECMD images-kind-load VERSION="$(yq .version "${CHART_META}")"
2 changes: 1 addition & 1 deletion deploy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Deploys a unikorn component. Will only work if the chart version
# has been bumped, otherwise you will need to manually restart all
Expand Down
2 changes: 1 addition & 1 deletion restart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Restarts a unikorn component. Gets more hardcore than the deploy
# command when you've not mdified anything that would cause a pod
Expand Down
2 changes: 1 addition & 1 deletion ui-preview
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash

# Define the environment.
# TODO: getopts
Expand Down
Loading