Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/validate-generated-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: release

on:
push:
tags:
- '*'

permissions:
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Validate Tag Format
run: |
TAG=${GITHUB_REF#refs/tags/}

SV_REGEX="^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$"

if ! [[ $TAG =~ $SV_REGEX ]]; then
echo "$TAG is NOT a valid tag (expected format: v<semver>)"
exit 1
fi

- name: Check Version Consistency
run: |
# Extract tag and remove 'v' prefix if exists
TAG=${GITHUB_REF#refs/tags/}

# Read version from connector.yaml
YAML_VERSION=$(yq e '.specification.version' connector.yaml)

# Compare versions
if [[ "$TAG" != "$YAML_VERSION" ]]; then
echo "Version mismatch detected:"
echo "Git Tag: $TAG"
echo "connector.yaml Version: $YAML_VERSION"
exit 1
fi

- name: Delete Invalid Tag
if: failure()
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const tag = context.ref.replace('refs/tags/', '')
try {
await github.rest.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `tags/${tag}`
})
} catch (error) {
console.log('Error deleting tag:', error)
}

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
args: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 0 additions & 24 deletions .github/workflows/validate-generated-files.yml

This file was deleted.

11 changes: 10 additions & 1 deletion connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate specgen

package postgres

import (
_ "embed"

sdk "github.com/conduitio/conduit-connector-sdk"
)

//go:embed connector.yaml
var specs string

var version = "(devel)"

var Connector = sdk.Connector{
NewSpecification: Specification,
NewSpecification: sdk.YAMLSpecification(specs, version),
NewSource: NewSource,
NewDestination: NewDestination,
}
211 changes: 211 additions & 0 deletions connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
version: "1.0"
specification:
name: postgres
summary: A PostgreSQL source and destination plugin for Conduit.
description: ""
version: (devel)
author: Meroxa, Inc.
source:
parameters:
- name: url
description: URL is the connection string for the Postgres database.
type: string
default: ""
validations:
- type: required
value: ""
- name: cdcMode
description: CDCMode determines how the connector should listen to changes.
type: string
default: auto
validations:
- type: inclusion
value: auto,logrepl
- name: logrepl.autoCleanup
description: |-
LogreplAutoCleanup determines if the replication slot and publication should be
removed when the connector is deleted.
type: bool
default: "true"
validations: []
- name: logrepl.publicationName
description: |-
LogreplPublicationName determines the publication name in case the
connector uses logical replication to listen to changes (see CDCMode).
type: string
default: conduitpub
validations: []
- name: logrepl.slotName
description: |-
LogreplSlotName determines the replication slot name in case the
connector uses logical replication to listen to changes (see CDCMode).
type: string
default: conduitslot
validations: []
- name: logrepl.withAvroSchema
description: |-
WithAvroSchema determines whether the connector should attach an avro schema on each
record.
type: bool
default: "false"
validations: []
- name: sdk.batch.delay
description: Maximum delay before an incomplete batch is read from the source.
type: duration
default: "0"
validations:
- type: greater-than
value: "-1"
- name: sdk.batch.size
description: Maximum size of batch before it gets read from the source.
type: int
default: "0"
validations:
- type: greater-than
value: "-1"
- name: sdk.schema.context.enabled
description: |-
Specifies whether to use a schema context name. If set to false, no schema context name will
be used, and schemas will be saved with the subject name specified in the connector
(not safe because of name conflicts).
type: bool
default: "true"
validations: []
- name: sdk.schema.context.name
description: |-
Schema context name to be used. Used as a prefix for all schema subject names.
If empty, defaults to the connector ID.
type: string
default: ""
validations: []
- name: sdk.schema.extract.key.enabled
description: Whether to extract and encode the record key with a schema.
type: bool
default: "false"
validations: []
- name: sdk.schema.extract.key.subject
description: |-
The subject of the key schema. If the record metadata contains the field
"opencdc.collection" it is prepended to the subject name and separated
with a dot.
type: string
default: key
validations: []
- name: sdk.schema.extract.payload.enabled
description: Whether to extract and encode the record payload with a schema.
type: bool
default: "false"
validations: []
- name: sdk.schema.extract.payload.subject
description: |-
The subject of the payload schema. If the record metadata contains the
field "opencdc.collection" it is prepended to the subject name and
separated with a dot.
type: string
default: payload
validations: []
- name: sdk.schema.extract.type
description: The type of the payload schema.
type: string
default: avro
validations:
- type: inclusion
value: avro
- name: snapshot.fetchSize
description: Snapshot fetcher size determines the number of rows to retrieve at a time.
type: int
default: "50000"
validations: []
- name: snapshotMode
description: SnapshotMode is whether the plugin will take a snapshot of the entire table before starting cdc mode.
type: string
default: initial
validations:
- type: inclusion
value: initial,never
- name: table
description: 'Deprecated: use `tables` instead.'
type: string
default: ""
validations: []
- name: tables
description: |-
Tables is a List of table names to read from, separated by a comma, e.g.:"table1,table2".
Use "*" if you'd like to listen to all tables.
type: string
default: ""
validations: []
destination:
parameters:
- name: url
description: URL is the connection string for the Postgres database.
type: string
default: ""
validations:
- type: required
value: ""
- name: key
description: Key represents the column name for the key used to identify and update existing rows.
type: string
default: ""
validations: []
- name: sdk.batch.delay
description: Maximum delay before an incomplete batch is written to the destination.
type: duration
default: "0"
validations: []
- name: sdk.batch.size
description: Maximum size of batch before it gets written to the destination.
type: int
default: "0"
validations:
- type: greater-than
value: "-1"
- name: sdk.rate.burst
description: |-
Allow bursts of at most X records (0 or less means that bursts are not
limited). Only takes effect if a rate limit per second is set. Note that
if `sdk.batch.size` is bigger than `sdk.rate.burst`, the effective batch
size will be equal to `sdk.rate.burst`.
type: int
default: "0"
validations:
- type: greater-than
value: "-1"
- name: sdk.rate.perSecond
description: Maximum number of records written per second (0 means no rate limit).
type: float
default: "0"
validations:
- type: greater-than
value: "-1"
- name: sdk.record.format
description: |-
The format of the output record. See the Conduit documentation for a full
list of supported formats (https://conduit.io/docs/using/connectors/configuration-parameters/output-format).
type: string
default: opencdc/json
validations: []
- name: sdk.record.format.options
description: |-
Options to configure the chosen output record format. Options are normally
key=value pairs separated with comma (e.g. opt1=val2,opt2=val2), except
for the `template` record format, where options are a Go template.
type: string
default: ""
validations: []
- name: sdk.schema.extract.key.enabled
description: Whether to extract and decode the record key with a schema.
type: bool
default: "true"
validations: []
- name: sdk.schema.extract.payload.enabled
description: Whether to extract and decode the record payload with a schema.
type: bool
default: "true"
validations: []
- name: table
description: Table is used as the target table into which records are inserted.
type: string
default: '{{ index .Metadata "opencdc.collection" }}'
validations: []
Loading
Loading