Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,29 @@ about: Create a report to help us improve
title: Unexpected output while running command
labels: bug
assignees: ''

---

## Background Info

Please complete the following information

- OS: [e.g. MacOS Ventura 13.6.7]
- Browser [e.g. chrome, safari]
- CLI Version [e.g. Result of `pinecone version`]
- OS: [e.g. MacOS Ventura 13.6.7]
- Browser [e.g. chrome, safari]
- CLI Version [e.g. Result of `pc version`]
- How did you install the CLI? (e.g. Homebrew, download from release page, compiled from source, etc)

## Reproduction steps

What commands were you running when the problem occurred? Please be as specific as possible. A copy paste of the commands used, obfuscating any sensitive personal information, is preferred.

## Expected behavior

What were you expecting to happen?

## Screenshots
For most things, a paste of the CLI output text is preferred. But if a screenshot will help illustrate the problem, please add one here.
## Screenshots

For most things, a paste of the CLI output text is preferred. But if a screenshot will help illustrate the problem, please add one here.

## Additional context

Add any other context about the problem here.
70 changes: 35 additions & 35 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@
- main

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Run tests
run: go test -v ./...
goreleaser-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: build --snapshot --clean
- uses: actions/upload-artifact@v4
with:
name: pinecone_snapshot_${{ github.sha}}_macos
path: dist/pinecone_darwin_amd64_v1/pinecone
if-no-files-found: error
retention-days: 7
compression-level: 0
overwrite: true
tests:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's not actually that much changing in these workflow files, there was just extra indention I wanted to back out.

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Run tests
run: go test -v ./...

goreleaser-build:
Comment thread Fixed
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: '~> v2'
args: build --snapshot --clean
- uses: actions/upload-artifact@v4
with:
name: pc_snapshot_${{ github.sha}}_macos
path: dist/pc_darwin_amd64_v1/pc
if-no-files-found: error
retention-days: 7
compression-level: 0
overwrite: true
Comment thread Fixed
66 changes: 33 additions & 33 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,37 @@
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Setup Google service account creds
id: setup-google
run: |
echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_CREDS_JSON_BASE64 }}" | base64 -d > /tmp/gcp_key.json
- name: Run GoReleaser
id: goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: "/tmp/gcp_key.json"
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}

- name: Trigger update-dev-formula workflow
run: |
version=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r ".version")
echo "Version is $version"
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
- name: Setup Google service account creds
id: setup-google
run: |
echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT_CREDS_JSON_BASE64 }}" | base64 -d > /tmp/gcp_key.json
- name: Run GoReleaser
id: goreleaser
uses: goreleaser/goreleaser-action@v6
with:
version: '~> v2'
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: '/tmp/gcp_key.json'
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}

curl -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: bearer ${{ secrets.JEN_PAT }}" \
https://api.github.com/repos/pinecone-io/homebrew-pinecone/actions/workflows/update-dev-formula.yaml/dispatches \
-d "{\"ref\": \"main\", \"inputs\": {\"version\":\"$version\"}}"
- name: Trigger update-dev-formula workflow
run: |
version=$(echo '${{ steps.goreleaser.outputs.metadata }}' | jq -r ".version")
echo "Version is $version"

curl -L -X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: bearer ${{ secrets.JEN_PAT }}" \
https://api.github.com/repos/pinecone-io/homebrew-pinecone/actions/workflows/update-dev-formula.yaml/dispatches \
-d "{\"ref\": \"main\", \"inputs\": {\"version\":\"$version\"}}"
Comment thread Fixed
15 changes: 9 additions & 6 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

version: 2

project_name: pinecone
project_name: pc

before:
hooks:
Expand All @@ -13,8 +13,8 @@ before:
builds:
- env:
- CGO_ENABLED=0
main: ./cmd/pinecone
binary: pinecone
main: ./cmd/pc
binary: pc
ldflags:
- -X github.com/pinecone-io/cli/internal/build.Date={{.Date}}
- -X github.com/pinecone-io/cli/internal/build.Commit={{.Commit}}
Expand All @@ -27,7 +27,7 @@ builds:
# This basically staples the two mac binaries together so users don't
# have to make a decision about which one they need.
universal_binaries:
- replace: true
- replace: true

archives:
- format: tar.gz
Expand Down Expand Up @@ -78,9 +78,12 @@ brews:
commit_author:
name: goreleaserbot
email: bot@goreleaser.com
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
commit_msg_template: "Brew formula update for pinecone version {{ .Tag }}"
skip_upload: auto
directory: Formula
license: "Apache-2.0"
test: |
system "#{bin} --help"
system "#{bin}/pc --help"
install: |
bin.install "pc"
bin.install_symlink "pc" => "pinecone"
44 changes: 23 additions & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pinecone CLI

`pinecone` is Pinecone on the command line. See the [Pinecone CLI PRD](https://www.notion.so/PRD-Pinecone-CLI-59fda5da83bc4e3a8593b74056914cd1?pm=c)
`pc` is Pinecone on the command line. See the [Pinecone CLI PRD](https://www.notion.so/PRD-Pinecone-CLI-59fda5da83bc4e3a8593b74056914cd1?pm=c)

## Building the CLI

Expand All @@ -21,43 +21,43 @@ goreleaser build --single-target --snapshot --clean
For manual testing in development, you can run commands like this

```shell
./dist/pinecone_darwin_arm64/pinecone login
./dist/pinecone_darwin_arm64/pinecone index list
./dist/pc_darwin_arm64/pc login
./dist/pc_darwin_arm64/pc index list
# etc
```

## Usage

```shell
# See help
./dist/pinecone_darwin_arm64/pinecone --help
./dist/pc_darwin_arm64/pc --help

# Set authorization credentials - set an API key directly, or log in via the OAuth flow
./dist/pinecone_darwin_arm64/pinecone config set-api-key
./dist/pinecone_darwin_arm64/pinecone login
./dist/pc_darwin_arm64/pc config set-api-key
./dist/pc_darwin_arm64/pc login

# Check currently configured API key
./dist/pinecone_darwin_arm64/pinecone config get-api-key
./dist/pc_darwin_arm64/pc config get-api-key

# Do index operations
./dist/pinecone_darwin_arm64/pinecone index --help
./dist/pc_darwin_arm64/pc index --help

# Create serverless indexes.
./dist/pinecone_darwin_arm64/pinecone index create-serverless --help
./dist/pinecone_darwin_arm64/pinecone index create-serverless --name example-index --dimension 1536 --metric cosine --cloud aws --region us-west-2
./dist/pinecone_darwin_arm64/pinecone index create-serverless --name="example-index" --dimension=1536 --metric="cosine" --cloud="aws" --region="us-west-2"
./dist/pinecone_darwin_arm64/pinecone index create-serverless -n example-index -d 1536 -m cosine -c aws -r us-west-2
./dist/pc_darwin_arm64/pc index create-serverless --help
./dist/pc_darwin_arm64/pc index create-serverless --name example-index --dimension 1536 --metric cosine --cloud aws --region us-west-2
./dist/pc_darwin_arm64/pc index create-serverless --name="example-index" --dimension=1536 --metric="cosine" --cloud="aws" --region="us-west-2"
./dist/pc_darwin_arm64/pc index create-serverless -n example-index -d 1536 -m cosine -c aws -r us-west-2

# Describe index
./dist/pinecone_darwin_arm64/pinecone index describe --name "example-index"
./dist/pinecone_darwin_arm64/pinecone index describe --name "example-index" --json
./dist/pc_darwin_arm64/pc index describe --name "example-index"
./dist/pc_darwin_arm64/pc index describe --name "example-index" --json

# List indexes
./dist/pinecone_darwin_arm64/pinecone index list
./dist/pinecone_darwin_arm64/pinecone index list --json
./dist/pc_darwin_arm64/pc index list
./dist/pc_darwin_arm64/pc index list --json

# Delete index
./dist/pinecone_darwin_arm64/pinecone index delete --name "example-index"
./dist/pc_darwin_arm64/pc index delete --name "example-index"
```

## Troubleshooting
Expand All @@ -66,9 +66,10 @@ Some facts that could be useful:

- Configuration files are stored in `~/.config/pinecone`
- You can enable debug output with the `PINECONE_LOG_LEVEL=DEBUG` env var
- Are you pointed at the correct environment? The current value of the environment setting (i.e. prod or staging) is controlled through `pinecone config set-environment staging` is not clearly surfaced through the printed output. If things aren't working as you expect, you might be pointed in the wrong place. See `cat ~/.config/pinecone/config.yaml` to confirm.
- Are you pointed at the correct environment? The current value of the environment setting (i.e. prod or staging) is controlled through `pc config set-environment staging` is not clearly surfaced through the printed output. If things aren't working as you expect, you might be pointed in the wrong place. See `cat ~/.config/pinecone/config.yaml` to confirm.

## Making a Pull Request

Please fork this repo and make a PR with your changes. Run `gofmt` and `goimports` on all proposed
code changes. Code that does not adhere to these formatters will not be merged.

Expand All @@ -90,8 +91,8 @@ gorelaser build --clean --snapshot
# Look at what version tags have previously been used
git tag --list

# Based on the previous history and the nature of the
# new stuff in the code you are releasing, choose a
# Based on the previous history and the nature of the
# new stuff in the code you are releasing, choose a
# tag that makes sense for the next version.
#
# The tag must start with "v" to trigger the CI stuff.
Expand All @@ -104,6 +105,7 @@ git push --tags
From there, everything happens in this [publish workflow](https://github.com/pinecone-io/cli/actions/workflows/publish.yaml) which is using [goreleaser](https://goreleaser.com/) to handle the process of building binaries for different platforms, packing them into archives, publishing those artifacts on github, and updating our homebrew formula so those updates are easily installable on mac. In the future this will probably expand to cover more forms of distribution. If anything breaks down in this process, the `.goreleaser.yaml` file is probably where your attention will be needed but so far it has been very reliable.

Within a few minutes of pushing tags, you should see:

- A new update to the [Releases page](https://github.com/pinecone-io/cli/releases) with built artifacts attached. If you want to be fancy, you can edit the text there to give a more narrative overview of what is in the release. But for these early iterations we're just pushing and shipping without a lot of ceremony.
- Updates to to the [Homebrew tap](https://github.com/pinecone-io/homebrew-tap) should happen automatically

Expand All @@ -112,4 +114,4 @@ To consume the update from Homebrew (assuming they have previously installed it
```sh
brew update
brew upgrade pinecone
```
```
Loading