Skip to content

Commit

Permalink
Airbyte-ci: Add path warning to check (#33239)
Browse files Browse the repository at this point in the history
Co-authored-by: Ella Rohm-Ensing <erohmensing@gmail.com>
  • Loading branch information
bnchrch and erohmensing committed Dec 12, 2023
1 parent 34db331 commit b3a3fc0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
##@ Define the default airbyte-ci version
AIRBYTE_CI_VERSION ?= latest

# Detect the operating system
## Detect the operating system
OS := $(shell uname)

tools.airbyte-ci.install: ## Install airbyte-ci
tools.airbyte-ci.install: tools.airbyte-ci.clean tools.airbyte-ci-binary.install tools.airbyte-ci.check

tools.airbyte-ci-binary.install: ## Install airbyte-ci binary
@python airbyte-ci/connectors/pipelines/pipelines/external_scripts/airbyte_ci_install.py ${AIRBYTE_CI_VERSION}

tools.airbyte-ci-dev.install: ## Install the development version of airbyte-ci
tools.airbyte-ci-dev.install: ## Install the local development version of airbyte-ci
@python airbyte-ci/connectors/pipelines/pipelines/external_scripts/airbyte_ci_dev_install.py

tools.airbyte-ci.check: # Check if airbyte-ci is installed correctly
tools.airbyte-ci.check: ## Check if airbyte-ci is installed correctly
@./airbyte-ci/connectors/pipelines/pipelines/external_scripts/airbyte_ci_check.sh

tools.airbyte-ci.clean: ## Clean airbyte-ci installations
Expand All @@ -28,12 +30,12 @@ tools.git-hooks.clean: ## Clean git hooks
@echo "Git hooks removed."

tools.pre-commit.install.Linux:
@echo "Installing pre-commit with pip..."
@echo "Installing pre-commit with pip..."
@pip install --user pre-commit
@echo "Pre-commit installation complete."

tools.pre-commit.install.Darwin:
@echo "Installing pre-commit with brew..."
@echo "Installing pre-commit with brew..."
@brew install pre-commit
@echo "Pre-commit installation complete"

Expand All @@ -42,7 +44,6 @@ tools.pre-commit.setup: tools.airbyte-ci.install tools.pre-commit.install.$(OS)
@pre-commit install --hook-type pre-push
@echo "Pre-push hooks installed."


tools.install: tools.airbyte-ci.install tools.airbyte-ci.check tools.pre-commit.setup
tools.install: tools.airbyte-ci.install tools.pre-commit.setup

.PHONY: tools.install tools.pre-commit.setup tools.airbyte-ci.install tools.airbyte-ci-dev.install tools.airbyte-ci.check tools.airbyte-ci.clean
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail

# Check if airbyte-ci is on the PATH and pointing to the correct location
EXPECTED_PATH="$HOME/.local/bin/airbyte-ci"
AIRBYTE_CI_PATH=$(which airbyte-ci 2>/dev/null)
echo "Checking if airbyte-ci is correctly installed..."

INSTALL_DIR="$HOME/.local/bin"
HUMAN_READABLE_INSTALL_DIR="\$HOME/.local/bin"

# Check that the target directory is on the PATH
# If not print an error message and exit
if ! echo "$PATH" | grep -q "$INSTALL_DIR"; then
echo "The target directory $INSTALL_DIR is not on the PATH"
echo "Check that $HUMAN_READABLE_INSTALL_DIR is part of the PATH"
echo ""
echo "If not, please add 'export PATH=\"$HUMAN_READABLE_INSTALL_DIR:\$PATH\"' to your shell profile"
exit 1
fi

# Check that airbyte-ci is on the PATH
# If not print an error message and exit
if ! which airbyte-ci >/dev/null 2>&1; then
echo "airbyte-ci is not installed"
echo ""
echo "Please run 'make tools.airbyte-ci.install' to install airbyte-ci"
exit 1
fi

EXPECTED_PATH="$INSTALL_DIR/airbyte-ci"
AIRBYTE_CI_PATH=$(which airbyte-ci 2>/dev/null)
if [ "$AIRBYTE_CI_PATH" != "$EXPECTED_PATH" ]; then
echo "airbyte-ci is either not on the PATH or not pointing to $EXPECTED_PATH"
echo "Check that airbyte-ci exists at $HOME/.local/bin and $HOME/.local/bin is part of the PATH"
echo "If it does, try running 'make tools.airbyte-ci.clean', then run 'make tools.airbyte-ci.install' again"
echo "airbyte-ci is not from the expected install location: $EXPECTED_PATH"
echo "airbyte-ci is installed at: $AIRBYTE_CI_PATH"
echo "Check that airbyte-ci exists at $HUMAN_READABLE_INSTALL_DIR and $HUMAN_READABLE_INSTALL_DIR is part of the PATH"
echo ""
echo "If it is, try running 'make tools.airbyte-ci.clean', then run 'make tools.airbyte-ci.install' again"
exit 1
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,4 @@ while pyenv whence --path airbyte-ci >/dev/null 2>&1; do
done
echo "All airbyte-ci references removed from pyenv versions."


echo "Cleanup completed."
echo ""
echo "Please run 'make tools.airbyte-ci.install' to install airbyte-ci again"

echo "Cleanup of airbyte-ci install completed."

0 comments on commit b3a3fc0

Please sign in to comment.