-
Notifications
You must be signed in to change notification settings - Fork 4.5k
🐙 octavia-cli: package and install script #10823
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
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4031bf6
add jinja templates to package
alafanechere 6c44e80
fix typo in command
alafanechere f3c259b
package and install
alafanechere 5ac0491
revert change on pip install in dockerfile
alafanechere e09a57b
fix typo
alafanechere 520116b
suggest to clone repo
alafanechere fb1897a
improve install
alafanechere 48261e1
improve install instructions
alafanechere d2da68f
improve readme
alafanechere cf1f159
improve readme
alafanechere 3a03a21
add TODO
alafanechere 2a61ab0
check for update
alafanechere 14c4557
improve install.sh
alafanechere 6e6b6f0
revert change on pip install in dockerfile
alafanechere aa86b12
fix exclusion of test in packaging
alafanechere da846a8
fix conflicts
alafanechere f64b857
add pyyaml deps
alafanechere 2343a16
add not implemented info to helps
alafanechere b50c9dd
avoid env var expansions
alafanechere 5cb3206
add emojis to install logs
alafanechere 37702b2
fix readme for docker run command
alafanechere 4bc6e57
Merge branch 'master' into augustin/octavia-cli/docker-packaging
alafanechere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,73 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This install scripts currently only works for ZSH and Bash profiles. | ||
# It creates an octavia alias in your profile bound to a docker run command | ||
|
||
VERSION=dev | ||
|
||
detect_profile() { | ||
if [ "${SHELL#*bash}" != "$SHELL" ]; then | ||
if [ -f "$HOME/.bashrc" ]; then | ||
DETECTED_PROFILE="$HOME/.bashrc" | ||
elif [ -f "$HOME/.bash_profile" ]; then | ||
DETECTED_PROFILE="$HOME/.bash_profile" | ||
fi | ||
elif [ "${SHELL#*zsh}" != "$SHELL" ]; then | ||
if [ -f "$HOME/.zshrc" ]; then | ||
DETECTED_PROFILE="$HOME/.zshrc" | ||
fi | ||
fi | ||
|
||
if [ -z "${DETECTED_PROFILE}" ]; then | ||
echo "🚨 - Cannot install! This scripts only works if you are using one of these profiles: ~/.bashrc, ~/.bash_profile or ~/.zshrc" | ||
exit 1 | ||
else | ||
echo "octavia alias will be added to ${DETECTED_PROFILE}" | ||
fi | ||
} | ||
|
||
check_docker_is_running() { | ||
if ! docker info > /dev/null 2>&1; then | ||
echo "🚨 - This script uses docker, and it isn't running - please start docker and try again!" | ||
exit 1 | ||
fi | ||
} | ||
|
||
delete_previous_alias() { | ||
sed -i'' -e '/^alias octavia=/d' ${DETECTED_PROFILE} | ||
} | ||
|
||
|
||
pull_image() { | ||
docker pull airbyte/octavia-cli:${VERSION} > /dev/null 2>&1 | ||
} | ||
|
||
add_alias() { | ||
echo 'alias octavia="pwd | xargs -I {} docker run --rm -v {}:/home/octavia-project --network host -e AIRBYTE_URL="\${AIRBYTE_URL}" -e AIRBYTE_WORKSPACE_ID="\${AIRBYTE_WORKSPACE_ID}" airbyte/octavia-cli:'${VERSION}'"' >> ~/.zshrc | ||
echo "🐙 - 🎉 octavia alias was added to ${DETECTED_PROFILE} , please open a new terminal window or run source ${DETECTED_PROFILE}" | ||
} | ||
|
||
install() { | ||
pull_image | ||
add_alias | ||
} | ||
|
||
update_or_install() { | ||
if grep -q "^alias octavia=*" ${DETECTED_PROFILE}; then | ||
read -p "❓ - You already have an octavia alias in your profile. Do you want to update? (Y/n)" -n 1 -r | ||
echo # (optional) move to a new line | ||
if [[ $REPLY =~ ^[Yy]$ ]] | ||
then | ||
delete_previous_alias | ||
install | ||
fi | ||
else | ||
install | ||
fi | ||
} | ||
|
||
set -e | ||
check_docker_is_running | ||
detect_profile | ||
set -u | ||
update_or_install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
This file contains hidden or 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 hidden or 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
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 hidden or 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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eux | ||
VERSION=$1 | ||
docker tag airbyte/octavia-cli:dev airbyte/octavia-cli:${VERSION} | ||
docker push airbyte/octavia-cli:${VERSION} |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.