-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* moved m1 logic to install step * Bump version to 0.1.2 Co-authored-by: SteveRuble <SteveRuble@@users.noreply.github.com>
- Loading branch information
1 parent
f9ed134
commit 2e278eb
Showing
19 changed files
with
281 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ ruby 2.7.2 | |
python 3.9.7 | ||
pre-commit 2.15.0 | ||
shfmt 3.4.1 | ||
shellcheck 0.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.1 | ||
0.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,44 @@ | ||
#!/bin/bash | ||
|
||
#shellcheck disable=SC2034 | ||
|
||
if ! command -v brew &>/dev/null; then | ||
|
||
if [[ $(uname -m) == 'arm64' ]]; then | ||
echo '----------------------------------- | ||
You have an M1 chip and you are not | ||
running in a Rosetta-flavored shell. | ||
There may be a day when all our tools | ||
work correctly on M1, but until that day | ||
you will need to install them in x86 | ||
compatibility mode. I will install brew | ||
in x86 compatibiility mode to support that. | ||
When you run brew commands in the future | ||
you may run into a message telling you | ||
that you need to install it in another mode. | ||
You can follow those instructions, or just | ||
make a new shell using "arch -x86_64 zsh" | ||
and do your brew install from there. | ||
Press any key to continue | ||
' | ||
read -rn 1 | ||
arch -x86_64 /bin/bash -c "$(curl -fsSL https://github.com/raw/Homebrew/install/master/install.sh)" | ||
else | ||
/bin/bash -c "$(curl -fsSL https://github.com/raw/Homebrew/install/master/install.sh)" | ||
fi | ||
if ! command -v brew >/dev/null; then | ||
/bin/bash -c "$(curl -fsSL https://github.com/raw/Homebrew/install/master/install.sh)" | ||
fi | ||
|
||
eval "$(/usr/local/bin/brew shellenv)" | ||
# Activate the correct brew for the CPU | ||
if [[ "$(uname -m)" == 'arm64' ]]; then | ||
eval "$(/opt/homebrew/bin/brew shellenv)" | ||
else | ||
eval "$(/usr/local/bin/brew shellenv)" | ||
fi | ||
|
||
echo "Installing ih-core formula..." | ||
echo "Sometimes the dependency downloads fail, possibly due to the VPN, so \ | ||
I will retry installing a couple times if it fails." | ||
|
||
if [[ $1 == "local" ]]; then | ||
THIS_DIR=$(dirname "$(realpath "$0")") | ||
|
||
for i in 1 2 3; do brew install --formula -s "$THIS_DIR/formula/ih-core.rb" && break; done | ||
brew update | ||
brew tap ConsultingMD/homebrew-ih-public https://github.com/ConsultingMD/homebrew-ih-public.git | ||
|
||
elif [[ ${#} -eq 1 ]]; then | ||
VERSION=$1 | ||
echo "Installing version $VERSION" | ||
TMP_DIR=$(mktemp -d) | ||
FORMULA_PATH="$TMP_DIR/ih-core.rb" | ||
curl -L -o "$FORMULA_PATH" "https://github.com/ConsultingMD/homebrew-ih-public/releases/download/$VERSION/ih-core.rb" | ||
SUCCEEDED=1 | ||
for _ in 1 2 3; do | ||
brew install ih-core | ||
SUCCEEDED=$? | ||
if [ $SUCCEEDED -eq 0 ]; then | ||
break | ||
fi | ||
done | ||
|
||
for i in 1 2 3; do brew install --formula -s "$FORMULA_PATH" && break; done | ||
rm -rf "$TMP_DIR" | ||
else | ||
brew update | ||
brew tap ConsultingMD/homebrew-ih-public https://github.com/ConsultingMD/homebrew-ih-public.git | ||
for i in 1 2 3; do brew install ih-core && break; done | ||
if [ $SUCCEEDED -eq 1 ]; then | ||
echo "Install of ih-setup formula failed. Please contact platform support | ||
in the #developer-platform-support stream in Zulip or the #dept-eng_infra channel | ||
in Slack. You can also search Confluence for 'Engineer Onboarding Guide' for | ||
more troubleshooting tips." | ||
exit 1 | ||
fi | ||
|
||
if command -v ih-setup; then | ||
ih-setup install | ||
else | ||
echo "ih-setup is not available in your PATH. Check the logs above to see if there was a fatal error, | ||
and make sure that /usr/local/bin is in your PATH. Then run 'ih-setup install' again." | ||
and make sure that /usr/local/bin is in your PATH" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This file defines the go environment variables you | ||
# should have when working on the bobs repo. | ||
# It was created by `ih-setup install bobs go` | ||
|
||
# ██████╗ ██████╗ ███╗ ██╗ ██████╗ ████████╗ ███████╗██████╗ ██╗████████╗ | ||
# ██╔══██╗██╔═══██╗ ████╗ ██║██╔═══██╗╚══██╔══╝ ██╔════╝██╔══██╗██║╚══██╔══╝ | ||
# ██║ ██║██║ ██║ ██╔██╗ ██║██║ ██║ ██║ █████╗ ██║ ██║██║ ██║ | ||
# ██║ ██║██║ ██║ ██║╚██╗██║██║ ██║ ██║ ██╔══╝ ██║ ██║██║ ██║ | ||
# ██████╔╝╚██████╔╝ ██║ ╚████║╚██████╔╝ ██║ ███████╗██████╔╝██║ ██║ | ||
# ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚══════╝╚═════╝ ╚═╝ ╚═╝ | ||
# Changes to this file will be overwritten if you re-install the step | ||
|
||
export GO111MODULE=on | ||
export GOPATH="${HOME}/go" | ||
export GOBIN="${GOPATH}/bin" | ||
export PATH=$PATH:"${GOBIN}" | ||
export GOPROXY=direct | ||
export GOPRIVATE='github.com/ConsultingMD/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
|
||
# IH_CORE_DIR will be set to the directory containing the bin and lib directories. | ||
BOBSGOVERSION="1.15.15" | ||
|
||
function ih::setup::bobs.go::help() { | ||
echo "This correctly installs Go for use in the bobs repo | ||
This step will: | ||
- install an x86 version of go $BOBSGOVERSION for asdf | ||
- configure your shell with required go environment variables | ||
" | ||
} | ||
|
||
# Check if the step has been installed and return 0 if it has. | ||
# Otherwise return 1. | ||
function ih::setup::bobs.go::test() { | ||
|
||
if ! ih::file::check-shell-defaults "$IH_CORE_DIR"/lib/bobs/go/default; then | ||
return 1 | ||
fi | ||
|
||
if ! asdf list golang | grep -q "$BOBSGOVERSION"; then | ||
return 1 | ||
fi | ||
|
||
return 0 | ||
} | ||
|
||
# Echo a space-delimited list of steps which must be installed before this one can be. | ||
function ih::setup::bobs.go::deps() { | ||
# echo "step1 step2" | ||
echo "" | ||
} | ||
|
||
function ih::setup::bobs.go::install() { | ||
|
||
set -e | ||
|
||
ih::arch::x86 asdf install golang "$BOBSGOVERSION" | ||
|
||
ih::file::sync-shell-defaults "$IH_CORE_DIR"/lib/bobs/go/default | ||
|
||
export IH_WANT_RE_SOURCE=1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# IH_CORE_DIR will be set to the directory containing the bin and lib directories. | ||
|
||
function ih::setup::bobs.scala::help() { | ||
echo 'This will install the correct scala | ||
This step will: | ||
- Install scala 2.12 in x86 mode | ||
' | ||
} | ||
|
||
# Check if the step has been installed and return 0 if it has. | ||
# Otherwise return 1. | ||
function ih::setup::bobs.scala::test() { | ||
if ! ih::arch::ibrew list scala@2.12 >/dev/null 2>&1; then | ||
return 1 | ||
fi | ||
return 0 | ||
} | ||
|
||
# Echo a space-delimited list of steps which must be installed before this one can be. | ||
function ih::setup::bobs.scala::deps() { | ||
echo "" | ||
} | ||
|
||
function ih::setup::bobs.scala::install() { | ||
ih::arch::ibrew install scala@2.12 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
python 3.9.7 | ||
bazel 3.7.2 | ||
buf 0.51.1 | ||
golang 1.16.3 | ||
helm 3.6.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Use correct brew and brew path stuff based on shell architecture compatibility | ||
if [[ "$(uname -m)" == 'arm64' ]]; then | ||
eval "$(/opt/homebrew/bin/brew shellenv)" | ||
else | ||
eval "$(/usr/local/bin/brew shellenv)" | ||
fi | ||
|
||
# Aliases to switch compatibility mode in shells | ||
alias x86='arch -x86_64 $SHELL' | ||
alias amd64='arch -arm64 $SHELL' | ||
|
||
alias ibrew='arch -x86_64 /usr/local/bin/brew' | ||
alias mbrew='arch -arm64 /opt/homebrew/bin/brew' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
|
||
# IH_CORE_DIR will be set to the directory containing the bin and lib directories. | ||
|
||
function ih::setup::core.m1::help() { | ||
echo 'Installs M1 compatibility fixes if needed | ||
This step only runs if you have an M1 | ||
CPU. It installs various things that make | ||
it easier to fall back to x86 mode for | ||
tools that do not work on M1. It will: | ||
- Install the x86 version of brew | ||
- Augment your shell setup with some aliases | ||
- x86 will start a new shell in x86 mode | ||
- amd64 will start a new shell in amd64 (M1) mode | ||
- Set up your shell so that if you are | ||
in x86 mode the x86 version of brew will be used. | ||
' | ||
} | ||
|
||
# Check if the step has been installed and return 0 if it has. | ||
# Otherwise return 1. | ||
function ih::setup::core.m1::test() { | ||
if sysctl -n machdep.cpu.brand_string | grep "M1"; then | ||
|
||
# M1 CPU detected | ||
if [ ! -x /usr/local/bin/brew ]; then | ||
ih::log::debug "Brew is not installed in x86 mode" | ||
return 1 | ||
fi | ||
|
||
if ! ih::file::check-shell-defaults "${IH_CORE_LIB_DIR}/core/m1/default"; then | ||
ih::log::debug "M1 shell script out of date" | ||
return 1 | ||
fi | ||
fi | ||
|
||
return 0 | ||
} | ||
|
||
# Echo a space-delimited list of steps which must be installed before this one can be. | ||
function ih::setup::core.m1::deps() { | ||
# echo "step1 step2" | ||
echo "core.shell" | ||
} | ||
|
||
function ih::setup::core.m1::install() { | ||
|
||
if [ ! -x /usr/local/bin/brew ]; then | ||
arch -x86_64 /bin/bash -c "$(curl -fsSL https://github.com/raw/Homebrew/install/master/install.sh)" | ||
fi | ||
|
||
ih::file::sync-shell-defaults "${IH_CORE_LIB_DIR}/core/m1/default" | ||
|
||
export IH_WANT_RE_SOURCE=1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.