-
Notifications
You must be signed in to change notification settings - Fork 75
Initial CLI rewrite #412
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
Initial CLI rewrite #412
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4e34c90
Work on CLI
cretz c4b1ff6
More implementations and reworking
cretz fcc6137
README, CONTRIBUTING, CI, and other minor things
cretz a4fcf9b
PR-suggested updates
cretz 882fb59
Update go.mod
cretz 34b5863
Use --fail-existing on start
cretz 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,53 @@ | ||
| name: Continuous Integration | ||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| build-test: | ||
| strategy: | ||
| fail-fast: true | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
| include: | ||
| - os: ubuntu-latest | ||
| checkGenCodeTarget: true | ||
| cloudTestTarget: true | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
| with: | ||
| submodules: recursive | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@v4 | ||
| with: | ||
| go-version: '1.21' | ||
|
|
||
| - name: Test | ||
| run: go test -v ./... | ||
|
|
||
| - name: Regen code, confirm unchanged | ||
| if: ${{ matrix.checkGenCodeTarget }} | ||
| run: | | ||
| go run ./temporalcli/internal/cmd/gen-commands | ||
| git diff --exit-code | ||
|
|
||
| - name: Test cloud | ||
| # Only supported in non-fork runs, since secrets are not available in forks | ||
| if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/cli') }} | ||
| env: | ||
| TEMPORAL_ADDRESS: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233 | ||
| TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }} | ||
| TEMPORAL_TLS_CERT: client.crt | ||
| TEMPORAL_TLS_CERT_CONTENT: ${{ secrets.TEMPORAL_CLIENT_CERT }} | ||
| TEMPORAL_TLS_KEY: client.key | ||
| TEMPORAL_TLS_KEY_CONTENT: ${{ secrets.TEMPORAL_CLIENT_KEY }} | ||
| shell: bash | ||
| run: | | ||
| printf '%s\n' "$TEMPORAL_TLS_CERT_CONTENT" >> client.crt | ||
| printf '%s\n' "$TEMPORAL_TLS_KEY_CONTENT" >> client.key | ||
| go run ./cmd/temporal workflow list --limit 2 |
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,25 @@ | ||
| # Contributing | ||
|
|
||
| ## Building | ||
|
|
||
| With the latest `go` version installed, simply run the following: | ||
|
|
||
| go build ./cmd/temporal | ||
|
|
||
| ## Testing | ||
|
|
||
| Uses normal `go test`, e.g.: | ||
|
|
||
| go test ./... | ||
|
|
||
| See other tests for how to leverage things like the command harness and dev server suite. | ||
|
|
||
| ## Adding/updating commands | ||
|
|
||
| First, update [commands.md](temporalcli/commandsmd/commands.md) following the rules in that file. Then to regenerate the | ||
| [commands.gen.go](temporalcli/commands.gen.go) file from code, simply run: | ||
|
|
||
| go run ./temporalcli/internal/cmd/gen-commands | ||
|
|
||
| This will expect every non-parent command to have a `run` method, so for new commands developers will have to implement | ||
| `run` on the new command in a separate file before it will compile. | ||
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,21 @@ | ||
| The MIT License | ||
|
|
||
| Copyright (c) 2024 Temporal Technologies Inc. All rights reserved. | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in | ||
| all copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
| THE SOFTWARE. |
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,8 @@ | ||
| # Temporal CLI | ||
|
|
||
| Temporal command-line interface and development server. | ||
|
|
||
| ⚠️ Under active development and inputs/outputs may change ⚠️ | ||
|
|
||
| See [the documentation](https://docs.temporal.io/cli) for install and usage information. See | ||
| [CONTRIBUTING.md](CONTRIBUTING.md) for build and development information. |
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,13 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/temporalio/cli/temporalcli" | ||
| ) | ||
|
|
||
| func main() { | ||
| ctx, cancel := context.WithCancel(context.Background()) | ||
| defer cancel() | ||
| temporalcli.Execute(ctx, temporalcli.CommandOptions{}) | ||
| } |
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,149 @@ | ||
| module github.com/temporalio/cli | ||
|
|
||
| go 1.21 | ||
|
|
||
| require ( | ||
| github.com/dustin/go-humanize v1.0.1 | ||
| github.com/fatih/color v1.16.0 | ||
| github.com/google/uuid v1.5.0 | ||
| github.com/mattn/go-isatty v0.0.20 | ||
| github.com/olekukonko/tablewriter v0.0.5 | ||
| github.com/spf13/cobra v1.8.0 | ||
| github.com/spf13/pflag v1.0.5 | ||
| github.com/stretchr/testify v1.8.4 | ||
| github.com/temporalio/ui-server/v2 v2.23.0 | ||
| go.temporal.io/api v1.26.2-0.20231129165614-630d88440548 | ||
| go.temporal.io/sdk v1.25.2-0.20231204212658-5fdbecc56c8c | ||
| go.temporal.io/server v1.23.0-rc2.0.20231212000105-51ea367f9f37 | ||
| google.golang.org/grpc v1.61.0 | ||
| google.golang.org/protobuf v1.32.0 | ||
| gopkg.in/yaml.v3 v3.0.1 | ||
| ) | ||
|
|
||
| require ( | ||
| cloud.google.com/go v0.112.0 // indirect | ||
| cloud.google.com/go/compute v1.23.3 // indirect | ||
| cloud.google.com/go/compute/metadata v0.2.3 // indirect | ||
| cloud.google.com/go/iam v1.1.5 // indirect | ||
| cloud.google.com/go/storage v1.36.0 // indirect | ||
| github.com/apache/thrift v0.18.1 // indirect | ||
| github.com/aws/aws-sdk-go v1.44.289 // indirect | ||
| github.com/benbjohnson/clock v1.3.5 // indirect | ||
| github.com/beorn7/perks v1.0.1 // indirect | ||
| github.com/blang/semver/v4 v4.0.0 // indirect | ||
| github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c // indirect | ||
| github.com/cactus/go-statsd-client/v5 v5.0.0 // indirect | ||
| github.com/cenkalti/backoff/v4 v4.2.1 // indirect | ||
| github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
| github.com/coreos/go-oidc/v3 v3.1.0 // indirect | ||
| github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect | ||
| github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect | ||
| github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect | ||
| github.com/felixge/httpsnoop v1.0.4 // indirect | ||
| github.com/go-logr/logr v1.3.0 // indirect | ||
| github.com/go-logr/stdr v1.2.2 // indirect | ||
| github.com/go-sql-driver/mysql v1.5.0 // indirect | ||
| github.com/gocql/gocql v1.5.2 // indirect | ||
| github.com/gogo/protobuf v1.3.2 // indirect | ||
| github.com/golang-jwt/jwt v3.2.2+incompatible // indirect | ||
| github.com/golang-jwt/jwt/v4 v4.5.0 // indirect | ||
| github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect | ||
| github.com/golang/mock v1.7.0-rc.1 // indirect | ||
| github.com/golang/protobuf v1.5.3 // indirect | ||
| github.com/golang/snappy v0.0.4 // indirect | ||
| github.com/google/s2a-go v0.1.7 // indirect | ||
| github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect | ||
| github.com/googleapis/gax-go/v2 v2.12.0 // indirect | ||
| github.com/gorilla/securecookie v1.1.1 // indirect | ||
| github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect | ||
| github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect | ||
| github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect | ||
| github.com/iancoleman/strcase v0.3.0 // indirect | ||
| github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
| github.com/jackc/pgpassfile v1.0.0 // indirect | ||
| github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect | ||
| github.com/jackc/pgx/v5 v5.4.3 // indirect | ||
| github.com/jmespath/go-jmespath v0.4.0 // indirect | ||
| github.com/jmoiron/sqlx v1.3.4 // indirect | ||
| github.com/josharian/intern v1.0.0 // indirect | ||
| github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect | ||
| github.com/labstack/echo/v4 v4.9.1 // indirect | ||
| github.com/labstack/gommon v0.4.0 // indirect | ||
| github.com/lib/pq v1.10.9 // indirect | ||
| github.com/mailru/easyjson v0.7.7 // indirect | ||
| github.com/mattn/go-colorable v0.1.13 // indirect | ||
| github.com/mattn/go-runewidth v0.0.14 // indirect | ||
| github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect | ||
| github.com/olivere/elastic/v7 v7.0.32 // indirect | ||
| github.com/opentracing/opentracing-go v1.2.0 // indirect | ||
| github.com/pborman/uuid v1.2.1 // indirect | ||
| github.com/pkg/errors v0.9.1 // indirect | ||
| github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect | ||
| github.com/prometheus/client_golang v1.16.0 // indirect | ||
| github.com/prometheus/client_model v0.4.0 // indirect | ||
| github.com/prometheus/common v0.44.0 // indirect | ||
| github.com/prometheus/procfs v0.11.0 // indirect | ||
| github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect | ||
| github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect | ||
| github.com/rivo/uniseg v0.4.4 // indirect | ||
| github.com/robfig/cron v1.2.0 // indirect | ||
| github.com/robfig/cron/v3 v3.0.1 // indirect | ||
| github.com/sirupsen/logrus v1.9.3 // indirect | ||
| github.com/stretchr/objx v0.5.0 // indirect | ||
| github.com/temporalio/ringpop-go v0.0.0-20230606200434-b5c079f412d3 // indirect | ||
| github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb // indirect | ||
| github.com/temporalio/tchannel-go v1.22.1-0.20231116015023-bd4fb7678499 // indirect | ||
| github.com/twmb/murmur3 v1.1.8 // indirect | ||
| github.com/uber-common/bark v1.3.0 // indirect | ||
| github.com/uber-go/tally/v4 v4.1.7 // indirect | ||
| github.com/valyala/bytebufferpool v1.0.0 // indirect | ||
| github.com/valyala/fasttemplate v1.2.1 // indirect | ||
| go.opencensus.io v0.24.0 // indirect | ||
| go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect | ||
| go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect | ||
| go.opentelemetry.io/otel v1.21.0 // indirect | ||
| go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 // indirect | ||
| go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.42.0 // indirect | ||
| go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect | ||
| go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect | ||
| go.opentelemetry.io/otel/exporters/prometheus v0.42.0 // indirect | ||
| go.opentelemetry.io/otel/metric v1.21.0 // indirect | ||
| go.opentelemetry.io/otel/sdk v1.21.0 // indirect | ||
| go.opentelemetry.io/otel/sdk/metric v1.19.0 // indirect | ||
| go.opentelemetry.io/otel/trace v1.21.0 // indirect | ||
| go.opentelemetry.io/proto/otlp v1.0.0 // indirect | ||
| go.temporal.io/version v0.3.0 // indirect | ||
| go.uber.org/atomic v1.11.0 // indirect | ||
| go.uber.org/dig v1.17.0 // indirect | ||
| go.uber.org/fx v1.20.0 // indirect | ||
| go.uber.org/multierr v1.11.0 // indirect | ||
| go.uber.org/zap v1.26.0 // indirect | ||
| golang.org/x/crypto v0.18.0 // indirect | ||
| golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect | ||
| golang.org/x/mod v0.14.0 // indirect | ||
| golang.org/x/net v0.20.0 // indirect | ||
| golang.org/x/oauth2 v0.16.0 // indirect | ||
| golang.org/x/sync v0.5.0 // indirect | ||
| golang.org/x/sys v0.16.0 // indirect | ||
| golang.org/x/text v0.14.0 // indirect | ||
| golang.org/x/time v0.5.0 // indirect | ||
| golang.org/x/tools v0.16.0 // indirect | ||
| google.golang.org/api v0.155.0 // indirect | ||
| google.golang.org/appengine v1.6.8 // indirect | ||
| google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect | ||
| google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect | ||
| gopkg.in/inf.v0 v0.9.1 // indirect | ||
| gopkg.in/square/go-jose.v2 v2.6.0 // indirect | ||
| gopkg.in/validator.v2 v2.0.1 // indirect | ||
| lukechampine.com/uint128 v1.3.0 // indirect | ||
| modernc.org/cc/v3 v3.41.0 // indirect | ||
| modernc.org/ccgo/v3 v3.16.14 // indirect | ||
| modernc.org/libc v1.24.1 // indirect | ||
| modernc.org/mathutil v1.5.0 // indirect | ||
| modernc.org/memory v1.6.0 // indirect | ||
| modernc.org/opt v0.1.3 // indirect | ||
| modernc.org/sqlite v1.23.1 // indirect | ||
| modernc.org/strutil v1.1.3 // indirect | ||
| modernc.org/token v1.1.0 // indirect | ||
| ) |
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.