Skip to content

Commit

Permalink
feat: add lint + helm template on all charts
Browse files Browse the repository at this point in the history
  • Loading branch information
David Ragot committed Feb 22, 2024
1 parent ea473b5 commit cfcd635
Show file tree
Hide file tree
Showing 25 changed files with 77 additions and 27 deletions.
3 changes: 2 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core

sources:
Expand Down Expand Up @@ -158,6 +158,7 @@ pre-commit: # Generate the final spec and run all the pre-commit hooks
FOR component IN $(cd ./ee && ls -d */)
BUILD --pass-args ./ee/${component}+pre-commit
END
BUILD --pass-args ./helm/+pre-commit
BUILD --pass-args ./tests/integration+pre-commit

tidy: # Run tidy on all the components
Expand Down
3 changes: 2 additions & 1 deletion components/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT .. AS stack

Expand Down
3 changes: 2 additions & 1 deletion components/fctl/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
Expand Down
3 changes: 2 additions & 1 deletion components/ledger/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS components
Expand Down
2 changes: 1 addition & 1 deletion components/ledger/libs/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core

FROM core+base-image
Expand Down
13 changes: 10 additions & 3 deletions components/operator/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS components
Expand Down Expand Up @@ -142,12 +142,13 @@ generate-docs:

pre-commit:
WAIT
BUILD --pass-args +tidy
BUILD --pass-args +tidy
END
BUILD --pass-args +lint
BUILD --pass-args +generate
BUILD --pass-args +manifests
BUILD --pass-args +helm-update
BUILD --pass-args +helm-validate
BUILD +generate-docs

openapi:
Expand All @@ -157,4 +158,10 @@ tidy:
FROM core+builder-image
COPY --pass-args (+sources/src) /src
WORKDIR /src/components/operator
DO --pass-args stack+GO_TIDY
DO --pass-args stack+GO_TIDY

helm-validate:
FROM core+helm-base
WORKDIR /src
COPY --pass-args (+helm-update/helm) .
DO --pass-args core+HELM_VALIDATE
3 changes: 2 additions & 1 deletion components/payments/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package storage

import (
"context"

"github.com/formancehq/stack/libs/go-libs/bun/bunconnect"
"github.com/formancehq/stack/libs/go-libs/logging"
"github.com/uptrace/bun"
Expand Down
2 changes: 1 addition & 1 deletion components/payments/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ require (
github.com/uptrace/bun v1.1.16
github.com/uptrace/bun/dialect/pgdialect v1.1.16
github.com/uptrace/bun/extra/bundebug v1.1.16
github.com/uptrace/bun/extra/bunotel v1.1.16
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.39.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0
go.opentelemetry.io/otel v1.22.0
Expand Down Expand Up @@ -154,6 +153,7 @@ require (
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
github.com/uptrace/bun/extra/bunotel v1.1.16 // indirect
github.com/uptrace/opentelemetry-go-extra/otellogrus v0.1.21 // indirect
github.com/uptrace/opentelemetry-go-extra/otelsql v0.2.2 // indirect
github.com/uptrace/opentelemetry-go-extra/otelutil v0.1.21 // indirect
Expand Down
3 changes: 2 additions & 1 deletion ee/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT .. AS stack

Expand Down
12 changes: 10 additions & 2 deletions ee/agent/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core

IMPORT ../.. AS stack
Expand Down Expand Up @@ -63,11 +63,13 @@ deploy:
formance-membership-agent ./helm

pre-commit:
BUILD --pass-args +helm-validate
WAIT
BUILD --pass-args +tidy
END
BUILD --pass-args +lint


openapi:
RUN echo "not implemented"

Expand Down Expand Up @@ -104,4 +106,10 @@ tests:
ARG focus
RUN --mount=type=cache,id=gomod,target=$GOPATH/pkg/mod \
--mount=type=cache,id=gobuild,target=/root/.cache/go-build \
ginkgo --focus=$focus ./tests/...
ginkgo --focus=$focus ./tests/...

helm-validate:
FROM core+helm-base
WORKDIR /src
COPY helm .
DO --pass-args core+HELM_VALIDATE
3 changes: 2 additions & 1 deletion ee/auth/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS ee
Expand Down
3 changes: 2 additions & 1 deletion ee/gateway/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS ee
Expand Down
3 changes: 2 additions & 1 deletion ee/orchestration/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
Expand Down
3 changes: 2 additions & 1 deletion ee/reconciliation/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
Expand Down
3 changes: 2 additions & 1 deletion ee/search/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS ee
Expand Down
3 changes: 2 additions & 1 deletion ee/stargate/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS ee
Expand Down
3 changes: 2 additions & 1 deletion ee/wallets/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
Expand Down
3 changes: 2 additions & 1 deletion ee/webhooks/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0

IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS ee
Expand Down
22 changes: 21 additions & 1 deletion helm/Earthfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core
IMPORT .. AS stack

sources:
FROM core+base-image
WORKDIR /src
COPY --dir regions regions
SAVE ARTIFACT /src

helm-validate:
FROM core+helm-base
WORKDIR /src
COPY (stack+sources/out --LOCATION=ee/agent/helm) /src/ee/agent/helm
COPY (stack+sources/out --LOCATION=components/operator/helm) /src/components/operator/helm
WORKDIR /src/helm
COPY . .
FOR chart IN $(ls -d */)
WORKDIR /src/helm
COPY ./$chart $chart
WORKDIR /src/helm/$chart
RUN helm dependency update
DO --pass-args core+HELM_VALIDATE
END


pre-commit:
BUILD --pass-args +helm-validate
2 changes: 1 addition & 1 deletion libs/go-libs/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core

FROM core+base-image
Expand Down
2 changes: 1 addition & 1 deletion releases/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core
IMPORT ./../ AS stack

Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --arg-scope-and-set --pass-args --use-function-keyword 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core

IMPORT ../.. AS stack
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT ../../releases AS releases
Expand Down
2 changes: 1 addition & 1 deletion tools/operator-utils/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION --pass-args --arg-scope-and-set 0.7

ARG core=github.com/formancehq/earthly:v0.10.0
ARG core=github.com/formancehq/earthly:v0.11.0
IMPORT $core AS core
IMPORT ../.. AS stack
IMPORT .. AS components
Expand Down

0 comments on commit cfcd635

Please sign in to comment.