-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
99 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* have an administrator user | ||
* install cli build tools (if you can git it's ok) | ||
* install brew | ||
* install coreutils, gnu-sed, go, yarn with brew | ||
* sudo xcode-select <xcode-path> | ||
* sudo xcodebuild -license | ||
* sudo gem install cocoapods | ||
* sudo gem install bundler |
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/sh | ||
|
||
set -e | ||
|
||
SECRETS_DIR=/Users/administrator/secrets | ||
|
||
# Absolute path to this script, e.g. /home/user/bin/foo.sh | ||
SCRIPT=$(greadlink -f "$0") | ||
# Absolute path this script is in, thus /home/user/bin | ||
SCRIPTPATH=$(dirname "$SCRIPT") | ||
|
||
username="$1" | ||
usergroupname=staff | ||
|
||
[ -n "$username" ] || { | ||
echo "Error: missing username argument" 1>&2 | ||
echo "Usage: $0 <username>" 1>&2 | ||
false | ||
} | ||
|
||
agent_token_file="$SECRETS_DIR/buildkite-agent-token" | ||
[ -f "$agent_token_file" ] || { | ||
echo "Error: missing buildkite agent token file '$agent_token_file'" 1>&2 | ||
false | ||
} | ||
bootstrap_vars="BUILDKITE_AGENT_TOKEN=$(cat $agent_token_file)" | ||
|
||
user_home=/Users/$username | ||
|
||
sysadminctl -addUser $username | ||
|
||
cp -r $SCRIPTPATH/user/* $user_home/ | ||
chown -R $username:$usergroupname $user_home | ||
|
||
su -l $username -c "$bootstrap_vars make deps" | ||
|
||
echo | ||
echo "WARNING: YOU must add this key to the repo host (GitHub)" | ||
cat $user_home/.ssh/id_ed25519.pub | ||
|
||
echo | ||
echo "WARNING: If this agent must be in special queues, don't forget to edit tags in '$user_home/.buildkite-agent/buildkite-agent.cfg'" | ||
|
||
echo | ||
echo "INFO: To start agent run 'launchctl load /Users/$username/Library/LaunchAgents/com.buildkite.buildkite-agent.plist'" |
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,26 @@ | ||
AGENT_KEY_TYPE=ed25519 | ||
BUILDKITE_AGENT_TOKEN ?=xxx | ||
|
||
.PHONY: deps | ||
deps: ~/.ssh/id_$(AGENT_KEY_TYPE) \ | ||
~/.buildkite-agent \ | ||
~/Library/LaunchAgents/com.buildkite.buildkite-agent.plist \ | ||
|
||
|
||
~/.ssh/id_%: | ||
ssh-keygen -t $* -f $@ -P "" | ||
|
||
~/.buildkite-agent: | ||
bash -c "`curl -sL https://raw.githubusercontent.com/buildkite/agent/master/install.sh`" | ||
gsed -i 's/^name="%hostname-%n"/name="%hostname-$(shell id -un)-%n"/g' $@/buildkite-agent.cfg | ||
@gsed -i 's/^token="xxx"/token="$(BUILDKITE_AGENT_TOKEN)"/g' $@/buildkite-agent.cfg | ||
@echo sed -i 's/^token="xxx"/token="REDACTED"/g' $@/buildkite-agent.cfg | ||
touch $@ | ||
|
||
~/Library/LaunchAgents/com.buildkite.buildkite-agent.plist: ~/.buildkite-agent | ||
# Download the launchd config to /Library/LaunchDaemons/ | ||
curl --create-dirs -o $@ https://raw.githubusercontent.com/buildkite/agent/master/templates/launchd_local_with_gui.plist | ||
# Set buildkite-agent to be run as the current user (a full user, created via System Prefs) | ||
sed -i '' "s/your-build-user/$(whoami)/g" $@ | ||
# Create the agent's log directory with the correct permissions | ||
mkdir -p ~/.buildkite-agent/log && chmod 775 ~/.buildkite-agent/log |
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