diff --git a/e2e/README.md b/e2e/README.md index c79bfddc5c..9ed6eda193 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -147,6 +147,7 @@ The following environment variables affect how the tests are run in both the CI >"ELASTIC_APM_ACTIVE" only affects Helm and Metricbeat test suites. - `ELASTIC_APM_ENVIRONMENT`: Set this environment variable to `ci` to send APM data to Elastic Cloud. Otherwise, the framework will spin up local APM Server and Kibana instances. For the CI, it will read credentials from Vault. Default value: `local`. +- `SKIP_PULL`: Set this environment variable to prevent the test suite to pull Docker images for all components. Default: `false` - `SKIP_SCENARIOS`: Set this environment variable to `false` if it's needed to include the scenarios annotated as `@skip` in the current test execution. Default value: `true`. - `BEATS_LOCAL_PATH`: Set this environment variable to the base path to your local clone of Beats if it's needed to use the binary snapshots produced by your local build instead of the official releases. The snapshots will be fetched from the `${BEATS_LOCAL_PATH}/${THE_BEAT}/build/distributions` local directory. This variable is intended to be used by Beats developers, when testing locally the artifacts generated its own build. Default: empty. - `BEATS_USE_CI_SNAPSHOTS`: Set this environment variable to `true` if it's needed to use the binary snapshots produced by Beats CI instead of the official releases. The snapshots will be downloaded from a bucket in Google Cloud Storage. This variable is used by the Beats repository, when testing the artifacts generated by the packaging job. Default: `false`. diff --git a/e2e/_suites/fleet/ingest_manager_test.go b/e2e/_suites/fleet/ingest_manager_test.go index 7ed54d2977..8842f4749b 100644 --- a/e2e/_suites/fleet/ingest_manager_test.go +++ b/e2e/_suites/fleet/ingest_manager_test.go @@ -15,6 +15,7 @@ import ( "github.com/elastic/e2e-testing/cli/config" "github.com/elastic/e2e-testing/internal/common" "github.com/elastic/e2e-testing/internal/compose" + "github.com/elastic/e2e-testing/internal/docker" "github.com/elastic/e2e-testing/internal/elasticsearch" "github.com/elastic/e2e-testing/internal/installer" "github.com/elastic/e2e-testing/internal/kibana" @@ -121,6 +122,22 @@ func InitializeIngestManagerTestSuite(ctx *godog.TestSuiteContext) { "stackVersion": common.StackVersion, } + if !shell.GetEnvBool("SKIP_PULL") { + images := []string{ + "docker.elastic.co/beats/elastic-agent:" + common.AgentVersion, + "docker.elastic.co/beats/elastic-agent-ubi8:" + common.AgentVersion, + "docker.elastic.co/elasticsearch/elasticsearch:" + common.StackVersion, + "docker.elastic.co/kibana/kibana:" + common.KibanaVersion, + "docker.elastic.co/observability-ci/elastic-agent:" + common.AgentVersion, + "docker.elastic.co/observability-ci/elastic-agent-ubi8:" + common.AgentVersion, + "docker.elastic.co/observability-ci/elasticsearch:" + common.StackVersion, + "docker.elastic.co/observability-ci/elasticsearch-ubi8:" + common.StackVersion, + "docker.elastic.co/observability-ci/kibana:" + common.KibanaVersion, + "docker.elastic.co/observability-ci/kibana-ubi8:" + common.KibanaVersion, + } + docker.PullImages(images) + } + common.ProfileEnv["kibanaDockerNamespace"] = "kibana" if strings.HasPrefix(common.KibanaVersion, "pr") || utils.IsCommit(common.KibanaVersion) { // because it comes from a PR diff --git a/internal/docker/docker.go b/internal/docker/docker.go index 04c2535bf6..592702a7e0 100644 --- a/internal/docker/docker.go +++ b/internal/docker/docker.go @@ -11,11 +11,8 @@ import ( "compress/gzip" "context" "fmt" -<<<<<<< HEAD -======= "io" "io/ioutil" ->>>>>>> f39aba58... feat: use Docker copy to transfer binaries to containers (#1136) "os" "path/filepath" "strings" @@ -539,3 +536,23 @@ func getDockerClient() *client.Client { return instance } + +// PullImages pulls images +func PullImages(images []string) error { + c := getDockerClient() + ctx := context.Background() + + log.WithField("images", images).Info("Pulling Docker images...") + + for _, image := range images { + r, err := c.ImagePull(ctx, image, types.ImagePullOptions{}) + if err != nil { + return err + } + _, err = io.Copy(os.Stdout, r) + if err != nil { + return err + } + } + return nil +}