-
Notifications
You must be signed in to change notification settings - Fork 130
feat: add DST setup #879
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
Open
altitude
wants to merge
73
commits into
main
Choose a base branch
from
feat/dst
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add DST setup #879
Changes from 67 commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
f66f8e2
test: add antithesis test
gfyrag df41f3d
chore: some test
gfyrag eead415
feat: first workable setup
gfyrag 3b91230
Merge branch 'main' of github.com:formancehq/ledger into feat/dst
altitude 24c347a
wip: bring up to date and new driver
altitude 0addc57
fix: test composer changes
altitude dc15569
Merge branch 'main' of github.com:formancehq/ledger into feat/dst
altitude d64d1ef
wip: improve assertions
altitude 32759cc
fix: overly ambitious assertions
altitude a380c0b
wip: add debugger
altitude b22e498
Merge remote-tracking branch 'origin/main' into feat/dst
altitude 0919823
feat: add antithesis ci
altitude 8aa8fb7
fix: antithesis registry docker login
altitude 6d3747a
fix: antithesis docker login
altitude 256bfb9
fix: antithesis github workflow
altitude 10acc49
fix: workload build
altitude a2351d6
feat: improve test composing sequence
altitude 58524d7
feat: improve test composer sequence
altitude 4ed1eb5
fix: volumes driver
altitude 8aaa393
fix: don't overuse assertions
altitude 3ec2e4c
fix: ledger id
altitude 9f22e06
fix: bucket/ledger
altitude aa9fa2b
Merge remote-tracking branch 'origin/main' into feat/dst
altitude e8b6e82
fix: remove exhaustive assertion on tx
altitude 9fc1cf7
fix: switch to sometimes assertions for tx commit
altitude e52be33
feat: switch ledger creation to sometimes assertions as well
altitude 40c1a39
fix: move correctness check to eventually
altitude c8ab708
feat: improve error handling on eventually
altitude f8fa1ba
Merge remote-tracking branch 'origin/main' into feat/dst
altitude 979b33a
fix: improve error handling
altitude 49b0414
wip: improve
altitude 9248bd8
feat: add Kubernetes pod configuration for workload
flemzord 424b4c1
k8s test setup
Azorlogh d4f161b
Merge branch 'main' into feat/dst-k8s
Azorlogh c5dac59
test fixes & remove docker-compose antithesis setup
Azorlogh 7664eb6
integrate the operator
Azorlogh 0966637
partially fix ledger instrumentation
Azorlogh c152718
fixes, readiness probe, missing images
Azorlogh 0f879a9
fix workload panic
Azorlogh c3cb880
remove main earthfile & fix workflow
Azorlogh 9db3f81
fix secret name
Azorlogh fddeb96
use antithesis-trigger-action
Azorlogh fa66ba7
fix images list
Azorlogh 62309de
keep just setup for now
Azorlogh 1ee5795
version upgrades & specify tags in workflow
Azorlogh 65042d5
test run
Azorlogh af6956b
fix workflow
Azorlogh 59ddcbf
fix workflow
Azorlogh 3242e71
fix missing images
Azorlogh 3c8a68b
fix token
Azorlogh d2d57b7
fix version update command & workload permissions
Azorlogh 0484df1
temporarily disable version update, more complex workload & checks
Azorlogh a5e3d61
fix instrumented ledger release workflow
Azorlogh 6b8fd2e
rerun workflow & fix names
Azorlogh f51e01f
workflow fixes
Azorlogh 47401f6
workload fixes
Azorlogh c40afec
more assertion details
Azorlogh a59cf2f
fix non-determinism & missing assertion
Azorlogh 24a0a1a
cleanup
Azorlogh 015ca6a
remove earthfiles
Azorlogh 42073fa
install missing instrumentor
Azorlogh 2e854a9
fix workflow
Azorlogh 235e5a0
fix workflow
Azorlogh 1e0ff72
fix workflow
Azorlogh 14785db
fix workflow attempt
Azorlogh 16c0cde
fix workload container
Azorlogh 160b453
fix workload/ledger builders
Azorlogh e559f0c
dockerfile typo
Azorlogh e7f7110
fix eventually_correct panic
Azorlogh ea4e906
restore version upgrade test
Azorlogh 24ffd8b
Merge branch 'main' into feat/dst
Azorlogh 12c399d
justfile typo
Azorlogh 3dc65d4
remove bucket version assertion for now
Azorlogh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| name: Antithesis Daily Run | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| run_tests: | ||
| description: "Run Antithesis tests after pushing images" | ||
| type: boolean | ||
| default: true | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| paths: | ||
| - "test/antithesis/**" | ||
| - ".github/workflows/antithesis_daily.yml" | ||
| schedule: | ||
| - cron: "0 10 * * *" | ||
|
|
||
| jobs: | ||
| trigger-daily-run: | ||
| name: Trigger daily run | ||
| runs-on: shipfox-4vcpu-ubuntu-2404 | ||
| env: | ||
| ANTITHESIS_PASSWORD: ${{ secrets.ANTITHESIS_PASSWORD }} | ||
| ANTITHESIS_SLACK_REPORT_RECIPIENT: ${{ secrets.ANTITHESIS_SLACK_REPORT_RECIPIENT }} | ||
| ANTITHESIS_REPOSITORY: ${{ secrets.ANTITHESIS_REPOSITORY }} | ||
| OPERATOR_TAG: "v2.10.1" | ||
| OPERATOR_UTILS_TAG: "v2.0.14" | ||
| GATEWAY_TAG: "v2.0.24" | ||
| # LEDGER_PREVIOUS_TAG: "v2.2.47" | ||
| # temporary: remove this when support for multiple image versions is added | ||
| LEDGER_PREVIOUS_TAG: "v2.3.0" | ||
| LEDGER_LATEST_TAG: "v2.3.0" | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Just | ||
| uses: extractions/setup-just@v3 | ||
| with: | ||
| just-version: "1.40.0" | ||
|
|
||
| - name: Setup Environment | ||
| uses: ./.github/actions/default | ||
| with: | ||
| token: ${{ secrets.NUMARY_GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: "NumaryBot" | ||
| password: ${{ secrets.NUMARY_GITHUB_TOKEN }} | ||
|
|
||
| - name: Login to Antithesis Docker Registry | ||
| run: | | ||
| echo '${{ secrets.ANTITHESIS_JSON_KEY }}' | docker login -u _json_key https://us-central1-docker.pkg.dev --password-stdin | ||
|
|
||
| - name: Build and Push Config Image | ||
| run: | | ||
| nix develop --impure --command just --justfile ./test/antithesis/Justfile requirements-push | ||
|
|
||
| - name: Run Antithesis Tests | ||
| uses: antithesishq/[email protected] | ||
| with: | ||
| notebook_name: formance-k8s | ||
| tenant: formance | ||
| username: ${{ secrets.ANTITHESIS_USERNAME }} | ||
| password: ${{ secrets.ANTITHESIS_PASSWORD }} | ||
| github_token: ${{ secrets.NUMARY_GITHUB_TOKEN }} | ||
| # images: "workload:latest;docker.io/library/postgres:15-alpine;ghcr.io/formancehq/operator:${{ env.OPERATOR_TAG }};ghcr.io/formancehq/operator-utils:${{ env.OPERATOR_UTILS_TAG }};ghcr.io/formancehq/gateway:${{ env.GATEWAY_TAG }};ghcr.io/formancehq/ledger-instrumented:${{ env.LEDGER_PREVIOUS_TAG }};ghcr.io/formancehq/ledger-instrumented:${{ env.LEDGER_LATEST_TAG }}" | ||
| # temporary: remove this when support for multiple image versions is added | ||
| images: "workload:latest;docker.io/library/postgres:15-alpine;ghcr.io/formancehq/operator:${{ env.OPERATOR_TAG }};ghcr.io/formancehq/operator-utils:${{ env.OPERATOR_UTILS_TAG }};ghcr.io/formancehq/gateway:${{ env.GATEWAY_TAG }};ghcr.io/formancehq/ledger-instrumented:${{ env.LEDGER_LATEST_TAG }}" | ||
| config_image: "antithesis-config:daily_run" | ||
| email_recipients: ${{ secrets.ANTITHESIS_SLACK_REPORT_RECIPIENT }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| name: Antithesis Instrumented Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "*" | ||
|
|
||
| jobs: | ||
| push-instrumented-ledger: | ||
| name: Push instrumented ledger | ||
| runs-on: shipfox-4vcpu-ubuntu-2404 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Just | ||
| uses: extractions/setup-just@v3 | ||
| with: | ||
| just-version: "1.40.0" | ||
|
|
||
| - name: Setup Environment | ||
| uses: ./.github/actions/default | ||
| with: | ||
| token: ${{ secrets.NUMARY_GITHUB_TOKEN }} | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Login to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: "NumaryBot" | ||
| password: ${{ secrets.NUMARY_GITHUB_TOKEN }} | ||
|
|
||
| - name: Login to Antithesis Docker Registry | ||
| run: | | ||
| echo '${{ secrets.ANTITHESIS_JSON_KEY }}' | docker login -u _json_key https://us-central1-docker.pkg.dev --password-stdin | ||
|
|
||
| - name: Build and Push Config Image | ||
| env: | ||
| LEDGER_TAG: ${{ env.GITHUB_REF_NAME }} | ||
| run: | | ||
| nix develop --impure --command just --justfile ./test/antithesis/image/Justfile push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| run-6min: requirements-push | ||
| curl --fail \ | ||
| --user "formance:$ANTITHESIS_PASSWORD" \ | ||
| -X POST https://formance.antithesis.com/api/v1/launch_experiment/formance-k8s -d '{ \ | ||
| "params": { \ | ||
| "custom.duration": "0.1", \ | ||
| "antithesis.report.recipients": "'"$ANTITHESIS_SLACK_REPORT_RECIPIENT"'", \ | ||
| "antithesis.config_image": "antithesis-config:daily_run", \ | ||
| "antithesis.images": "workload:latest;docker.io/library/postgres:15-alpine;ghcr.io/formancehq/operator:v2.10.1;ghcr.io/formancehq/operator-utils:v2.0.14;ghcr.io/formancehq/gateway:v2.0.24;ghcr.io/formancehq/ledger-instrumented:'"$LEDGER_LATEST_TAG"'" \ | ||
| } \ | ||
| }' | ||
|
|
||
| run-1h: requirements-push | ||
| curl --fail \ | ||
| --user "formance:$ANTITHESIS_PASSWORD" \ | ||
| -X POST https://formance.antithesis.com/api/v1/launch_experiment/formance-k8s -d '{ \ | ||
| "params": { \ | ||
| "custom.duration": "1", \ | ||
| "antithesis.report.recipients": "'"$ANTITHESIS_SLACK_REPORT_RECIPIENT"'", \ | ||
| "antithesis.config_image": "antithesis-config:daily_run", \ | ||
| "antithesis.images": "workload:latest;docker.io/library/postgres:15-alpine;ghcr.io/formancehq/operator:v2.10.1;ghcr.io/formancehq/operator-utils:v2.0.14;ghcr.io/formancehq/gateway:v2.0.24;ghcr.io/formancehq/ledger-instrumented:"'"$LEDGER_LATEST_TAG"'" \ | ||
| } \ | ||
| }' | ||
|
|
||
| requirements-push: | ||
| just config/push | ||
| just workload/push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| FROM scratch | ||
| COPY tmp/* /manifests/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| build-manifest: | ||
| rm -f -- tmp/resources.yaml | ||
| mkdir -p tmp | ||
| cat manifests/namespace.yaml >> tmp/resources.yaml | ||
| echo "---" >> tmp/resources.yaml | ||
| cat manifests/postgres.yaml >> tmp/resources.yaml | ||
| echo "---" >> tmp/resources.yaml | ||
| helm template regions oci://ghcr.io/formancehq/helm/regions --version 2.15.2 --namespace formance-systems >> tmp/resources.yaml | ||
| echo "---" >> tmp/resources.yaml | ||
| cat manifests/stack.yaml >> tmp/resources.yaml | ||
| echo "---" >> tmp/resources.yaml | ||
| yq '.spec.version = strenv(LEDGER_PREVIOUS_TAG)' manifests/ledger.yaml >> tmp/resources.yaml | ||
| echo "---" >> tmp/resources.yaml | ||
| cat manifests/workload.yaml >> tmp/resources.yaml | ||
|
|
||
| push: build-manifest | ||
| docker build -f Dockerfile.config -t $ANTITHESIS_REPOSITORY/antithesis-config:daily_run . | ||
| docker push $ANTITHESIS_REPOSITORY/antithesis-config:daily_run | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: formance.com/v1beta1 | ||
| kind: Ledger | ||
| metadata: | ||
| name: stack0-ledger | ||
| spec: | ||
| stack: stack0 | ||
| version: LEDGER_VERSION_PLACEHOLDER |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: formance-systems |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: postgres | ||
| namespace: formance-systems | ||
| spec: | ||
| selector: | ||
| app: postgres | ||
| ports: | ||
| - protocol: TCP | ||
| port: 5432 | ||
| targetPort: 5432 | ||
| --- | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: postgres | ||
| namespace: formance-systems | ||
| labels: | ||
| app: postgres | ||
| spec: | ||
| containers: | ||
| - name: postgres | ||
| image: postgres:15-alpine | ||
| imagePullPolicy: IfNotPresent | ||
| args: ["-c", "max_connections=100"] | ||
| env: | ||
| - name: "POSTGRES_USER" | ||
| value: "ledger" | ||
| - name: "POSTGRES_PASSWORD" | ||
| value: "ledger" | ||
| - name: "POSTGRES_DB" | ||
| value: "ledger" | ||
| - name: "PGDATA" | ||
| value: /data/postgres | ||
| livenessProbe: | ||
| exec: | ||
| command: ["pg_isready", "-Uledger"] | ||
| initialDelaySeconds: 0 | ||
| periodSeconds: 10 | ||
| timeoutSeconds: 5 | ||
| failureThreshold: 5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| apiVersion: formance.com/v1beta1 | ||
| kind: Settings | ||
| metadata: | ||
| name: formance-settings | ||
| spec: | ||
| key: postgres.*.uri | ||
| stacks: | ||
| - "stack0" | ||
| value: postgresql://ledger:[email protected]:5432?disableSSLMode=true | ||
| --- | ||
| apiVersion: formance.com/v1beta1 | ||
| kind: Settings | ||
| metadata: | ||
| name: formance-setting-ledger-image | ||
| spec: | ||
| key: registries."ghcr.io".images."formancehq/ledger".rewrite | ||
| stacks: | ||
| - "stack0" | ||
| value: "formancehq/ledger-instrumented" | ||
| --- | ||
| apiVersion: formance.com/v1beta1 | ||
| kind: Stack | ||
| metadata: | ||
| name: stack0 | ||
| spec: | ||
| versionsFromFile: v2.0 | ||
| --- | ||
| apiVersion: formance.com/v1beta1 | ||
| kind: Gateway | ||
| metadata: | ||
| name: stack0-gateway | ||
| spec: | ||
| stack: stack0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Validate ANTITHESIS_REPOSITORY before use.
The
pushrecipe uses$ANTITHESIS_REPOSITORYwithout verifying it is set. If unset, the Docker commands will fail with unclear error messages.Apply this diff to add validation:
push: build-manifest + : "$${ANTITHESIS_REPOSITORY:?ANTITHESIS_REPOSITORY is required}" docker build -f Dockerfile.config -t $ANTITHESIS_REPOSITORY/antithesis-config:daily_run . docker push $ANTITHESIS_REPOSITORY/antithesis-config:daily_run📝 Committable suggestion
🤖 Prompt for AI Agents