From 960225e6d71e12efc99510fce13b2cef0301feec Mon Sep 17 00:00:00 2001 From: Cedric Lamoriniere Date: Thu, 2 Sep 2021 17:13:50 +0200 Subject: [PATCH] Revert "Copy `netapi32.dll` from servercore image in nano-based Windows image (#9006)" (#9051) This reverts commit 89b27708ab6872a0208fae3b98ccf70a8bac6b79. --- .gitlab/image_build/docker_windows.yml | 8 ++++---- Dockerfiles/agent/windows/amd64/Dockerfile | 14 +------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/.gitlab/image_build/docker_windows.yml b/.gitlab/image_build/docker_windows.yml index b5822eadb539b..0f0622f1c5fd2 100644 --- a/.gitlab/image_build/docker_windows.yml +++ b/.gitlab/image_build/docker_windows.yml @@ -65,7 +65,7 @@ needs: ["windows_msi_and_bosh_zip_x64-a7", "build_windows_container_entrypoint"] variables: AGENT_ZIP: "datadog-agent-7*-x86_64.zip" - BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" + BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-amd64" .docker_build_agent6_windows_common: @@ -77,21 +77,21 @@ needs: ["windows_msi_x64-a6", "build_windows_container_entrypoint"] variables: AGENT_ZIP: "datadog-agent-6*-x86_64.zip" - BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" + BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:nanoserver-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-amd64" .docker_build_agent6_windows_servercore_common: extends: - .docker_build_agent6_windows_common variables: - BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" + BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-servercore-amd64" .docker_build_agent7_windows_servercore_common: extends: - .docker_build_agent7_windows_common variables: - BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg NETAPI32_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" + BUILD_ARG: "--build-arg BASE_IMAGE=mcr.microsoft.com/powershell:windowsservercore-${VARIANT} --build-arg WITH_JMX=${WITH_JMX} --build-arg VARIANT=${VARIANT}" TARGET_TAG: "${IMAGE}:v${CI_PIPELINE_ID}-${CI_COMMIT_SHORT_SHA}${TAG_SUFFIX}-win${VARIANT}-servercore-amd64" include: diff --git a/Dockerfiles/agent/windows/amd64/Dockerfile b/Dockerfiles/agent/windows/amd64/Dockerfile index 9a0cba84d1378..3b9e48c698937 100755 --- a/Dockerfiles/agent/windows/amd64/Dockerfile +++ b/Dockerfiles/agent/windows/amd64/Dockerfile @@ -1,11 +1,5 @@ ARG BASE_IMAGE=mcr.microsoft.com/powershell:lts-windowsservercore-1809 -ARG NETAPI32_IMAGE=mcr.microsoft.com/powershell:lts-windowsservercore-1809 - -FROM ${NETAPI32_IMAGE} AS netapi32 - -FROM ${BASE_IMAGE} AS final -# This "copy netapi32.dll" hack can be reverted once https://github.com/microsoft/Windows-Containers/issues/72 is fixed. -COPY --from=netapi32 /Windows/System32/netapi32.dll /netapi32.dll +FROM ${BASE_IMAGE} ARG WITH_JMX="false" ARG VARIANT="unknown" @@ -16,12 +10,6 @@ USER ContainerAdministrator SHELL ["pwsh", "-Command", "$ErrorActionPreference = 'Stop';"] -RUN if (-not (Test-Path /Windows/System32/netapi32.dll)) { \ - Move-Item /netapi32.dll -Destination /Windows/System32/netapi32.dll \ - } else { \ - Remove-Item /netapi32.dll \ - } - COPY datadog-agent-latest.amd64.zip install.ps1 ./ RUN . ./install.ps1