Skip to content

Commit

Permalink
Update Windows versions in Dockerfiles for e2e apps (dapr#6060)
Browse files Browse the repository at this point in the history
* Update Windows versions in Dockerfiles for e2e apps

Signed-off-by: Shubham Sharma <[email protected]>

* re-trigger pipeline

Signed-off-by: Shubham Sharma <[email protected]>

* Stop caching temp

Signed-off-by: Shubham Sharma <[email protected]>

* Upgrade dotnet version in actor-dotnet app

Signed-off-by: Shubham Sharma <[email protected]>

* Fix images

Signed-off-by: Shubham Sharma <[email protected]>

* Changes to actorpython

Signed-off-by: Shubham Sharma <[email protected]>

* Update python test

Signed-off-by: Shubham Sharma <[email protected]>

* re-trigger pipeline

Signed-off-by: Shubham Sharma <[email protected]>

* re-trigger pipeline

Signed-off-by: Shubham Sharma <[email protected]>

* re-trigger pipeline

Signed-off-by: Shubham Sharma <[email protected]>

* Update caching in build tools

Signed-off-by: Shubham Sharma <[email protected]>

* re-trigger pipeline

Signed-off-by: Shubham Sharma <[email protected]>

* Add Windows version to makefile

Signed-off-by: Shubham Sharma <[email protected]>

* Add missing '\'

Signed-off-by: Shubham Sharma <[email protected]>

---------

Signed-off-by: Shubham Sharma <[email protected]>
Co-authored-by: Mukundan Sundararajan <[email protected]>
Co-authored-by: Loong Dai <[email protected]>
  • Loading branch information
3 people authored Mar 20, 2023
1 parent 001cc64 commit c214d6c
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 14 deletions.
15 changes: 13 additions & 2 deletions .build-tools/cmd/zz-e2e-perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type cmdE2EPerfFlags struct {
IgnoreFile string
CacheIncludeFile string
Name string
WindowsVersion string
}

// Returns the command for e2e or perf
Expand Down Expand Up @@ -91,6 +92,7 @@ If the "--cache-registry" option is set, it will be pushed to the cache too.
buildCmd.Flags().StringVar(&obj.flags.TargetArch, "target-arch", runtime.GOARCH, "Target architecture")
buildCmd.Flags().StringVar(&obj.flags.IgnoreFile, "ignore-file", ".gitignore", "Name of the file with files to exclude (in the format of .gitignore)")
buildCmd.Flags().StringVar(&obj.flags.CacheIncludeFile, "cache-include-file", ".cache-include", "Name of the file inside the app folder with additional files to include in checksumming (in the format of .gitignore)")
buildCmd.Flags().StringVar(&obj.flags.WindowsVersion, "windows-version", "", "Windows version to use for Windows containers")

// "push" sub-command
pushCmd := &cobra.Command{
Expand Down Expand Up @@ -132,6 +134,7 @@ If the "--cahce-registry" option is set and the image exists in the cache, it wi
buildAndPushCmd.Flags().StringVar(&obj.flags.TargetArch, "target-arch", runtime.GOARCH, "Target architecture")
buildAndPushCmd.Flags().StringVar(&obj.flags.IgnoreFile, "ignore-file", ".gitignore", "Name of the file with files to exclude (in the format of .gitignore)")
buildAndPushCmd.Flags().StringVar(&obj.flags.CacheIncludeFile, "cache-include-file", ".cache-include", "Name of the file inside the app folder with additional files to include in checksumming (in the format of .gitignore)")
buildAndPushCmd.Flags().StringVar(&obj.flags.WindowsVersion, "windows-version", "", "Windows version to use for Windows containers")

// Register the commands
cmd.AddCommand(buildCmd)
Expand Down Expand Up @@ -244,8 +247,13 @@ func (c *cmdE2EPerf) getCachedImage() (string, error) {
return "", err
}

// If cache is enable, try pulling from cache first
cachedImage := fmt.Sprintf("%s/%s-%s:%s-%s-%s", c.flags.CacheRegistry, c.cmdType, c.flags.Name, c.flags.TargetOS, c.flags.TargetArch, hashDir)
tag := fmt.Sprintf("%s-%s-%s", c.flags.TargetOS, c.flags.TargetArch, hashDir)

if c.flags.WindowsVersion != "" {
tag = fmt.Sprintf("%s-%s-%s-%s", c.flags.TargetOS, c.flags.WindowsVersion, c.flags.TargetArch, hashDir)
}

cachedImage := fmt.Sprintf("%s/%s-%s:%s", c.flags.CacheRegistry, c.cmdType, c.flags.Name, tag)
return cachedImage, nil
}

Expand Down Expand Up @@ -325,6 +333,9 @@ func (c *cmdE2EPerf) buildDockerImage(cachedImage string) error {
default:
args = append(args, "--platform", c.flags.TargetOS+"/amd64")
}
if c.flags.WindowsVersion != "" {
args = append(args, "--build-arg", "WINDOWS_VERSION="+c.flags.WindowsVersion)
}

fmt.Printf("Running 'docker %s'\n", strings.Join(args, " "))
e := exec.Command("docker", args...)
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/Dockerfile-windows
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# limitations under the License.
#

FROM mcr.microsoft.com/windows/nanoserver:1809
FROM mcr.microsoft.com/windows/nanoserver:ltsc2022

WORKDIR /app
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/actordotnet/CarActor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions tests/apps/actordotnet/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 3000

FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["CarActor.csproj", "./"]
RUN dotnet restore "CarActor.csproj"
Expand Down
4 changes: 2 additions & 2 deletions tests/apps/actordotnet/Dockerfile-windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
Expand All @@ -10,7 +10,7 @@ COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
EXPOSE 3000
COPY --from=build-env /app/out .
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/actorjava/Dockerfile-windows
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ARG WINDOWS_VERSION=1809
ARG WINDOWS_VERSION=ltsc2022
# We are adding a Dockerfile because the building tools expect one, but we do not test this app on Windows
FROM mcr.microsoft.com/windows/nanoserver:$WINDOWS_VERSION
2 changes: 1 addition & 1 deletion tests/apps/actorphp/Dockerfile-windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG WINDOWS_VERSION=1809
ARG WINDOWS_VERSION=ltsc2022
FROM ghcr.io/dapr/windows-php-base:$WINDOWS_VERSION

WORKDIR /inetpub
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/actorpython/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# limitations under the License.
#

FROM python:3.7-slim-buster
FROM python:3.9-slim-buster

WORKDIR /app
COPY . .
Expand Down
2 changes: 1 addition & 1 deletion tests/apps/actorpython/Dockerfile-windows
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG WINDOWS_VERSION=1809
ARG WINDOWS_VERSION=ltsc2022
FROM ghcr.io/dapr/windows-python-base:$WINDOWS_VERSION
WORKDIR /app
ADD . /app
Expand Down
3 changes: 2 additions & 1 deletion tests/apps/actorpython/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
flask-dapr>=1.0.0rc2
flask-dapr>=1.9.0
typing-extensions
7 changes: 6 additions & 1 deletion tests/dapr_tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ $(error cannot find get minikube node ip address. ensure that you have minikube
endif
endif

ifeq ($(WINDOWS_VERSION),)
WINDOWS_VERSION=ltsc2022
endif

# check the required environment variables
check-e2e-env:
ifeq ($(DAPR_TEST_REGISTRY),)
Expand Down Expand Up @@ -169,7 +173,8 @@ build-push-e2e-app-$(1): check-e2e-env check-e2e-cache
--dockerfile "$(DOCKERFILE)" \
--target-os "$(TARGET_OS)" \
--target-arch "$(TARGET_ARCH)" \
--cache-registry "$(DAPR_CACHE_REGISTRY)"
--cache-registry "$(DAPR_CACHE_REGISTRY)" \
--windows-version "$(WINDOWS_VERSION)"
endef

# Generate test app image build-push targets
Expand Down

0 comments on commit c214d6c

Please sign in to comment.