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

Move build state away from api - integration tests #454

Closed
wants to merge 78 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
f2440cd
feat(template-manager): build logs stored wwith corresponding buildID…
sitole Mar 5, 2025
2599724
chore(template-manager): separate system and build stauts loggers
sitole Mar 5, 2025
b3869c4
feat(template-manager): separate build trigger and status scheck apis
sitole Mar 5, 2025
0e51d09
chore(template-manager): builds logs wirter uses only logger, streami…
sitole Mar 5, 2025
1eba6ac
feat(template-manager): template creation runs background
sitole Mar 5, 2025
99e612b
feat(template-manager): template status endpoint will pulling of buil…
sitole Mar 5, 2025
ceedeec
chore(api): build cache removed from api store
sitole Mar 6, 2025
0db8efa
chore(api): template builds logs are using db instead of locally cach…
sitole Mar 6, 2025
3b81051
reguster template manager for api store, run background process for b…
sitole Mar 10, 2025
1b3721c
fixed build status logs mapping
sitole Mar 10, 2025
f88ef58
fixed issues in template manager cache
sitole Mar 10, 2025
5b073ca
api template build refactor
sitole Mar 10, 2025
5658866
adjusted build cache ttl
sitole Mar 10, 2025
7124b93
sorted imports
sitole Mar 10, 2025
2b3dfd6
added telemetry record for template creation
sitole Mar 10, 2025
690798d
cleanup template start build endpoint
sitole Mar 10, 2025
4c70a2b
removed unused cache calls
sitole Mar 10, 2025
c5a6f9c
enabled background sync for tempalte builds
sitole Mar 10, 2025
ee8527e
lowered limit for template manager cache
sitole Mar 10, 2025
5a8c141
mark build failed when error during build in template-manager
sitole Mar 10, 2025
5270e41
fail builds in waiting phase after it takes too long
sitole Mar 10, 2025
492fb9d
background sync of template builds adjusted to one per minute
sitole Mar 10, 2025
27e8f50
build status sync that support ctx
sitole Mar 10, 2025
b3e6c6e
changed order of params in protobuf spec
sitole Mar 11, 2025
48ab346
fixed missed limits
sitole Mar 11, 2025
d28585d
do not create separate ctx with telemetry context
sitole Mar 11, 2025
38e6437
use state-machine enumerations instead of bools
sitole Mar 11, 2025
95155b8
dockerbuild and docker push can take up to 20 minutes now
sitole Mar 11, 2025
d2016e7
custom error type for not found template build
sitole Mar 11, 2025
582a5b8
use struct def instad of inlined one
sitole Mar 11, 2025
9dc8e44
proper catch error during template build fetch
sitole Mar 11, 2025
0b1b66a
typo in defer cleanup function in template build
sitole Mar 11, 2025
d7b0e15
tracking span created in background sync routine
sitole Mar 11, 2025
57b9d73
after-rebase fix, removed build cache from apistore struct
sitole Mar 11, 2025
bbddca3
check if build is waiting state when build trigger
sitole Mar 12, 2025
e5aca3f
make concurrent builds check more readable
sitole Mar 12, 2025
7a728f0
increased timeout for template build status
sitole Mar 12, 2025
9d6acf1
removed not needed and for db query
sitole Mar 12, 2025
82446c8
lock mutex during buidl cache removal
sitole Mar 12, 2025
037ff30
fixed printing different error than received via grpc
sitole Mar 12, 2025
28b8719
ctx fix, removed todo
sitole Mar 12, 2025
05b623f
refactor background job for builds sync to use ticker and timeout con…
sitole Mar 12, 2025
d37eb35
create background build span for tracing
sitole Mar 12, 2025
4e9eb13
take ctx from parent and extend it for tracing
sitole Mar 12, 2025
531e970
return typed error for `GetEnv` method in db catalog
sitole Mar 12, 2025
e0083d3
template-manager: exist instantly when error during build
sitole Mar 12, 2025
8269fe0
use cache for template builds to make less queries to db
sitole Mar 12, 2025
8856848
fixed using grpc request ctx for background job, using just trace span
sitole Mar 12, 2025
7c90349
merge issue
sitole Mar 14, 2025
7da3d44
removed temp logging
sitole Mar 14, 2025
d024439
speed up interval for checking template status
sitole Mar 14, 2025
29f4c8a
log template cache hit
sitole Mar 14, 2025
747fcf8
take build status from cache instead of db query
sitole Mar 14, 2025
b73d62c
go deps sync
sitole Mar 14, 2025
37c39be
fixed missing cache status update
sitole Mar 14, 2025
5f8cc32
return proper state when build is still in waiting phase
sitole Mar 14, 2025
25e3b13
missing build cache status set
sitole Mar 14, 2025
2afda5b
template build logs early return
sitole Mar 14, 2025
fb587a8
Add template manager integration tests
jakubno Mar 14, 2025
5c6a09e
Add build test
jakubno Mar 14, 2025
73e3cec
Small improvements
jakubno Mar 14, 2025
113df55
Run test
jakubno Mar 14, 2025
703227e
Run build test only in pipeline
jakubno Mar 14, 2025
ea6b1f0
Clean up
jakubno Mar 14, 2025
82d2b0b
Add template manager address
jakubno Mar 14, 2025
c7b2d83
Start template manager
jakubno Mar 14, 2025
a4f7a90
Pass variable
jakubno Mar 14, 2025
818f863
Update spec
jakubno Mar 14, 2025
e4c6353
temp fix
jakubno Mar 14, 2025
0e7e851
Test
jakubno Mar 14, 2025
b7f338e
Fix
jakubno Mar 14, 2025
a09f270
Test
jakubno Mar 14, 2025
6a1607c
Test
jakubno Mar 14, 2025
62f4fda
Test
jakubno Mar 14, 2025
995233e
Add logs
jakubno Mar 14, 2025
52441ff
Use secret
jakubno Mar 14, 2025
18263b0
Pass secret
jakubno Mar 15, 2025
65472f5
Pass secret
jakubno Mar 15, 2025
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
22 changes: 21 additions & 1 deletion .github/actions/start-services/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ runs:
- name: Run PostgreSQL Database
env:
TESTS_E2B_API_KEY: "e2b_5ec17bd3933af21f80dc10bba686691c4fcd7057"
TESTS_E2B_ACCESS_TOKEN: "sk_e2b_acce55acce55acce55acce55acce55acce55acce"
TESTS_SANDBOX_BUILD_ID_TO_BE_BUILD: "e2b00e2b-e4fe-47af-8ff6-187bca92f3f9"
TESTS_SANDBOX_TEAM_ID: "834777bd-9956-45ca-b088-9bac9290e2ac"
TESTS_SANDBOX_USER_ID: "2a5a9fc5-db8d-4af7-ac9e-d0f9272463bc"
TESTS_RUN_BUILD_TEST: "true"
# Signed token using "supabasejwtsecretsupabasejwtsecret" with data
# {
# "sub": "2a5a9fc5-db8d-4af7-ac9e-d0f9272463bc",
Expand All @@ -34,9 +37,12 @@ runs:
echo "extensions installed"

echo "TESTS_E2B_API_KEY=${TESTS_E2B_API_KEY}" >> .env.test
echo "TESTS_E2B_ACCESS_TOKEN=${TESTS_E2B_ACCESS_TOKEN}" >> .env.test
echo "TESTS_SANDBOX_BUILD_ID_TO_BE_BUILD=${TESTS_SANDBOX_BUILD_ID_TO_BE_BUILD}" >> .env.test
echo "TESTS_SANDBOX_TEAM_ID=${TESTS_SANDBOX_TEAM_ID}" >> .env.test
echo "TESTS_SANDBOX_USER_ID=${TESTS_SANDBOX_USER_ID}" >> .env.test
echo "TESTS_SUPABASE_TOKEN=${TESTS_SUPABASE_TOKEN}" >> .env.test
echo "TESTS_RUN_BUILD_TEST=${TESTS_RUN_BUILD_TEST}" >> .env.test
set -x
make migrate
make -C tests/integration seed
Expand All @@ -46,12 +52,26 @@ runs:
env:
ENVD_TIMEOUT: "60s"
SUPABASE_JWT_SECRETS: "supabasejwtsecretsupabasejwtsecret"
TEMPLATE_MANAGER_ADDRESS: "http://127.0.0.1:5009"
GCP_PROJECT_ID: "e2b-prod"
GCP_DOCKER_REPOSITORY_NAME: "custom-environments-tests"
TEMPLATE_BUCKET_NAME: "e2b-tests-fc-templates"
run: |
echo "ENVD_TIMEOUT=${ENVD_TIMEOUT}" >> .env.test
echo "SUPABASE_JWT_SECRETS=${SUPABASE_JWT_SECRETS}" >> .env.test

echo "TEMPLATE_MANAGER_ADDRESS=${TEMPLATE_MANAGER_ADDRESS}" >> .env.test
echo "GCP_PROJECT_ID=${GCP_PROJECT_ID}" >> .env.test
echo "GCP_DOCKER_REPOSITORY_NAME=${GCP_DOCKER_REPOSITORY_NAME}" >> .env.test
echo "TEMPLATE_BUCKET_NAME=${TEMPLATE_BUCKET_NAME}" >> .env.test

export ACCESS_TOKEN=$(gcloud auth print-access-token)
export DOCKER_AUTH_BASE64=$(echo -n "{\"username\":\"oauth2accesstoken\",\"password\":\"$ACCESS_TOKEN\"}" | base64 -w 0)
echo "::add-mask::$DOCKER_AUTH_BASE64"
echo "DOCKER_AUTH_BASE64=${DOCKER_AUTH_BASE64}" >> .env.test

mkdir -p ~/logs

make -C packages/template-manager run-debug 2>&1 | tee ~/logs/template-manager.log &
make -C packages/orchestrator run-debug 2>&1 | tee ~/logs/orchestrator.log &
ORCH_PID=$!
sleep 30
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Integration Tests

on:
pull_request:
branches: [ main ]

jobs:
integration_tests:
Expand All @@ -25,6 +24,8 @@ jobs:
uses: ./.github/actions/build-sandbox-template

- name: Start Services
env:
GOOGLE_SERVICE_ACCOUNT_BASE64: ${{ secrets.TESTS_GOOGLE_SERVICE_ACCOUNT_BASE64 }}
uses: ./.github/actions/start-services

- name: Run Integration Tests
Expand All @@ -36,6 +37,7 @@ jobs:
ls -l ~/logs
tail -f ~/logs/orchestrator.log -n 0 &
tail -f ~/logs/api.log -n 0 &
tail -f ~/logs/template-manager.log -n 0 &

# Run the integration tests
make test-integration
24 changes: 0 additions & 24 deletions packages/api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,13 @@ require (

require (
ariga.io/atlas v0.15.0 // indirect
cel.dev/expr v0.19.1 // indirect
cloud.google.com/go v0.116.0 // indirect
cloud.google.com/go/auth v0.13.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/iam v1.2.2 // indirect
cloud.google.com/go/monitoring v1.21.2 // indirect
cloud.google.com/go/storage v1.50.0 // indirect
entgo.io/ent v0.12.5 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.6.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.8.0 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect
github.com/ClickHouse/ch-go v0.65.1 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.32.2 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.49.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.49.0 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
Expand All @@ -71,7 +60,6 @@ require (
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
github.com/aws/aws-sdk-go v1.49.6 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.17.0 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/bytedance/sonic v1.12.4 // indirect
github.com/bytedance/sonic/loader v0.2.1 // indirect
Expand All @@ -81,16 +69,13 @@ require (
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/edsrzf/mmap-go v1.2.0 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand All @@ -111,12 +96,8 @@ require (
github.com/gogo/googleapis v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-migrate/migrate/v4 v4.18.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/s2a-go v0.1.8 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
github.com/googleapis/gax-go/v2 v2.14.0 // indirect
github.com/grafana/dskit v0.0.0-20231120170505-765e343eda4f // indirect
github.com/grafana/gomemcache v0.0.0-20231023152154-6947259a0586 // indirect
github.com/grafana/loki/pkg/push v0.0.0-20231124142027-e52380921608 // indirect
Expand Down Expand Up @@ -161,7 +142,6 @@ require (
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/alertmanager v0.26.0 // indirect
github.com/prometheus/client_golang v1.20.2 // indirect
Expand Down Expand Up @@ -194,12 +174,10 @@ require (
go.etcd.io/etcd/client/pkg/v3 v3.5.4 // indirect
go.etcd.io/etcd/client/v3 v3.5.4 // indirect
go.mongodb.org/mongo-driver v1.17.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/collector/pdata v1.0.0-rcv0015 // indirect
go.opentelemetry.io/collector/semconv v0.81.0 // indirect
go.opentelemetry.io/contrib/bridges/otelzap v0.9.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.34.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.57.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.34.0 // indirect
Expand All @@ -220,8 +198,6 @@ require (
golang.org/x/oauth2 v0.25.0 // indirect
golang.org/x/time v0.8.0 // indirect
golang.org/x/tools v0.30.0 // indirect
google.golang.org/api v0.214.0 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading
Loading