-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
README, CONTRIBUTING, CI, and other minor things
- Loading branch information
Showing
10 changed files
with
108 additions
and
358 deletions.
There are no files selected for viewing
This file contains 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,54 @@ | ||
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: | | ||
echo $TEMPORAL_TLS_CERT_CONTENT >> client.crt | ||
echo $TEMPORAL_TLS_KEY_CONTENT >> client.key | ||
cat client.crt | ||
go run ./cmd/temporal workflow list --limit 2 |
This file contains 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 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 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 |
---|---|---|
@@ -1,94 +1,8 @@ | ||
(under development) | ||
# Temporal CLI | ||
|
||
To regen command code: | ||
Temporal command-line interface and development server. | ||
|
||
``` | ||
go run ./temporalcli/internal/cmd/gen-commands | ||
``` | ||
⚠️ Under active development and inputs/outputs may change ⚠️ | ||
|
||
Known incompatibilities: | ||
|
||
NOTE: All of these incompatibilities are intentional and almost all decisions can be reverted if decided. | ||
|
||
* Removed `--memo-file` from workflow args | ||
* `--color` not currently implemented everywhere (like for logs) | ||
* Removed paging by default (i.e. basically `--no-pager` behavior) | ||
* Duration arguments require trailing unit (i.e. `--workflow-timeout 5` is now `--workflow-timeout 5s`) | ||
* `--output table` and `--output card` blended to `--output text` (the default), but we may let table options be applied | ||
as separate params | ||
* `TEMPORAL_CLI_SHOW_STACKS` - no stack trace-based errors | ||
* `--tls-ca-path` cannot be a URL | ||
* Not explicitly setting TLS SNI name from host of URL | ||
* JSON output for things like workflow start use more JSON-like field names | ||
* Workflow history JSON not dumped by default as part of `workflow execute` when JSON set | ||
* Concept of `--fields long` is gone, now whether some more verbose fields are emitted is controlled more specifically | ||
* To get accurate workflow result, workflow follows continue as new for `workflow execute` | ||
* Removed the `-f` alias for `--follow` on `workflow show` | ||
* `server start-dev` will reuse the root logger which means: | ||
* Default is text (or "pretty") instead JSON | ||
* No way to set level to "fatal" only | ||
* All panic and fatal logs are just error logs | ||
* Goes to stderr instead of stdout | ||
* `server start-dev --db-filename` no longer auto-creates directory path of 0777 dirs if not present | ||
* `workflow execute` when using `--event-details` (equivalent of `--fields long`) now shows full proto JSON attributes | ||
instead of wrapped partial table | ||
* `workflow start` and `workflow execute` no longer succeeds by default if the workflow exists already, but | ||
`--allow-existing` exists | ||
* The text version of `workflow describe` does not have all the things the JSON version does (and in the past there was | ||
only JSON) | ||
* `workflow list` in JSON now does one object at a time instead of before where it was 100 objects at a time | ||
* `workflow list` in text now does a page at a time before realigning table (sans headers) instead of 100 at a time | ||
* `workflow list` in text no longer includes `--fields long` | ||
* Removed `--context-timeout` since it is confusing when you might want to customize it (can re-add timeout concepts if | ||
needed) | ||
|
||
Known improvements: | ||
|
||
* Cobra (any arg at any place) | ||
* Customize path to env file | ||
* Global log-level customization | ||
* Global json vs text data output customization | ||
* Markdown-based code generation | ||
* Solid test framework | ||
* Added `--input-encoding` to support more payload types (e.g. can support proto JSON and even proto binary) | ||
* Library available for docs team to write doc generator with | ||
* JSON output is reasonable for tool use | ||
* Properly gives failing status code if workflow fails on "execute" but JSON output is set | ||
* `--color` is available to disable any coloring | ||
* Dev server reuses logger meaning it is on stderr by default | ||
* `workflow execute` now streams the event table instead of waiting | ||
* Use shorthand JSON payloads by default on (non-history) JSON output which makes payloads much more readable | ||
* `workflow describe` now doesn't force users to see JSON, there is a non-JSON text form | ||
|
||
Notes about approach taken: | ||
|
||
* Did not spend time trying to improve documentation, so all of the inconsistent documentation remains and should be | ||
cleaned up separately | ||
* Did not spend (much) time trying to completely change behavior or commands | ||
* Compatibility intentionally retained in most reasonable ways | ||
* File-level copyright notices retained on places with DataDog | ||
* Expecting better formatting to come later | ||
|
||
Contribution rules: | ||
|
||
* Follow rules in commands.md | ||
* Refactoring and reuse is welcome | ||
* Avoid package sprawl and complication | ||
* Try to only use logger and printer for output | ||
* Command testing (does not apply to unit tests that are not testing commands) | ||
* Use the command harness (create a new one for each different option if needed) if server not needed, or add new test | ||
to `SharedServerSuite` if server needed | ||
* Name command tests as `Test<CamelCaseCommand>[_<CamelCaseSubCommand>]_<Qualifier>`, e.g. a simple | ||
"temporal server start dev" test may be named `TestServer_StartDev_Simple`. Can test multiple subcommands at once | ||
and `CamelCaseCommand` can just be the parent, e.g. a simple test of different "temporal env" commands may be named | ||
`TestEnv_Simple`. Often the `Qualifier` is just `Simple`. | ||
|
||
TODO: | ||
|
||
* Version via goreleaser | ||
* Env variables | ||
* Workflow show max-field-length? | ||
* Workflow start delay: https://github.com/temporalio/cli/pull/402 | ||
* Enhance task queue describe: https://github.com/temporalio/cli/pull/399 | ||
* Consider having a common dev-server suite for sharing a common dev server across several tests | ||
* Show result in `workflow describe` the same way it's shown in `workflow execute` | ||
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 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 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 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 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 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.