Skip to content

Commit

Permalink
feat: package sftp
Browse files Browse the repository at this point in the history
  • Loading branch information
parikshitg committed Dec 12, 2024
1 parent 82e2126 commit c61252d
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 68 deletions.
65 changes: 11 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,22 @@
# Conduit Connector Template

This is a template project for building [Conduit](https://conduit.io) connectors in Go. It makes it possible to
start working on a Conduit connector in a matter of seconds.
The SFTP connector is one of [Conduit](https://github.com/ConduitIO/conduit) plugins. It
provides both, a source and a destination SFTP connector.

## Quick start
## How to build it

1. Click [_Use this template_](https://github.com/new?template_name=conduit-connector-template&template_owner=ConduitIO) and clone your new repository.
2. Initialize the repository using [`setup.sh`](https://github.com/ConduitIO/conduit-connector-template/blob/main/setup.sh) and commit your changes.
```sh
./setup.sh github.com/myusername/conduit-connector-myconnector
git add -A
git commit -m "initialize repository"
```
3. Set up [automatic Dependabot PR merges](#automatically-merging-dependabot-prs).
Run `make build`.

With that, you're all set up and ready to start working on your connector! As a next step, we recommend that you
check out the [Conduit Connector SDK](https://github.com/ConduitIO/conduit-connector-sdk).
## Testing

## What's included?
Run `make test` to run all the unit and integration tests.

* Skeleton code for the connector's configuration, source and destination.
* Example unit tests.
* A [Makefile](/Makefile) with commonly used targets.
* A [GitHub workflow](/.github/workflows/test.yml) to build the code and run the tests.
* A [GitHub workflow](/.github/workflows/lint.yml) to run a pre-configured set of linters.
* A [GitHub workflow](/.github/workflows/release.yml) which automatically creates a release when a tag is pushed.
* A [Dependabot setup](/.github/dependabot.yml) which checks your dependencies for available updates and
[merges minor version upgrades](/.github/workflows/dependabot-auto-merge-go.yml) automatically.
* [Issue](/.github/ISSUE_TEMPLATE) and [PR templates](/.github/pull_request_template.md).
* A [README template](/README_TEMPLATE.md).
## Source

## Automatically merging Dependabot PRs
### Configuration Options

> [!NOTE]
> This applies only to public connector repositories, as branch protection rules are not enforced in private repositories.
## Destination

The template makes it simple to keep your connector up-to-date using automatic merging of
[Dependabot](https://github.com/dependabot) PRs. To make use of this setup, you need to adjust
some repository settings.
### Configuration Options

1. Navigate to Settings -> General and allow auto-merge of PRs.

![Allow auto-merge](https://github.com/ConduitIO/conduit-connector-template/assets/8320753/695b15f0-85b4-49cb-966d-649e9bf03455)

2. Navigate to Settings -> Branches and add a branch protection rule.

![Add branch protection rule](https://github.com/ConduitIO/conduit-connector-template/assets/8320753/9f5a07bc-d141-42b9-9918-e8d9cc648482)

3. Create a rule for branch `main` that requires status checks `build` and `golangci-lint`.

![Status checks](https://github.com/ConduitIO/conduit-connector-template/assets/8320753/96219185-c329-432a-8623-9b4462015f32)

## Recommended repository settings

- Allow squash merging only.
- Always suggest updating pull request branches.
- Automatically delete head branches.
- Branch protection rules on branch `main` (only in public repositories):
- Require a pull request before merging.
- Require approvals.
- Require status checks `build` and `golangci-lint`.
- Require branches to be up to date before merging.
- Require conversation resolution before merging.
- Do not allow bypassing the above settings.
![scarf pixel](https://static.scarf.sh/a.png?x-pxid=)
14 changes: 14 additions & 0 deletions cmd/connector/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
Expand Down
16 changes: 15 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp

// Config contains shared config parameters, common to the source and
// destination. If you don't need shared parameters you can entirely remove this
Expand Down
16 changes: 15 additions & 1 deletion connector.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp

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

Expand Down
16 changes: 15 additions & 1 deletion destination.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp

//go:generate paramgen -output=paramgen_dest.go DestinationConfig

Expand Down
16 changes: 15 additions & 1 deletion destination_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname_test
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp_test

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion paramgen_dest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion paramgen_src.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion source.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp

//go:generate paramgen -output=paramgen_src.go SourceConfig

Expand Down
16 changes: 15 additions & 1 deletion source_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname_test
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp_test

import (
"context"
Expand Down
27 changes: 21 additions & 6 deletions spec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
package connectorname
// Copyright © 2024 Meroxa, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package sftp

import (
sdk "github.com/conduitio/conduit-connector-sdk"
Expand All @@ -11,10 +25,11 @@ var version = "(devel)"
// Specification returns the connector's specification.
func Specification() sdk.Specification {
return sdk.Specification{
Name: "connectorname",
Summary: "<describe your connector>",
Description: "<describe your connector in detail>",
Version: version,
Author: "<your name>",
Name: "sftp",
Summary: "SFTP source and destination connector.",
Description: "The SFTP connector is one of Conduit plugins. " +
"It provides both, a source and a destination SFTP connector.",
Version: version,
Author: "Meroxa, Inc.",
}
}

0 comments on commit c61252d

Please sign in to comment.