Skip to content

Commit 0c9dd49

Browse files
sicoylefilintodJoshVanLMyMirelHubmikeee
authored
fix: update main to release branch patches (#4017)
Signed-off-by: Filinto Duran <[email protected]> Signed-off-by: Samantha Coyle <[email protected]> Signed-off-by: joshvanl <[email protected]> Signed-off-by: MyMirelHub <[email protected]> Signed-off-by: Mike Nguyen <[email protected]> Co-authored-by: Filinto Duran <[email protected]> Co-authored-by: joshvanl <[email protected]> Co-authored-by: Mirel Isaj <[email protected]> Co-authored-by: Mike Nguyen <[email protected]>
1 parent de92aa7 commit 0c9dd49

File tree

47 files changed

+319
-191
lines changed

Some content is hidden

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

47 files changed

+319
-191
lines changed

.build-tools/pkg/metadataschema/schema.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type ComponentMetadata struct {
2020
// Version of the component metadata schema.
2121
SchemaVersion string `json:"schemaVersion" yaml:"schemaVersion" jsonschema:"enum=v1"`
2222
// Component type, of one of the allowed values.
23-
Type string `json:"type" yaml:"type" jsonschema:"enum=bindings,enum=state,enum=secretstores,enum=pubsub,enum=workflows,enum=configuration,enum=lock,enum=middleware,enum=crypto,enum=conversation"`
23+
Type string `json:"type" yaml:"type" jsonschema:"enum=bindings,enum=state,enum=secretstores,enum=pubsub,enum=workflows,enum=configuration,enum=lock,enum=middleware,enum=crypto,enum=nameresolution,enum=conversation"`
2424
// Name of the component (without the inital type, e.g. "http" instead of "bindings.http").
2525
Name string `json:"name" yaml:"name"`
2626
// Version of the component, with the leading "v", e.g. "v1".

.github/infrastructure/docker-compose-cassandra.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '2'
22

33
services:
44
cassandra:
5-
image: docker.io/bitnami/cassandra:4.0.1
5+
image: docker.io/bitnami/cassandra:4.1
66
ports:
77
- '7000:7000'
88
- '9042:9042'

bindings/apns/metadata.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ authenticationProfiles:
3333
description: "The APNS private key (P8 file content)"
3434
metadata:
3535
- name: development
36-
type: boolean
36+
type: bool
3737
required: false
3838
description: "The APNS environment is development or not"
39-
example: true
40-
default: false
39+
example: "true"
40+
default: "false"

bindings/gcp/bucket/bucket.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ const (
4747
metadataEncodeBase64 = "encodeBase64"
4848
metadataSignTTL = "signTTL"
4949

50-
metadataKey = "key"
51-
maxResults = 1000
50+
metadataContentType = "contentType"
51+
metadataKey = "key"
52+
maxResults = 1000
5253

5354
metadataKeyBC = "name"
5455
signOperation = "sign"
@@ -77,6 +78,7 @@ type gcpMetadata struct {
7778
TokenURI string `json:"token_uri" mapstructure:"tokenURI" mdignore:"true" mapstructurealiases:"token_uri"`
7879
AuthProviderCertURL string `json:"auth_provider_x509_cert_url" mapstructure:"authProviderX509CertURL" mdignore:"true" mapstructurealiases:"auth_provider_x509_cert_url"`
7980
ClientCertURL string `json:"client_x509_cert_url" mapstructure:"clientX509CertURL" mdignore:"true" mapstructurealiases:"client_x509_cert_url"`
81+
ContentType string `json:"contentType,omitempty" mapstructure:"contentType"`
8082

8183
Bucket string `json:"bucket" mapstructure:"bucket"`
8284
DecodeBase64 bool `json:"decodeBase64,string" mapstructure:"decodeBase64"`
@@ -233,6 +235,12 @@ func (g *GCPStorage) create(ctx context.Context, req *bindings.InvokeRequest) (*
233235
}
234236

235237
h := g.client.Bucket(g.metadata.Bucket).Object(name).NewWriter(ctx)
238+
239+
// Set content type if provided
240+
if metadata.ContentType != "" {
241+
h.ContentType = metadata.ContentType
242+
}
243+
236244
// Cannot do `defer h.Close()` as Close() will flush the bytes and need to have error handling.
237245
if _, err = io.Copy(h, r); err != nil {
238246
cerr := h.Close()
@@ -378,9 +386,15 @@ func (metadata gcpMetadata) mergeWithRequestMetadata(req *bindings.InvokeRequest
378386
if val, ok := req.Metadata[metadataEncodeBase64]; ok && val != "" {
379387
merged.EncodeBase64 = strings.IsTruthy(val)
380388
}
389+
381390
if val, ok := req.Metadata[metadataSignTTL]; ok && val != "" {
382391
merged.SignTTL = val
383392
}
393+
394+
if val, ok := req.Metadata[metadataContentType]; ok && val != "" {
395+
merged.ContentType = val
396+
}
397+
384398
return merged, nil
385399
}
386400

bindings/gcp/bucket/bucket_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,42 @@ func TestMergeWithRequestMetadata(t *testing.T) {
233233
assert.NotNil(t, mergedMeta)
234234
assert.False(t, mergedMeta.EncodeBase64)
235235
})
236+
237+
t.Run("Has merged contentType metadata", func(t *testing.T) {
238+
m := bindings.Metadata{}
239+
m.Properties = map[string]string{
240+
"bucket": "my_bucket",
241+
"projectID": "my_project_id",
242+
"contentType": "text/plain",
243+
}
244+
gs := GCPStorage{logger: logger.NewLogger("test")}
245+
meta, err := gs.parseMetadata(m)
246+
require.NoError(t, err)
247+
assert.Equal(t, "text/plain", meta.ContentType)
248+
249+
// Empty request doesn't override
250+
request := bindings.InvokeRequest{}
251+
request.Metadata = map[string]string{}
252+
mergedMeta, err := meta.mergeWithRequestMetadata(&request)
253+
require.NoError(t, err)
254+
assert.Equal(t, "text/plain", mergedMeta.ContentType)
255+
256+
// Request overrides component
257+
request.Metadata = map[string]string{
258+
"contentType": "text/csv",
259+
}
260+
mergedMeta, err = meta.mergeWithRequestMetadata(&request)
261+
require.NoError(t, err)
262+
assert.Equal(t, "text/csv", mergedMeta.ContentType)
263+
264+
// Empty string doesn't override
265+
request.Metadata = map[string]string{
266+
"contentType": "",
267+
}
268+
mergedMeta, err = meta.mergeWithRequestMetadata(&request)
269+
require.NoError(t, err)
270+
assert.Equal(t, "text/plain", mergedMeta.ContentType)
271+
})
236272
}
237273

238274
func TestInit(t *testing.T) {

bindings/gcp/bucket/metadata.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,12 @@ metadata:
4444
description: |
4545
Configuration to encode base64 file content before return the content.
4646
(In case of saving a file with binary content).
47-
example: '"true, false"'
47+
example: '"true, false"'
48+
- name: contentType
49+
type: string
50+
required: false
51+
description: |
52+
The MIME type of the object being stored. If not specified, GCS will attempt to
53+
auto-detect the type, which may default to application/octet-stream or text/plain.
54+
Common values include text/csv, application/json, image/png, etc.
55+
example: '"text/csv", "application/json"'

bindings/kubemq/metadata.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,20 @@ metadata:
3737
description: The KubeMQ channel name.
3838
example: "my-channel"
3939
- name: pollMaxItems
40-
type: int
40+
type: number
4141
required: false
4242
description: The maximum number of items to poll.
43-
example: 10
44-
default: 1
43+
example: "10"
44+
default: "1"
4545
- name: pollTimeoutSeconds
46-
type: int
46+
type: number
4747
required: false
4848
description: The timeout in seconds for polling.
49-
example: 3600
50-
default: 3600
49+
example: "3600"
50+
default: "3600"
5151
- name: autoAcknowledged
5252
type: bool
5353
required: false
5454
description: Whether to automatically acknowledge messages.
55-
example: true
56-
default: false
55+
example: "true"
56+
default: "false"

bindings/kubernetes/kubernetes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ func (k *kubernetesInput) Read(ctx context.Context, handler bindings.Handler) er
119119
fields.Everything(),
120120
)
121121
resultChan := make(chan EventResponse)
122+
// TODO:
123+
// cache.NewInformer is deprecated: Use NewInformerWithOptions instead.
124+
//nolint:staticcheck
122125
_, controller := cache.NewInformer(
123126
watchlist,
124127
&corev1.Event{},

bindings/mqtt3/metadata.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ metadata:
5050
- name: retain
5151
required: false
5252
description: "Whether to retain messages"
53-
example: false
54-
default: false
53+
example: "false"
54+
default: "false"
5555
- name: cleanSession
5656
required: false
5757
description: "Whether to use clean session"
58-
example: true
59-
default: true
58+
example: "true"
59+
default: "true"
6060
- name: backOffMaxRetries
6161
required: false
6262
description: "Maximum retries for backoff"

bindings/rethinkdb/statechange/metadata.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ authenticationProfiles:
5151
type: bool
5252
required: false
5353
description: Whether to enable TLS encryption.
54-
example: false
55-
default: false
54+
example: "false"
55+
default: "false"
5656
- name: clientCert
5757
type: string
5858
required: true
@@ -75,8 +75,8 @@ metadata:
7575
type: bool
7676
required: false
7777
description: Whether to archive changes to a separate table.
78-
example: false
79-
default: false
78+
example: "false"
79+
default: "false"
8080
- name: timeout
8181
type: string
8282
required: false
@@ -86,13 +86,13 @@ metadata:
8686
type: bool
8787
required: false
8888
description: Whether to use json.Number instead of float64.
89-
example: false
90-
default: false
89+
example: "false"
90+
default: "false"
9191
- name: numRetries
9292
type: number
9393
required: false
9494
description: Number of times to retry queries on connection errors.
95-
example: 3
95+
example: "3"
9696
- name: hostDecayDuration
9797
type: string
9898
required: false
@@ -103,8 +103,8 @@ metadata:
103103
type: bool
104104
required: false
105105
description: Whether to enable opentracing for queries.
106-
example: false
107-
default: false
106+
example: "false"
107+
default: "false"
108108
- name: writeTimeout
109109
type: string
110110
required: false
@@ -119,7 +119,7 @@ metadata:
119119
type: number
120120
required: false
121121
description: Handshake version for RethinkDB."
122-
example: 1
122+
example: "1"
123123
- name: keepAlivePeriod
124124
type: string
125125
required: false
@@ -129,7 +129,7 @@ metadata:
129129
type: number
130130
required: false
131131
description: Maximum number of idle connections."
132-
example: 5
132+
example: "5"
133133
- name: authKey
134134
type: string
135135
required: false
@@ -140,17 +140,17 @@ metadata:
140140
type: number
141141
required: false
142142
description: Initial connection pool capacity."
143-
example: 5
143+
example: "5"
144144
- name: maxOpen
145145
type: number
146146
required: false
147147
description: Maximum number of open connections."
148-
example: 10
148+
example: "10"
149149
- name: discoverHosts
150150
type: bool
151151
required: false
152152
description: Whether to discover hosts."
153-
example: false
153+
example: "false"
154154
- name: nodeRefreshInterval
155155
type: string
156156
required: false

0 commit comments

Comments
 (0)