-
Notifications
You must be signed in to change notification settings - Fork 446
feat(cli): update quickstarts with package manager support, e2e tests for quickstarts #2801
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
18 commits
Select commit
Hold shift + click to select a range
469a55f
update quickstarts and add e2e tests for quickstarts
abelanger5 9d08da4
remove healthcheck
abelanger5 a78e243
simplify workflow
abelanger5 8daba6b
fix: non-tty environments for image pull
abelanger5 956371b
increase timeout
abelanger5 9d30b7d
increase timeout for preCmds, keep timeout for cmd
abelanger5 8b743a4
update tls probe to auto-detect tls
abelanger5 9676608
fix image pull race condition
abelanger5 83dac20
dockerfiles and builds
abelanger5 7630dae
fix: dockerfile for bun/yarn
abelanger5 a98c435
rename scripts to triggers, add manual trigger option
abelanger5 dd2371f
fix: poetry dockerfile
abelanger5 52a8504
fix: self-review comments
abelanger5 0e6bbf3
update readme to include CLI
abelanger5 068a204
minor readme fix
abelanger5 12fecff
minor rename
abelanger5 b15bb40
docs link
abelanger5 5894c16
add triggers to e2e tests, simple trigger for go + typescript
abelanger5 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| name: cli-e2e-tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "cmd/hatchet-cli/cli/templates/**" | ||
| - "cmd/hatchet-cli/cli/quickstart.go" | ||
| - "cmd/hatchet-cli/cli/internal/templater/**" | ||
| - "cmd/hatchet-cli/cli/quickstart_e2e_test.go" | ||
| - ".github/workflows/test-templates.yml" | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - "cmd/hatchet-cli/cli/templates/**" | ||
| - "cmd/hatchet-cli/cli/quickstart.go" | ||
| - "cmd/hatchet-cli/cli/internal/templater/**" | ||
| - "cmd/hatchet-cli/cli/quickstart_e2e_test.go" | ||
|
|
||
| jobs: | ||
| test-templates: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.11" | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "20" | ||
|
|
||
| - name: Install Poetry | ||
| run: pipx install poetry | ||
|
|
||
| - name: Install uv | ||
| run: pip install uv | ||
|
|
||
| - name: Install pnpm | ||
| run: npm install -g pnpm | ||
|
|
||
| - name: Install Yarn | ||
| run: npm install -g yarn | ||
|
|
||
| - name: Install Bun | ||
| uses: oven-sh/setup-bun@v1 | ||
|
|
||
| - name: Build CLI | ||
| run: | | ||
| cd cmd/hatchet-cli | ||
| go build -o hatchet-cli | ||
| sudo mv hatchet-cli /usr/local/bin/hatchet | ||
| hatchet --version | ||
|
|
||
| - name: Start Hatchet server | ||
| run: | | ||
| echo "Starting Hatchet server (this will wait until healthy)..." | ||
| hatchet server start --profile local --dashboard-port 8080 | ||
|
|
||
| echo "Hatchet server is ready!" | ||
|
|
||
| - name: Verify local profile was created | ||
| run: | | ||
| hatchet profile list | ||
|
|
||
| - name: Run template E2E tests | ||
| run: | | ||
| cd cmd/hatchet-cli/cli | ||
| go test -tags e2e_cli -run TestQuickstartTemplates -v -timeout 15m | ||
| env: | ||
| # Ensure tests don't try to interact with stdin | ||
| CI: true | ||
|
|
||
| - name: Show server logs on failure | ||
| if: failure() | ||
| run: | | ||
| echo "=== Hatchet Container Logs ===" | ||
| docker logs hatchet-cli-hatchet-1 2>&1 || echo "Could not get hatchet container logs" | ||
| echo "" | ||
| echo "=== Postgres Container Logs ===" | ||
| docker logs hatchet-cli-postgres-1 2>&1 || echo "Could not get postgres container logs" | ||
| echo "" | ||
| echo "=== All Containers ===" | ||
| docker ps -a | ||
|
|
||
| - name: Cleanup | ||
| if: always() | ||
| run: | | ||
| # Stop Hatchet server (this will stop the containers) | ||
| hatchet server stop --profile local || true | ||
|
|
||
| # Cleanup any remaining docker containers | ||
| docker ps -q --filter "label=com.docker.compose.project=hatchet-cli" | xargs -r docker stop || true | ||
| docker ps -aq --filter "label=com.docker.compose.project=hatchet-cli" | xargs -r docker rm || true |
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
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,30 @@ | ||
| package cli | ||
|
|
||
| import ( | ||
| "github.com/rs/zerolog" | ||
|
|
||
| "github.com/hatchet-dev/hatchet/pkg/client" | ||
| profileconfig "github.com/hatchet-dev/hatchet/pkg/config/cli" | ||
| clientconfig "github.com/hatchet-dev/hatchet/pkg/config/client" | ||
| "github.com/hatchet-dev/hatchet/pkg/config/shared" | ||
| ) | ||
|
|
||
| // NewClientFromProfile creates a new Hatchet client from a profile configuration. | ||
| // It properly handles TLS settings, host/port, and authentication based on the profile. | ||
| func NewClientFromProfile(profile *profileconfig.Profile, logger *zerolog.Logger) (client.Client, error) { | ||
| // Construct a ClientConfigFile from the profile | ||
| configFile := &clientconfig.ClientConfigFile{ | ||
| TenantId: profile.TenantId, | ||
| Token: profile.Token, | ||
| HostPort: profile.GrpcHostPort, | ||
| ServerURL: profile.ApiServerURL, | ||
| TLS: clientconfig.ClientTLSConfigFile{ | ||
| Base: shared.TLSConfigFile{ | ||
| TLSStrategy: profile.TLSStrategy, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| // Create client with the config file and logger | ||
| return client.NewFromConfigFile(configFile, client.WithLogger(logger)) | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.