Skip to content

Commit 256ede5

Browse files
committed
Use locally build artifact to build container from public dockerfile
Previously we would build an image (which would not actually be used), build dockerfiles, modify dockerfiles to curl from `https://snapshots.elastic.co/downloads/logstash'` then build the image used for testing based on the modified dockerfile. This resulted in testing the last published image to `snapshots`. This presents two problems 1. The test is running against the last published image (not the tip of the branch being tested) 2. this carries a dependency on both a DRA and unified stack release having been run. Therefor acceptance tests will fail in between the time we bump logstash version and a successful run of unified release. This commit modifies the dockerfile to use the artifact prepared in the first step instead of curling the last published one. This solves both issues as the tests run against the code from the tip fo the branch being tested and there is no dependency on an artifact existing as a result of a unified release pipeline.
1 parent 4934f08 commit 256ede5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docker/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,12 @@ build-from-dockerfiles_full: public-dockerfiles_full
142142
cd $(ARTIFACTS_DIR)/docker && \
143143
mkdir -p dockerfile_build_full && cd dockerfile_build_full && \
144144
tar -zxf ../../logstash-$(VERSION_TAG)-docker-build-context.tar.gz && \
145-
sed 's/artifacts/snapshots/g' Dockerfile > Dockerfile.tmp && mv Dockerfile.tmp Dockerfile && \
145+
cp ../../logstash-$(VERSION_TAG)-linux-$(ARCHITECTURE).tar.gz . && \
146+
awk '/# Add Logstash itself and set permissions/{print; print "COPY logstash-$(VERSION_TAG)-linux-$(ARCHITECTURE).tar.gz /tmp/logstash.tar.gz"; next}1' Dockerfile > Dockerfile.tmp && \
147+
sed '/curl --fail --location --output logstash.tar.gz.*tar.gz &&/d' Dockerfile.tmp > Dockerfile.tmp2 && \
148+
sed 's|tar -zxf logstash.tar.gz|tar -zxf /tmp/logstash.tar.gz|' Dockerfile.tmp2 > Dockerfile.tmp3 && \
149+
sed 's|rm logstash.tar.gz|rm /tmp/logstash.tar.gz|' Dockerfile.tmp3 > Dockerfile && \
150+
rm -f Dockerfile.tmp* && \
146151
docker build --progress=plain --network=host -t $(IMAGE_TAG)-dockerfile-full:$(VERSION_TAG) .
147152

148153
public-dockerfiles_oss: templates/Dockerfile.erb docker_paths $(COPY_FILES)

0 commit comments

Comments
 (0)