Skip to content

Commit dcd92d0

Browse files
authored
Use docker pull for snapshots (logstash-plugins#981)
Use the snapshot builds from `docker.elastic.co`, rather than from the artifacts repo. This enables the removal of code to download architecture specific artifacts for versions of Logstash with a bundled JDK. Docker pull will retrieve the architecture appropriate version automatically, simplifying the path towards multi-architecture test suites for plugins.
1 parent 853871b commit dcd92d0

File tree

1 file changed

+6
-34
lines changed

1 file changed

+6
-34
lines changed

.ci/docker-setup.sh

+6-34
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,11 @@ set -e
77
VERSION_URL="https://raw.githubusercontent.com/elastic/logstash/master/ci/logstash_releases.json"
88

99

10-
download_and_load_docker_snapshot_artifact() {
10+
pull_docker_snapshot() {
1111
project="${1?project name required}"
12-
13-
artifact_type="docker-image"
14-
artifact_name_base="${project}${DISTRIBUTION_SUFFIX}-${ELASTIC_STACK_VERSION}-${artifact_type}"
15-
echo "Downloading snapshot docker image: ${project}${DISTRIBUTION_SUFFIX} (${ELASTIC_STACK_VERSION})"
16-
17-
artifact_name_noarch="${artifact_name_base}.tar.gz"
18-
artifact_name_arch="${artifact_name_base}-x86_64.tar.gz"
19-
20-
jq_extract_artifact_url=".build.projects.\"${project}\".packages | (.\"${artifact_name_noarch}\" // .\"${artifact_name_arch}\") | .url"
21-
22-
artifact_list=$(curl --silent "https://artifacts-api.elastic.co/v1/versions/${ELASTIC_STACK_VERSION}/builds/latest")
23-
artifact_url=$(echo "${artifact_list}" | jq --raw-output "${jq_extract_artifact_url}")
24-
25-
if [[ "${artifact_url}" == "null" ]]; then
26-
echo "Failed to find '${artifact_name_noarch}'"
27-
echo "Failed to find '${artifact_name_arch}'"
28-
echo "Listing:"
29-
echo "${artifact_list}" | jq --raw-output ".build.projects.\"${project}\".packages | keys | map(select(contains(\"${artifact_type}\")))"
30-
return 1
31-
fi
32-
33-
echo "${artifact_url}"
34-
35-
cd /tmp
36-
curl "${artifact_url}" > "${project}-docker-image.tar.gz"
37-
tar xfvz "${project}-docker-image.tar.gz" repositories
38-
echo "Loading ${project} docker image: "
39-
cat repositories
40-
docker load < "${project}-docker-image.tar.gz"
41-
rm "${project}-docker-image.tar.gz"
42-
cd -
12+
local docker_image="docker.elastic.co/${project}/${project}${DISTRIBUTION_SUFFIX}:${ELASTIC_STACK_VERSION}"
13+
echo "Pulling $docker_image"
14+
docker pull "$docker_image"
4315
}
4416

4517
if [ "$ELASTIC_STACK_VERSION" ]; then
@@ -68,9 +40,9 @@ if [ "$ELASTIC_STACK_VERSION" ]; then
6840
echo "Testing against version: $ELASTIC_STACK_VERSION (distribution: ${DISTRIBUTION:-'default'})"
6941

7042
if [[ "$ELASTIC_STACK_VERSION" = *"-SNAPSHOT" ]]; then
71-
download_and_load_docker_snapshot_artifact "logstash"
43+
pull_docker_snapshot "logstash"
7244
if [ "$INTEGRATION" == "true" ]; then
73-
download_and_load_docker_snapshot_artifact "elasticsearch"
45+
pull_docker_snapshot "elasticsearch"
7446
fi
7547
fi
7648

0 commit comments

Comments
 (0)