From e93feee5ce4f10a5b254b1e33ffe93316e5c3fdf Mon Sep 17 00:00:00 2001 From: Franco Bruno Lavayen Date: Fri, 8 Jul 2022 16:47:15 -0300 Subject: [PATCH] [CONSUL-207] Move base Dockerfiles to build-support-windows folder (#10) --- .../Dockerfile-bats-core-windows | 0 .../Dockerfile-fortio-windows | 0 .../Dockerfile-socat-windows | 0 .../build-images.sh | 9 +- build-support-windows/docker.windows.md | 94 +++++++++++++++++++ .../connect/envoy/docker.windows.md | 51 +--------- .../connect/envoy/run-tests.windows.sh | 2 +- 7 files changed, 105 insertions(+), 51 deletions(-) rename {test/integration/connect/envoy => build-support-windows}/Dockerfile-bats-core-windows (100%) rename {test/integration/connect/envoy => build-support-windows}/Dockerfile-fortio-windows (100%) rename {test/integration/connect/envoy => build-support-windows}/Dockerfile-socat-windows (100%) rename test/integration/connect/envoy/build-images.windows.sh => build-support-windows/build-images.sh (87%) create mode 100644 build-support-windows/docker.windows.md diff --git a/test/integration/connect/envoy/Dockerfile-bats-core-windows b/build-support-windows/Dockerfile-bats-core-windows similarity index 100% rename from test/integration/connect/envoy/Dockerfile-bats-core-windows rename to build-support-windows/Dockerfile-bats-core-windows diff --git a/test/integration/connect/envoy/Dockerfile-fortio-windows b/build-support-windows/Dockerfile-fortio-windows similarity index 100% rename from test/integration/connect/envoy/Dockerfile-fortio-windows rename to build-support-windows/Dockerfile-fortio-windows diff --git a/test/integration/connect/envoy/Dockerfile-socat-windows b/build-support-windows/Dockerfile-socat-windows similarity index 100% rename from test/integration/connect/envoy/Dockerfile-socat-windows rename to build-support-windows/Dockerfile-socat-windows diff --git a/test/integration/connect/envoy/build-images.windows.sh b/build-support-windows/build-images.sh similarity index 87% rename from test/integration/connect/envoy/build-images.windows.sh rename to build-support-windows/build-images.sh index 99e8fabd136b..add42d0b84cf 100644 --- a/test/integration/connect/envoy/build-images.windows.sh +++ b/build-support-windows/build-images.sh @@ -12,15 +12,18 @@ docker.exe pull mcr.microsoft.com/windows/nanoserver:1809 # Re tag Pulled image docker.exe tag mcr.microsoft.com/windows/nanoserver:1809 "${HASHICORP_DOCKER_PROXY}/windows/nanoserver" -# Build Fortio Windows Image -docker.exe build -t "${HASHICORP_DOCKER_PROXY}/windows/fortio" -f Dockerfile-fortio-windows . - # Pull Envoy-Windows Image docker.exe pull "envoyproxy/envoy-windows:v${ENVOY_VERSION}" # Re tag Pulled image docker.exe tag "envoyproxy/envoy-windows:v${ENVOY_VERSION}" "${HASHICORP_DOCKER_PROXY}/windows/envoy-windows:v${ENVOY_VERSION}" +# Build Fortio Windows Image +docker.exe build -t "${HASHICORP_DOCKER_PROXY}/windows/fortio" -f Dockerfile-fortio-windows . + # Build Socat-Windows Image docker.exe build -t "${HASHICORP_DOCKER_PROXY}/windows/socat" -f Dockerfile-socat-windows . +# Build Bats-Core-Windows Image +docker build -t "${HASHICORP_DOCKER_PROXY}/windows/bats:1.7.0" . -f Dockerfile-bats-core-windows + echo "Building Complete!" diff --git a/build-support-windows/docker.windows.md b/build-support-windows/docker.windows.md new file mode 100644 index 000000000000..cc2832feeb7b --- /dev/null +++ b/build-support-windows/docker.windows.md @@ -0,0 +1,94 @@ +# Dockerfiles for Windows Integration Tests + +## Index + +- [About](#about-this-file) +- [Dockerfile-fortio-windows](#dockerfile-fortio-windows) +- [Dockerfile-socat-windows](#dockerfile-socat-windows) +- [Dockerfile-bats-core-windows](#dockerfile-bats-core-windows) +- [Build images](#build-images) + +## About this File + +In this file you will find which Docker images that need to be pre-built to run the Envoy integration tests on Windows, as well as information on how to run each of these files individually for testing purposes. + +## Dockerfile-fortio-windows + +This file sole purpose is to build the custom Fortio image for Windows OS. To do this, the official [windows/nanoserver image](https://hub.docker.com/_/microsoft-windows-nanoserver) is used as base image. +To build this image you need to run the following command on your terminal: + +```shell +docker build -t fortio . -f Dockerfile-fortio-windows +``` + +This is the same command used in run-tests.sh + +You can test the built file by running the following command: + +```shell +docker run --rm -p 8080:8080 --name fortio fortio +``` + +If everything works properly you should openning the browser and check that the Fortio server running on: `http://localhost:8080/fortio` + +## Dockerfile-socat-windows + +The alpine:socat image was replaced by a windows core image to which a precompiled version of Socat was installed. + +The windows base used was: `mcr.microsoft.com/windows/servercore:1809` + +The compiled windows version of Socat can be found in the repository [https://github.com/tech128/socat-1.7.3.0-windows](https://github.com/tech128/socat-1.7.3.0-windows) + +To build this image you need to run the following command on your terminal: + +```shell +docker build -t socat -f Dockerfile-socat-windows . +``` + +You can test the built file by running the following command: + +```shell +docker run --rm --name socat socat +``` + +If everything works properly you should get the following output: + +```shell +20XX/XX/XX XX:XX:XX socat[1292] E exactly 2 addresses required (there are 0); use option "-h" for help +``` + +## Dockerfile-bats-core-windows + +This file sole purpose is to build the custom Bats image for Windows OS. To do this, the official [windows/servercore image](https://hub.docker.com/_/microsoft-windows-servercore) is used as base image. +To build this image you need to run the following command on your terminal: + +```shell +docker build -t bats-verify . -f Dockerfile-bats-windows +``` + +This is the same command used in run-tests.sh + +You can test the built file by running the following command: + +```shell +docker run --rm --name bats-verify bats-verify +``` + +If everything works properly you should see the help commands and available parameters about how to run Bats tests like is displayed below + +```shell +$ docker run --rm --name bats-verify bats-verify +Usage: bats [OPTIONS] + bats [-h | -v] + + is the path to a Bats test file, or the path to a directory + containing Bats test files (ending with ".bats") +``` + +## Build images + +To build the images, it is necessary to open a Git bash terminal and run + +``` +./build-images.sh +``` diff --git a/test/integration/connect/envoy/docker.windows.md b/test/integration/connect/envoy/docker.windows.md index 71b80fa3a8c4..5ec01fa5a753 100644 --- a/test/integration/connect/envoy/docker.windows.md +++ b/test/integration/connect/envoy/docker.windows.md @@ -3,15 +3,17 @@ ## Index - [About](#about-this-file) +- [Pre-requisites](#pre-requisites) - [Dockerfile-test-sds-server-windows](#dockerfile-test-sds-server-windows) -- [Dockerfile-fortio-windows](#dockerfile-fortio-windows) -- [Dockerfile-socat-windows](#dockerfile-socat-windows) - [Dockerfile-bats-windows](#dockerfile-bats-windows) ## About this File In this file you will find which Dockerfiles are needed to run the Envoy integration tests on Windows, as well as information on how to run each of these files individually for testing purposes. +## Pre-requisites +After building and running the images and containers, you need to have pre-built the base images used by these Dockerfiles. See [pre-built images required in Windows](../../../../build-support-windows/docker.windows.md) + ## Dockerfile-test-sds-server-windows This file sole purpose is to build the test-sds-server executable using Go. To do so, we use an official [golang image](https://hub.docker.com/_/golang/) provided in docker hub with Windows nano server. @@ -39,51 +41,6 @@ If everything works properly you should get the following output: 20XX-XX-XXTXX:XX:XX.XXX-XXX [INFO] ==> SDS listening: addr=0.0.0.0:1234 ``` -## Dockerfile-fortio-windows - -This file sole purpose is to build the custom Fortio image for Windows OS. To do this, the official [windows/nanoserver image](https://hub.docker.com/_/microsoft-windows-nanoserver) is used as base image. -To build this image you need to run the following command on your terminal: - -```shell -docker build -t fortio . -f Dockerfile-fortio-windows -``` - -This is the same command used in run-tests.sh - -You can test the built file by running the following command: - -```shell -docker run --rm -p 8080:8080 --name fortio fortio -``` - -If everything works properly you should openning the browser and check that the Fortio server running on: `http://localhost:8080/fortio` - -## Dockerfile-socat-windows - -The alpine:socat image was replaced by a windows core image to which a precompiled version of Socat was installed. - -The windows base used was: `mcr.microsoft.com/windows/servercore:1809` - -The compiled windows version of Socat can be found in the repository [https://github.com/tech128/socat-1.7.3.0-windows](https://github.com/tech128/socat-1.7.3.0-windows) - -To build this image you need to run the following command on your terminal: - -```shell -docker build -t socat -f Dockerfile-socat-windows . -``` - -You can test the built file by running the following command: - -```shell -docker run --rm --name socat socat -``` - -If everything works properly you should get the following output: - -```shell -20XX/XX/XX XX:XX:XX socat[1292] E exactly 2 addresses required (there are 0); use option "-h" for help -``` - ## Dockerfile-bats-windows This file sole purpose is to build the custom Bats image for Windows OS. To do this, the official [windows/servercore image](https://hub.docker.com/_/microsoft-windows-servercore) is used as base image. diff --git a/test/integration/connect/envoy/run-tests.windows.sh b/test/integration/connect/envoy/run-tests.windows.sh index 9a140ec21f49..76247ac644e9 100644 --- a/test/integration/connect/envoy/run-tests.windows.sh +++ b/test/integration/connect/envoy/run-tests.windows.sh @@ -536,7 +536,7 @@ function suite_setup { # pre-build the verify container echo "Rebuilding 'bats-verify' image..." # TODO -Line below commented for testing - # docker build -t bats-verify -f Dockerfile-bats-windows . + docker build -t bats-verify -f Dockerfile-bats-windows . # if this fails on CircleCI your first thing to try would be to upgrade # the machine image to the latest version using this listing: