Skip to content

Commit

Permalink
ci(lint): add trunk linting setup (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
rriski authored Dec 22, 2023
1 parent 472aebd commit 029a687
Show file tree
Hide file tree
Showing 232 changed files with 24,118 additions and 22,233 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@ jobs:
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
golang_ci_linter:
name: golang_ci_linter
trunk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
version: latest
go-version: stable
- uses: trunk-io/trunk-action@v1
codeql_analysis:
runs-on: ubuntu-latest
permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
- uses: BetaHuhn/repo-file-sync-action@v1
with:
GH_PAT: ${{ secrets.AIVEN_CI_PAT__VALID_WHILE_ALEKS_IS_EMPLOYED }}
COMMIT_PREFIX: 'chore:'
COMMIT_PREFIX: "chore:"
8 changes: 8 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
2 changes: 0 additions & 2 deletions .golangci.yml → .trunk/configs/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ issues:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gofmt
- gosimple
Expand All @@ -24,7 +23,6 @@ linters:
- staticcheck
- unconvert
- unused
- varcheck
- vet
- goimports
- gomnd
Expand Down
4 changes: 4 additions & 0 deletions .trunk/configs/.hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091
24 changes: 24 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# MD046/code-block-style
# mkdocs code blocks inside admonitions trip this rule
MD046: false

# MD033/no-inline-html
# allow inline html
MD033: false

# MD036/no-emphasis-as-heading
# allow using **emphasis** as heading
MD036: false

# MD013/line-length
# don't care about line length
MD013: false

# MD051/link-fragments
# mkdocs admonitions and links aren't supported https://github.com/DavidAnson/markdownlint/issues/207
MD051: false

# MD025/single-title/single-h1
# mkdocs renders link titles from YAML frontmatter and renders the content
# title from the first title specified with "#"
MD025: false
11 changes: 11 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed:
- "{|}"
empty-values:
forbid-in-block-mappings: false
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
48 changes: 48 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 0.1

cli:
version: 1.18.1

plugins:
sources:
- id: trunk
uri: https://github.com/trunk-io/plugins
ref: v1.4.1

lint:
enabled:
- [email protected]
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
ignore:
- linters:
- yamllint
- prettier
paths:
- charts/aiven-operator/templates/*.yaml
- linters:
- markdownlint
paths:
- .trunk/**

runtimes:
enabled:
- [email protected]
- [email protected]
- [email protected]

actions:
disabled:
- trunk-announce
enabled:
- commitlint
- trunk-upgrade-available
- trunk-check-pre-push
- trunk-fmt-pre-commit
41 changes: 23 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

## v0.16.1 - 2023-12-15

- Check VPC for running services before deletion. Prevents VPC from hanging in the DELETING state
- Check VPC for running services before deletion. Prevents VPC from hanging in the DELETING state
- Expose `KAFKA_SCHEMA_REGISTRY_URI` and `KAFKA_REST_URI` to `Kafka` secret
- Expose `CONNECTIONPOOL_NAME` in `ConnectionPool` secret
- Fix `CONNECTIONPOOL_PORT` exposes service port instead of pool port
- Fix `CONNECTIONPOOL_PORT` exposes service port instead of pool port
- Fix `SERVICEUSER_PORT` when `sasl` is the only authentication method
- Change `PostgreSQL` field `userConfig.pg_qualstats.enabled`: deprecated
- Change `PostgreSQL` field `userConfig.pg_qualstats.min_err_estimate_num`: deprecated
Expand All @@ -21,7 +21,7 @@
## v0.16.0 - 2023-12-07

- Set conditions on errors: `Preconditions`, `CreateOrUpdate`, `Delete`. Thanks to @atarax
- Fix object updates lost when reconciler exits before the object is committed
- Fix object updates lost when reconciler exits before the object is committed
- Add `Kafka` field `userConfig.kafka.transaction_partition_verification_enable`, type `boolean`: Enable
verification that checks that the partition has been added to the transaction before writing transactional
records to the partition
Expand Down Expand Up @@ -53,7 +53,7 @@

- Upgrade to Go 1.21
- Add option to orphan resources. Thanks to @atarax
- Fix `ServiceIntegration`: do not send empty user config to the API
- Fix `ServiceIntegration`: do not send empty user config to the API
- Add a format for `string` type fields to the documentation
- Generate CRDs changelog
- Add `Clickhouse` field `userConfig.private_access.clickhouse_mysql`, type `boolean`: Allow clients
Expand All @@ -76,7 +76,7 @@
- Add `Kafka` field `userConfig.kafka.sasl_oauthbearer_sub_claim_name`, type `string`: Name of the scope
from which to extract the subject claim from the JWT. Defaults to sub
- Change `Kafka` field `userConfig.kafka_version`: enum ~~`[3.1, 3.3, 3.4, 3.5]`~~ → `[3.1, 3.3, 3.4,
3.5, 3.6]`
3.5, 3.6]`
- Change `Kafka` field `userConfig.tiered_storage.local_cache.size`: deprecated
- Add `OpenSearch` field `userConfig.opensearch.indices_memory_max_index_buffer_size`, type `integer`:
Absolute value. Default is unbound. Doesn't work without indices.memory.index_buffer_size
Expand Down Expand Up @@ -110,7 +110,7 @@
- Add `Kafka` spec property `scheduled_rebalance_max_delay_ms`
- Mark deprecated `Kafka` spec property `remote_log_storage_system_enable`
- Add `KafkaConnect` spec property `scheduled_rebalance_max_delay_ms`
- Add `OpenSearch` spec property `openid`
- Add `OpenSearch` spec property `openid`
- Use updated go client with enhanced retries

## v0.12.3 - 2023-07-13
Expand Down Expand Up @@ -139,7 +139,6 @@
- Add `OpenSearch.spec.userConfig.idp_pemtrustedcas_content` option.
Specifies the PEM-encoded root certificate authority (CA) content for the SAML identity provider (IdP) server verification.


## v0.11.0 - 2023-04-25

- Add `ServiceIntegration` kind `SourceProjectName` and `DestinationProjectName` fields
Expand All @@ -158,16 +157,16 @@
- Add `minumim`, `maximum` validations for `number` type
- Move helm charts to the operator repository
- Add helm charts generator
- Remove `ip_filter` backward compatability
- Remove `ip_filter` backward compatibility
- Fix deletion errors omitted
- Add service integration `clickhouseKafka.tables.data_format-property` enum `RawBLOB` value
- Update OpenSearch `userConfig.opensearch.email_sender_username` validation pattern
- Add Kafka `log_cleaner_min_cleanable_ratio` minimum and maximum validation rules
- Remove Kafka version `3.2`, reached EOL
- Remove PostgreSQL version `10`, reached EOL
- Explicitly delete `ProjectVPC` by `ID` to avoid conflicts
- Explicitly delete `ProjectVPC` by `ID` to avoid conflicts
- Speed up `ProjectVPC` deletion by exiting on `DELETING` status
- Fix missing RBAC permissions to update finalizers for various controllers
- Fix missing RBAC permissions to update finalizers for various controllers
- Refactor `ClickhouseUser` controller
- Mark `ClickhouseUser.spec.project` and `ClickhouseUser.spec.serviceName` as immutable
- Remove deprecated service integration type `signalfx`
Expand Down Expand Up @@ -206,7 +205,7 @@ as native [CRD validation rules](https://kubernetes.io/blog/2022/09/23/crd-valid

- Add Cassandra Kind
- Add Grafana Kind
- Recreate Kafka ACL if modified.
- Recreate Kafka ACL if modified.
Note: Modification of ACL created prior to v0.5.1 won't delete existing instance at Aiven.
It must be deleted manually.
- Fix MySQL webhook
Expand All @@ -216,7 +215,7 @@ as native [CRD validation rules](https://kubernetes.io/blog/2022/09/23/crd-valid
- Remove `never` from choices of maintenance dow
- Add `development` flag to configure logger's behavior
- Add user config generator (see `make generate-user-configs`)
- Add `genericServiceHandler` to generalize service management
- Add `genericServiceHandler` to generalize service management
- Add MySQL Kind

## v0.5.2 - 2022-12-09
Expand Down Expand Up @@ -246,23 +245,29 @@ as native [CRD validation rules](https://kubernetes.io/blog/2022/09/23/crd-valid
## v0.2.0 - 2021-11-17

features:
* add Redis CRD

- add Redis CRD

improvements:
* watch CRDs to reconcile token secrets

- watch CRDs to reconcile token secrets

fixes:
* fix RBACs of KafkaACL CRD

- fix RBACs of KafkaACL CRD

## v0.1.1 - 2021-09-13

improvements:
* update helm installation docs

- update helm installation docs

fixes:
* fix typo in a kafka-connector kuttl test

- fix typo in a kafka-connector kuttl test

## v0.1.0 - 2021-09-10

features:
* initial release

- initial release
30 changes: 15 additions & 15 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand All @@ -60,7 +60,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
<[email protected]>.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand All @@ -116,13 +116,13 @@ the community.

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM --platform=$BUILDPLATFORM golang:1.21 as builder
FROM --platform=$BUILDPLATFORM golang:1.21 AS builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -18,7 +18,7 @@ COPY controllers/ controllers/
ARG TARGETOS
ARG TARGETARCH
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -trimpath \
RUN CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" go build -trimpath \
-ldflags="-s -w -X github.com/aiven/aiven-operator/controllers.version=${VERSION}" \
-a -o manager main.go

Expand Down
Loading

0 comments on commit 029a687

Please sign in to comment.