Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit dfaf05b

Browse files
committed
Merge branch '7.13.x' into mergify/bp/7.13.x/pr-1136
* 7.13.x: chore: abstract image pulling (#1137) (#1139) Pull fresh docker images before suite (#1123) (#1141)
2 parents 0ed2a59 + 4188802 commit dfaf05b

3 files changed

Lines changed: 37 additions & 3 deletions

File tree

e2e/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ The following environment variables affect how the tests are run in both the CI
149149
>"ELASTIC_APM_ACTIVE" only affects Helm and Metricbeat test suites.
150150
151151
- `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`.
152+
- `SKIP_PULL`: Set this environment variable to prevent the test suite to pull Docker images for all components. Default: `false`
152153
- `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`.
153154
- `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.
154155
- `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`.

e2e/_suites/fleet/ingest_manager_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/elastic/e2e-testing/cli/config"
1616
"github.com/elastic/e2e-testing/internal/common"
1717
"github.com/elastic/e2e-testing/internal/compose"
18+
"github.com/elastic/e2e-testing/internal/docker"
1819
"github.com/elastic/e2e-testing/internal/elasticsearch"
1920
"github.com/elastic/e2e-testing/internal/installer"
2021
"github.com/elastic/e2e-testing/internal/kibana"
@@ -135,6 +136,22 @@ func InitializeIngestManagerTestSuite(ctx *godog.TestSuiteContext) {
135136
"stackVersion": common.StackVersion,
136137
}
137138

139+
if !shell.GetEnvBool("SKIP_PULL") {
140+
images := []string{
141+
"docker.elastic.co/beats/elastic-agent:" + common.AgentVersion,
142+
"docker.elastic.co/beats/elastic-agent-ubi8:" + common.AgentVersion,
143+
"docker.elastic.co/elasticsearch/elasticsearch:" + common.StackVersion,
144+
"docker.elastic.co/kibana/kibana:" + common.KibanaVersion,
145+
"docker.elastic.co/observability-ci/elastic-agent:" + common.AgentVersion,
146+
"docker.elastic.co/observability-ci/elastic-agent-ubi8:" + common.AgentVersion,
147+
"docker.elastic.co/observability-ci/elasticsearch:" + common.StackVersion,
148+
"docker.elastic.co/observability-ci/elasticsearch-ubi8:" + common.StackVersion,
149+
"docker.elastic.co/observability-ci/kibana:" + common.KibanaVersion,
150+
"docker.elastic.co/observability-ci/kibana-ubi8:" + common.KibanaVersion,
151+
}
152+
docker.PullImages(images)
153+
}
154+
138155
common.ProfileEnv["kibanaDockerNamespace"] = "kibana"
139156
if strings.HasPrefix(common.KibanaVersion, "pr") || utils.IsCommit(common.KibanaVersion) {
140157
// because it comes from a PR

internal/docker/docker.go

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@ import (
1111
"compress/gzip"
1212
"context"
1313
"fmt"
14-
<<<<<<< HEAD
15-
=======
1614
"io"
1715
"io/ioutil"
18-
>>>>>>> f39aba58... feat: use Docker copy to transfer binaries to containers (#1136)
1916
"os"
2017
"path/filepath"
2118
"strings"
@@ -539,3 +536,22 @@ func getDockerClient() *client.Client {
539536

540537
return instance
541538
}
539+
540+
// PullImages pulls images
541+
func PullImages(images []string) error {
542+
c := getDockerClient()
543+
ctx := context.Background()
544+
545+
log.WithField("images", images).Info("Pulling Docker images...")
546+
for _, image := range images {
547+
r, err := c.ImagePull(ctx, image, types.ImagePullOptions{})
548+
if err != nil {
549+
return err
550+
}
551+
_, err = io.Copy(os.Stdout, r)
552+
if err != nil {
553+
return err
554+
}
555+
}
556+
return nil
557+
}

0 commit comments

Comments
 (0)