diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8acd2c9ff362..5df0ec9fd8e6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,9 +14,9 @@ variables: TEST_INFRA_DEFINITIONS_BUILDIMAGES: b02a714d7de7 stages: - manaul-jobs - - e2e - build - push + - e2e - staging-deploy - prod-deploy @@ -68,7 +68,7 @@ push-image-agent-qa: strategy: depend variables: IMG_SOURCES: $BUILD_DD_REGISTRY:otelcolcontrib-v${CI_COMMIT_SHORT_SHA} - IMG_DESTINATIONS: otel-collector-contrib:${CI_COMMIT_SHORT_SHA} + IMG_DESTINATIONS: otel-collector-contrib:${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA} IMG_REGISTRIES: agent-qa build-ci-image: @@ -154,16 +154,19 @@ prod-deploy-demo-eks: KUBERNETES_MEMORY_REQUEST: 12Gi KUBERNETES_MEMORY_LIMIT: 16Gi KUBERNETES_CPU_REQUEST: 6 + E2E_PIPELINE_ID: $CI_PIPELINE_ID + E2E_COMMIT_SHORT_SHA: $CI_COMMIT_SHORT_SHA E2E_PUBLIC_KEY_PATH: /tmp/agent-qa-ssh-key.pub E2E_PRIVATE_KEY_PATH: /tmp/agent-qa-ssh-key E2E_KEY_PAIR_NAME: ci.open-elemetry-collector-contrib E2E_OUTPUT_DIR: $CI_PROJECT_DIR/e2e-output script: - - cd e2e-tests && go test $TARGETS/... -v timeout 0 + - cd e2e-tests && go test $TARGETS/... -v timeout 0 --args -docker_secret $(aws ecr get-login-password) -# new-e2e-otel-collector: -# extends: .new_e2e_template -# variables: -# TARGETS: ./ -# TEAM: otel +new-e2e-otel-collector: + extends: .new_e2e_template + needs: ['push-image-agent-qa'] + variables: + TARGETS: ./ + TEAM: otel diff --git a/e2e-tests/go.mod b/e2e-tests/go.mod index a4ea9bd5c187..2f2d6d77b3b4 100644 --- a/e2e-tests/go.mod +++ b/e2e-tests/go.mod @@ -8,7 +8,7 @@ require ( github.com/pulumi/pulumi-kubernetes/sdk/v4 v4.13.1 github.com/pulumi/pulumi/sdk/v3 v3.126.0 github.com/stretchr/testify v1.9.0 - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 k8s.io/apimachinery v0.28.4 ) @@ -156,7 +156,6 @@ require ( github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/xanzy/ssh-agent v0.3.3 // indirect github.com/zclconf/go-cty v1.14.4 // indirect - github.com/zorkian/go-datadog-api v2.30.0+incompatible // indirect go.uber.org/atomic v1.11.0 // indirect golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect @@ -176,7 +175,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect k8s.io/api v0.28.4 // indirect k8s.io/client-go v0.28.4 // indirect k8s.io/klog/v2 v2.100.1 // indirect diff --git a/e2e-tests/go.sum b/e2e-tests/go.sum index 3cfe9e601058..4371271e700b 100644 --- a/e2e-tests/go.sum +++ b/e2e-tests/go.sum @@ -411,8 +411,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8= github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= -github.com/zorkian/go-datadog-api v2.30.0+incompatible h1:R4ryGocppDqZZbnNc5EDR8xGWF/z/MxzWnqTUijDQes= -github.com/zorkian/go-datadog-api v2.30.0+incompatible/go.mod h1:PkXwHX9CUQa/FpB9ZwAD45N1uhCW4MT/Wj7m36PbKss= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= diff --git a/e2e-tests/otel_test.go b/e2e-tests/otel_test.go index 29b3a40e2e84..f0aba2b925cd 100644 --- a/e2e-tests/otel_test.go +++ b/e2e-tests/otel_test.go @@ -9,10 +9,12 @@ import ( "context" "flag" "fmt" + "os" "testing" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/runner" otelcollector "github.com/DataDog/opentelemetry-collector-contrib/e2e-tests/otel-collector" + "github.com/DataDog/opentelemetry-collector-contrib/e2e-tests/otel-collector/otelparams" "github.com/DataDog/datadog-agent/test/new-e2e/pkg/e2e" "github.com/stretchr/testify/assert" @@ -33,11 +35,24 @@ func TestVMSuite(t *testing.T) { extraParams.Set("ddagent:imagePullPassword", *dockerSecret, true) extraParams.Set("ddagent:imagePullUsername", "AWS", false) - suiteParams := []e2e.SuiteOption{e2e.WithProvisioner(otelcollector.Provisioner(otelcollector.WithOTelOptions(), otelcollector.WithExtraParams(extraParams)))} + otelOptions := []otelparams.Option{} + // Use image built in the CI + pipelineID, ok1 := os.LookupEnv("E2E_PIPELINE_ID") + commitSHA, ok2 := os.LookupEnv("E2E_COMMIT_SHORT_SHA") + if ok1 && ok2 { + values := fmt.Sprintf(` +image: + tag: %s-%s +`, pipelineID, commitSHA) + otelOptions = append(otelOptions, otelparams.WithHelmValues(values)) + } + + suiteParams := []e2e.SuiteOption{e2e.WithProvisioner(otelcollector.Provisioner(otelcollector.WithOTelOptions(otelOptions...), otelcollector.WithExtraParams(extraParams)))} e2e.Run(t, &otelSuite{}, suiteParams...) } +// TODO write a test that actually test something func (v *otelSuite) TestExecute() { res, _ := v.Env().KubernetesCluster.Client().CoreV1().Pods("default").List(context.TODO(), v1.ListOptions{}) for _, pod := range res.Items { @@ -53,7 +68,6 @@ func (v *otelSuite) TestExecute() { assert.NoError(v.T(), err) fmt.Printf("logs: %v", lo) - // assert.Equal(v.T(), 1, len(res.Items)) assert.Equal(v.T(), 1, len(res.Items)) }