diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f664d18..21fdb84 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @sfc-gh-turbaszek @sfc-gh-jvasquezrojas @sfc-gh-astus +* @sfc-gh-turbaszek @sfc-gh-jvasquezrojas @sfc-gh-astus @sfc-gh-jmartinezramirez @sfc-gh-ecuberojimenez @sfc-gh-asalazarelizondo @sfc-gh-osalazarlizano @sfc-gh-ogarciabarquero @sfc-gh-gvenegascastro @sfc-gh-lcalderonachio diff --git a/.github/workflows/compare-versions-pip-and-pipx.yml b/.github/workflows/compare-versions-pip-and-pipx.yml new file mode 100644 index 0000000..e539298 --- /dev/null +++ b/.github/workflows/compare-versions-pip-and-pipx.yml @@ -0,0 +1,61 @@ +name: compare-versions-pip-and-pipx + +on: + push: + branches: + - '*' + schedule: + - cron: "0 0 * * *" + +jobs: + compare-versions-pip-and-pipx: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest + + name: Install Snowflake CLI in ${{ matrix.os }} with pipx first and then with pip + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install Snowflake CLI with pip + run: | + python -m pip install snowflake-cli + + - name: Store snow version + shell: bash + run: | + snow --version >> version_output.txt + echo "snow_version_pip=$(cat version_output.txt)" >> $GITHUB_ENV + + - name: Install Snowflake CLI with pipx + uses: ./ + id: setup_snowcli + with: + default-config-file-path: '.github/workflows/tests-files/config.toml' + + - name: Compare pipx and pip versions + shell: bash + run: | + snow_version_pipx=$(snow --version) + snow_version_pip="${{ env.snow_version_pip }}" + + if [ "$snow_version_pipx" == "$snow_version_pip" ]; then + echo "The versions match: $snow_version_pipx" + else + echo "The versions do not match: pipx version is $snow_version_pipx, but expected version is $snow_version_pip" + exit 1 + fi + + \ No newline at end of file diff --git a/.github/workflows/install-snowcli-with-pip-first-then-with-pipx-test.yml b/.github/workflows/install-snowcli-with-pip-first-then-with-pipx-test.yml index a0ad794..458983c 100644 --- a/.github/workflows/install-snowcli-with-pip-first-then-with-pipx-test.yml +++ b/.github/workflows/install-snowcli-with-pip-first-then-with-pipx-test.yml @@ -14,19 +14,17 @@ jobs: - ubuntu-latest - windows-latest - env: - SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} - SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} - name: Install Snowflake CLI in ${{ matrix.os }} with pipx first and then with pip steps: - uses: actions/checkout@v4 + with: + persist-credentials: false - uses: actions/setup-python@v5 with: python-version: '3.10' - name: Install Snowflake CLI with pip - run: python -m pip install snowflake-cli-labs + run: python -m pip install snowflake-cli - name: Install Snowflake CLI with pipx uses: ./ diff --git a/.github/workflows/install-snowcli-with-pipx-first-then-with-pip-test.yml b/.github/workflows/install-snowcli-with-pipx-first-then-with-pip-test.yml index cc07787..1a1ba39 100644 --- a/.github/workflows/install-snowcli-with-pipx-first-then-with-pip-test.yml +++ b/.github/workflows/install-snowcli-with-pipx-first-then-with-pip-test.yml @@ -14,13 +14,12 @@ jobs: - ubuntu-latest - windows-latest - env: - SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} - SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} - name: Install Snowflake CLI in ${{ matrix.os }} with pipx first and then with pip steps: - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: actions/setup-python@v5 with: python-version: '3.10' @@ -32,7 +31,7 @@ jobs: default-config-file-path: '.github/workflows/tests-files/config.toml' - name: Install Snowflake CLI with pip - run: python -m pip install snowflake-cli-labs + run: python -m pip install snowflake-cli - name: Test snow installation shell: bash diff --git a/.github/workflows/list-snowflake-account-connections.yml b/.github/workflows/list-snowflake-account-connections.yml index 8c55ae6..0957996 100644 --- a/.github/workflows/list-snowflake-account-connections.yml +++ b/.github/workflows/list-snowflake-account-connections.yml @@ -1,6 +1,11 @@ name: connect-to-snowflake-account-test -on: [push] +on: + push: + branches: + - '*' + schedule: + - cron: "0 0 * * *" jobs: connect-to-snowflake-account-test: @@ -14,21 +19,25 @@ jobs: - ubuntu-latest - windows-latest - env: - SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} - SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} - name: Install Snowflake CLI in ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Snowflake CLI uses: ./ id: setup_snowcli with: default-config-file-path: '.github/workflows/tests-files/config.toml' - - name: Test connection + - name: List connections + env: + SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: 'password' + SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: 'account' shell: bash + run: | snow --version snow connection list + diff --git a/.github/workflows/set-unboud-pipx-variable-test.yml b/.github/workflows/set-unboud-pipx-variable-test.yml index 5e28f50..3457518 100644 --- a/.github/workflows/set-unboud-pipx-variable-test.yml +++ b/.github/workflows/set-unboud-pipx-variable-test.yml @@ -14,20 +14,24 @@ jobs: - windows-latest env: - SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }} - SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }} PIPX_BIN_DIR: null name: Install Snowflake CLI in ${{ matrix.os }} steps: - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Set up Snowflake CLI uses: ./ id: setup_snowcli with: default-config-file-path: '.github/workflows/tests-files/config.toml' - - name: Test connection + - name: List connections + env: + SNOWFLAKE_CONNECTIONS_MYCONNECTION_PASSWORD: 'password' + SNOWFLAKE_CONNECTIONS_MYCONNECTION_ACCOUNT: 'account' shell: bash run: | snow --version diff --git a/action.yml b/action.yml index 7fae161..a88c8bf 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ # action.yml name: 'Install Snowflake CLI' -description: 'Download and install snowflake-cli-labs through pipx' +description: 'Download and install snowflake-cli through pipx' branding: icon: 'terminal' color: 'blue' @@ -18,7 +18,7 @@ inputs: runs: using: 'composite' steps: - - name: Download snowflake-cli-labs ${{ inputs.cli_version }} + - name: Download snowflake-cli ${{ inputs.cli_version }} shell: bash run: bash $GITHUB_ACTION_PATH/scripts/install-snowcli.sh env: diff --git a/scripts/install-snowcli.sh b/scripts/install-snowcli.sh index 3f00007..b96dd1c 100644 --- a/scripts/install-snowcli.sh +++ b/scripts/install-snowcli.sh @@ -2,6 +2,7 @@ set -euo pipefail PIPX_PATH="snow_pipx_path" +PYTHON_PATH=$(python -c "import sys; print(sys.executable)") # These commands ensure that each time `snow` command is executed the system will use # the executable in the pipx installation folder and not in any other installation folder. @@ -12,9 +13,9 @@ mkdir -p "${PIPX_BIN_DIR}" if [ "$CLI_VERSION" == "latest" ]; then - pipx install snowflake-cli + pipx install snowflake-cli --python "$PYTHON_PATH" else - pipx install snowflake-cli=="$CLI_VERSION" + pipx install snowflake-cli=="$CLI_VERSION" --python "$PYTHON_PATH" fi