Skip to content

Commit adad6b5

Browse files
Merge branch 'main' into chasmArchetypeSearchAttributes
2 parents 837318e + 6948310 commit adad6b5

File tree

257 files changed

+11534
-3031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+11534
-3031
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ tdbg
1414
temporal-server
1515
temporal-cassandra-tool
1616
temporal-sql-tool
17+
temporal-elasticsearch-tool

.github/.golangci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ linters:
128128
- name: function-result-limit
129129
arguments:
130130
- 5
131+
- name: struct-tag
132+
arguments:
133+
- "validate,persistence_custom_search_attributes"
131134
- name: unhandled-error
132135
arguments:
133136
- "fmt.*"

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Syntax is here:
22
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
33

4-
* @temporalio/server
4+
* @temporalio/server @temporalio/cgs
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Flaky Tests Report
2+
3+
on:
4+
schedule:
5+
# Run on Wednesdays at noon Eastern time (5 PM UTC)
6+
- cron: '0 17 * * 3'
7+
workflow_dispatch:
8+
inputs:
9+
days:
10+
description: 'Number of days to look back for flaky tests'
11+
required: false
12+
default: '7'
13+
type: string
14+
15+
permissions:
16+
contents: read
17+
actions: read
18+
19+
jobs:
20+
flaky-tests-report:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Generate token
24+
id: generate_token
25+
uses: actions/create-github-app-token@v1
26+
with:
27+
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
28+
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}
29+
owner: ${{ github.repository_owner }}
30+
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Set up Python
37+
uses: actions/setup-python@v5
38+
with:
39+
python-version: '3.13'
40+
41+
- name: Install uv
42+
uses: astral-sh/setup-uv@v4
43+
with:
44+
version: ">=0.8.0"
45+
46+
- name: Install Python dependencies
47+
run: |
48+
cd tools/flakes
49+
uv sync
50+
51+
- name: Install tringa
52+
run: |
53+
uv tool install git+https://github.com/dandavison/tringa@main --force
54+
55+
- name: Run tringa
56+
id: generate-output-file
57+
env:
58+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
59+
DAYS_PARAM: ${{ github.event.inputs.days || '7' }}
60+
run: |
61+
set -euo pipefail
62+
63+
# Create output directory
64+
mkdir -p tools/flakes/out
65+
66+
tringa --json --since-days "$DAYS_PARAM" repo sql \
67+
'select classname, name, count(*) as failure_count, max(artifact) as artifact from test where passed = false and skipped = false group by classname, name order by failure_count desc' \
68+
--branch main \
69+
--workflow-id 80591745 \
70+
https://github.com/temporalio/temporal > tools/flakes/out/out.json
71+
72+
echo "✅ Tringa command completed"
73+
echo "📊 Output file size: $(wc -c < tools/flakes/out/out.json) bytes"
74+
echo "📄 Full output file:"
75+
cat tools/flakes/out/out.json
76+
77+
- name: Run Python script to process flaky tests
78+
id: process-flaky-tests
79+
env:
80+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
81+
RUN_ID: ${{ github.run_id }}
82+
REF_NAME: ${{ github.ref_name }}
83+
SHA: ${{ github.sha }}
84+
run: |
85+
set -x
86+
cd tools/flakes && uv run main.py \
87+
--file out/out.json \
88+
--github-summary \
89+
--slack-webhook "$SLACK_WEBHOOK" \
90+
--run-id "$RUN_ID" \
91+
--ref-name "$REF_NAME" \
92+
--sha "$SHA"
93+
94+
- name: Upload generated reports
95+
uses: actions/upload-artifact@v4
96+
if: steps.process-flaky-tests.outcome == 'success'
97+
with:
98+
name: flaky-tests-reports-${{ github.run_number }}
99+
path: tools/flakes/out/*
100+
retention-days: 30

.github/workflows/run-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ jobs:
252252
key: go-${{ runner.os }}${{ runner.arch }}-build-${{ env.COMMIT }}
253253

254254
- name: Run unit tests
255-
timeout-minutes: 15
255+
timeout-minutes: 20
256256
run: make unit-test-coverage
257257
env:
258258
UNIT_TEST_DIRS: ${{ inputs.unit_test_directory }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@
4141
.spr.yml
4242

4343
/proto.tmp
44+
45+
**/.venv/
46+
**/.ruff_cache/

.goreleaser.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ archives:
88
- temporal-server
99
- temporal-cassandra-tool
1010
- temporal-sql-tool
11+
- temporal-elasticsearch-tool
1112
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
1213
format_overrides:
1314
- goos: windows
@@ -52,6 +53,18 @@ builds:
5253
goarch:
5354
- amd64
5455
- arm64
56+
- id: temporal-elasticsearch-tool
57+
dir: cmd/tools/elasticsearch
58+
binary: temporal-elasticsearch-tool
59+
env:
60+
- CGO_ENABLED=0
61+
goos:
62+
- linux
63+
- darwin
64+
- windows
65+
goarch:
66+
- amd64
67+
- arm64
5568
- id: tdbg
5669
dir: cmd/tools/tdbg
5770
binary: tdbg

Makefile

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
install: bins
44

55
# Rebuild binaries (used by Dockerfile).
6-
bins: temporal-server temporal-cassandra-tool temporal-sql-tool tdbg
6+
bins: temporal-server temporal-cassandra-tool temporal-sql-tool temporal-elasticsearch-tool tdbg
77

88
# Install all tools, recompile proto files, run all possible checks and tests (long but comprehensive).
99
all: clean proto bins check test
@@ -270,6 +270,9 @@ $(STAMPDIR)/protoc-gen-go-helpers-$(GO_API_VER): | $(STAMPDIR) $(LOCALBIN)
270270
@touch $@
271271
$(PROTOC_GEN_GO_HELPERS): $(STAMPDIR)/protoc-gen-go-helpers-$(GO_API_VER)
272272

273+
$(LOCALBIN)/protoc-gen-go-chasm: $(LOCALBIN) cmd/tools/protoc-gen-go-chasm/main.go go.mod go.sum
274+
@go build -o $@ ./cmd/tools/protoc-gen-go-chasm
275+
273276
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
274277
# $1 - target path with name of binary (ideally with version)
275278
# $2 - package url which can be installed
@@ -300,7 +303,7 @@ $(CHASM_BINPB): $(API_BINPB) $(INTERNAL_BINPB) $(CHASM_PROTO_FILES)
300303
@printf $(COLOR) "Generate CHASM proto image..."
301304
@protoc --descriptor_set_in=$(API_BINPB):$(INTERNAL_BINPB) -I=. $(CHASM_PROTO_FILES) -o $@
302305

303-
protoc: $(PROTOGEN) $(MOCKGEN) $(GOIMPORTS) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) $(PROTOC_GEN_GO_HELPERS) $(API_BINPB)
306+
protoc: $(PROTOGEN) $(MOCKGEN) $(GOIMPORTS) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRPC) $(PROTOC_GEN_GO_HELPERS) $(API_BINPB) $(LOCALBIN)/protoc-gen-go-chasm
304307
@go run ./cmd/tools/protogen \
305308
-root=$(ROOT) \
306309
-proto-out=$(PROTO_OUT) \
@@ -309,6 +312,7 @@ protoc: $(PROTOGEN) $(MOCKGEN) $(GOIMPORTS) $(PROTOC_GEN_GO) $(PROTOC_GEN_GO_GRP
309312
-protogen-bin=$(PROTOGEN) \
310313
-goimports-bin=$(GOIMPORTS) \
311314
-mockgen-bin=$(MOCKGEN) \
315+
-protoc-gen-go-chasm-bin=$(LOCALBIN)/protoc-gen-go-chasm \
312316
-protoc-gen-go-bin=$(PROTOC_GEN_GO) \
313317
-protoc-gen-go-grpc-bin=$(PROTOC_GEN_GO_GRPC) \
314318
-protoc-gen-go-helpers-bin=$(PROTOC_GEN_GO_HELPERS) \
@@ -334,6 +338,7 @@ clean-bins:
334338
@rm -f temporal-cassandra-tool
335339
@rm -f tdbg
336340
@rm -f temporal-sql-tool
341+
@rm -f temporal-elasticsearch-tool
337342

338343
temporal-server: $(ALL_SRC)
339344
@printf $(COLOR) "Build temporal-server with CGO_ENABLED=$(CGO_ENABLED) for $(GOOS)/$(GOARCH)..."
@@ -351,6 +356,10 @@ temporal-sql-tool: $(ALL_SRC)
351356
@printf $(COLOR) "Build temporal-sql-tool with CGO_ENABLED=$(CGO_ENABLED) for $(GOOS)/$(GOARCH)..."
352357
CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_TAG_FLAG) -o temporal-sql-tool ./cmd/tools/sql
353358

359+
temporal-elasticsearch-tool: $(ALL_SRC)
360+
@printf $(COLOR) "Build temporal-elasticsearch-tool with CGO_ENABLED=$(CGO_ENABLED) for $(GOOS)/$(GOARCH)..."
361+
CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_TAG_FLAG) -o temporal-elasticsearch-tool ./cmd/tools/elasticsearch
362+
354363
temporal-server-debug: $(ALL_SRC)
355364
@printf $(COLOR) "Build temporal-server-debug with CGO_ENABLED=$(CGO_ENABLED) for $(GOOS)/$(GOARCH)..."
356365
CGO_ENABLED=$(CGO_ENABLED) go build $(BUILD_TAG_FLAG),TEMPORAL_DEBUG -o temporal-server-debug ./cmd/server
@@ -519,22 +528,17 @@ install-schema-postgresql12: temporal-sql-tool
519528
./temporal-sql-tool -u $(SQL_USER) --pw $(SQL_PASSWORD) -p 5432 --pl postgres12 --db $(VISIBILITY_DB) setup-schema -v 0.0
520529
./temporal-sql-tool -u $(SQL_USER) --pw $(SQL_PASSWORD) -p 5432 --pl postgres12 --db $(VISIBILITY_DB) update-schema -d ./schema/postgresql/v12/visibility/versioned
521530

522-
install-schema-es:
531+
install-schema-es: temporal-elasticsearch-tool
523532
@printf $(COLOR) "Install Elasticsearch schema..."
524-
curl --fail -X PUT "http://127.0.0.1:9200/_cluster/settings" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/cluster_settings_v7.json --write-out "\n"
525-
curl --fail -X PUT "http://127.0.0.1:9200/_template/temporal_visibility_v1_template" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/index_template_v7.json --write-out "\n"
526-
# No --fail here because create index is not idempotent operation.
527-
curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_dev" --write-out "\n"
528-
# curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_secondary" --write-out "\n"
533+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 setup-schema
534+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev
529535

530-
install-schema-es-secondary:
536+
install-schema-es-secondary: temporal-elasticsearch-tool
531537
@printf $(COLOR) "Install Elasticsearch schema..."
532-
curl --fail -X PUT "http://127.0.0.1:8200/_cluster/settings" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/cluster_settings_v7.json --write-out "\n"
533-
curl --fail -X PUT "http://127.0.0.1:8200/_template/temporal_visibility_v1_template" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/index_template_v7.json --write-out "\n"
534-
# No --fail here because create index is not idempotent operation.
535-
curl -X PUT "http://127.0.0.1:8200/temporal_visibility_v1_secondary" --write-out "\n"
538+
./temporal-elasticsearch-tool -ep http://127.0.0.1:8200 setup-schema
539+
./temporal-elasticsearch-tool -ep http://127.0.0.1:8200 create-index --index temporal_visibility_v1_secondary
536540

537-
install-schema-xdc: temporal-cassandra-tool
541+
install-schema-xdc: temporal-cassandra-tool temporal-elasticsearch-tool
538542
@printf $(COLOR) "Install Cassandra schema (active)..."
539543
./temporal-cassandra-tool drop -k temporal_cluster_a -f
540544
./temporal-cassandra-tool create -k temporal_cluster_a --rf 1
@@ -554,15 +558,15 @@ install-schema-xdc: temporal-cassandra-tool
554558
./temporal-cassandra-tool -k temporal_cluster_c update-schema -d ./schema/cassandra/temporal/versioned
555559

556560
@printf $(COLOR) "Install Elasticsearch schemas..."
557-
curl --fail -X PUT "http://127.0.0.1:9200/_cluster/settings" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/cluster_settings_v7.json --write-out "\n"
558-
curl --fail -X PUT "http://127.0.0.1:9200/_template/temporal_visibility_v1_template" -H "Content-Type: application/json" --data-binary @./schema/elasticsearch/visibility/index_template_v7.json --write-out "\n"
559-
# No --fail here because create index is not idempotent operation.
560-
curl -X DELETE http://localhost:9200/temporal_visibility_v1_dev_cluster_a
561-
curl -X DELETE http://localhost:9200/temporal_visibility_v1_dev_cluster_b
562-
curl -X DELETE http://localhost:9200/temporal_visibility_v1_dev_cluster_c
563-
curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_dev_cluster_a" --write-out "\n"
564-
curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_dev_cluster_b" --write-out "\n"
565-
curl -X PUT "http://127.0.0.1:9200/temporal_visibility_v1_dev_cluster_c" --write-out "\n"
561+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 setup-schema
562+
# Delete indices if they exist (drop-index fails silently if index doesn't exist)
563+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 drop-index --index temporal_visibility_v1_dev_cluster_a --fail
564+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 drop-index --index temporal_visibility_v1_dev_cluster_b --fail
565+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 drop-index --index temporal_visibility_v1_dev_cluster_c --fail
566+
# Create indices
567+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev_cluster_a
568+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev_cluster_b
569+
./temporal-elasticsearch-tool -ep http://127.0.0.1:9200 create-index --index temporal_visibility_v1_dev_cluster_c
566570

567571
##### Run server #####
568572
DOCKER_COMPOSE_FILES := -f ./develop/docker-compose/docker-compose.yml -f ./develop/docker-compose/docker-compose.$(GOOS).yml
@@ -652,7 +656,7 @@ update-dependencies-major: $(GOMAJOR)
652656

653657
go-generate: $(MOCKGEN) $(GOIMPORTS) $(STRINGER) $(GOWRAP)
654658
@printf $(COLOR) "Process go:generate directives..."
655-
@go generate ./...
659+
@PATH="$(ROOT)/$(LOCALBIN):$(PATH)" go generate ./...
656660

657661
ensure-no-changes:
658662
@printf $(COLOR) "Check for local changes..."

0 commit comments

Comments
 (0)