Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Amazon SQS Connector #1

Merged
merged 24 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Define code owners (individuals or teams that are responsible for code in this repository)
# More about code owners at https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
* @ConduitIO/conduit-core
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/1-feature-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: 🚀 Feature Request
description: Request a new feature.
title: "Feature: <title>"
labels: [feature, triage]
body:
- type: textarea
attributes:
label: Feature description
description: A clear and concise description of what you want to happen and what problem will this solve.
validations:
required: true
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/2-bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 🐛 Bug
description: Report a bug.
title: "Bug: <title>"
labels: [bug, triage]
body:
- type: textarea
attributes:
label: Bug description
description: A concise description of what you're experiencing and what you expected to happen instead.
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: input
attributes:
label: Version
description: "Version of connector"
placeholder: v0.1.0 darwin/amd64
validations:
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: true
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Docs: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates
version: 2
updates:

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: ".github:"

# Maintain dependencies for Go
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
hariso marked this conversation as resolved.
Show resolved Hide resolved
commit-message:
prefix: "go.mod:"
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Description

Please include a summary of the change and what type of change it is (new feature, bug fix, refactoring, documentation).
Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

### Quick checks:

- [ ] There is no other [pull request](https://github.com/conduitio/conduit-connector-connectorname/pulls) for the same update/change.
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
- [ ] I have written unit tests.
- [ ] I have made sure that the PR is of reasonable size and can be easily reviewed.
20 changes: 20 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: build

on:
push:
branches: [ main ]
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved

- name: Test
run: make test"
39 changes: 39 additions & 0 deletions .github/workflows/dependabot-auto-merge-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This action automatically merges dependabot PRs that update go dependencies (only patch and minor updates).
# Based on: https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request

name: Dependabot auto-merge
on:
pull_request:
# Run this action when dependabot labels the PR, we care about the 'go' label.
types: [labeled]

permissions:
pull-requests: write
contents: write

jobs:
dependabot-go:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && contains(github.event.pull_request.labels.*.name, 'go') }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Approve PR
# Approve only patch and minor updates
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Enable auto-merge for Dependabot PRs
# Enable auto-merging only for patch and minor updates
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 19 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: lint

on:
push:
branches: [ main ]
pull_request:

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: golangci-lint
uses: golangci/golangci-lint-action@v3

lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
33 changes: 33 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release

on:
push:
tags:
- v*

permissions:
contents: write

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

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.20'

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40 changes: 10 additions & 30 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ linters-settings:
min-complexity: 20
goconst:
ignore-tests: true
goheader:
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
template-path: '.golangci.goheader.template'
values:
regexp:
copyright-year: 20[2-9]\d
authors: Meroxa\, Inc\.( \& Yalantis)?
lll:
line-length: 120

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
Expand All @@ -43,11 +35,12 @@ linters:
- gocritic
- gocyclo
# - cyclop # not interested in package complexities at the moment
- godot
# - godot
- gofmt
# - gofumpt
- goheader
- goimports
- revive
# - revive # lots of unused parameters in the template, would be helpful for the user to keep them
# - gomnd
- gomoddirectives
- gomodguard
Expand All @@ -58,21 +51,21 @@ linters:
# - ifshort
- ineffassign
# - importas
- lll
# - lll
# - misspell
- makezero
# - nakedret
# - nilerr
# - nilnil
- nlreturn
# - nlreturn
- noctx
- nolintlint
# - paralleltest
- predeclared
- rowserrcheck
# - rowserrcheck
- staticcheck
- stylecheck
- sqlclosecheck
# - sqlclosecheck
# - tagliatelle
# - tenv
# - thelper
Expand All @@ -81,20 +74,7 @@ linters:
- unconvert
# - unparam
- unused
- wastedassign
# - wastedassign
- whitespace
# - wrapcheck
# - wsl

# don't enable:
# - asciicheck
# - dupl
# - gochecknoglobals
# - gocognit
# - godox
# - goerr113
# - maligned
# - nestif
# - prealloc
# - testpackage
# - wsl
# - wrapcheck
# - wsl
19 changes: 10 additions & 9 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
builds:
- main: ./cmd/sqs/main.go
- main: ./cmd/connector/main.go
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
goos:
- darwin
- linux
- windows
env:
- CGO_ENABLED=0
ldflags:
- "-s -w -X 'github.com/conduitio-labs/conduit-connector-amazon-sqs.version={{ .Tag }}'"
- "-s -w -X 'github.com/conduitio/conduit-connector-connectorname.version={{ .Tag }}'"
lovromazgon marked this conversation as resolved.
Show resolved Hide resolved
checksum:
name_template: checksums.txt
archives:
- replacements:
darwin: Darwin
linux: Linux
windows: Windows
386: i386
amd64: x86_64
- name_template: >-
{{ .ProjectName }}_
{{- .Version }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
changelog:
sort: asc
use: github
Expand All @@ -26,4 +27,4 @@ changelog:
- '^test:'
- '^go.mod:'
- '^.github:'
- Merge branch
- Merge branch
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
GOLANG_CI_LINT_VER := v1.54.2
VERSION := v0.1.0-dev

VERSION=$(shell git describe --tags --dirty --always)
.PHONY:
build:
go build -ldflags "-X 'github.com/meroxa/conduit-connector-amazon-sqs.version=${VERSION}'" -o conduit-connector-amazon-sqs cmd/sqs/main.go
Expand All @@ -11,8 +9,11 @@ test:

.PHONY: golangci-lint-install
golangci-lint-install:
go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANG_CI_LINT_VER)
go install github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY:
lint:
golangci-lint run -c .golangci.yml

install-paramgen:
go install github.com/conduitio/conduit-connector-sdk/cmd/paramgen@latest
2 changes: 1 addition & 1 deletion cmd/sqs/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
sqs "github.com/conduitio-labs/conduit-connector-sqs"
sdk "github.com/conduitio/conduit-connector-sdk"
sqs "github.com/meroxa/conduit-connector-amazon-sqs"
)

func main() {
Expand Down
42 changes: 0 additions & 42 deletions config/config.go
Original file line number Diff line number Diff line change
@@ -1,43 +1 @@
package config

type Config struct {
AWSAccessKeyID string `json:"aws.accessKeyId" validate:"required"`
AWSSecretAccessKey string `json:"aws.secretAccessKey" validate:"required"`
AWSToken string `json:"aws.token"`
AWSQueue string `json:"aws.queue" validate:"required"`
}

const (
ConfigKeyAWSAccessKeyID = "aws.accessKeyId"

ConfigKeyAWSSecretAccessKey = "aws.secretAccessKey"

ConfigKeyAWSToken = "aws.token"

ConfigKeyAWSQueue = "aws.queue"
)

func ParseConfig(cfg map[string]string) (Config, error) {
var parsed Config
key, ok := cfg[ConfigKeyAWSAccessKeyID]
if ok {
parsed.AWSAccessKeyID = key
}

secret, ok := cfg[ConfigKeyAWSSecretAccessKey]
if ok {
parsed.AWSSecretAccessKey = secret
}

token, ok := cfg[ConfigKeyAWSToken]
if ok {
parsed.AWSToken = token
}

queue, ok := cfg[ConfigKeyAWSQueue]
if ok {
parsed.AWSQueue = queue
}

return parsed, nil
}
Loading
Loading