-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add windows container support, simplify binary generation (#6)
- Loading branch information
Showing
13 changed files
with
155 additions
and
105 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env groovy | ||
|
||
/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ | ||
// tests skipped because no junit reports generated. | ||
buildPlugin(failFast: false, tests: [skip: true], configurations: [ | ||
[ platform: "docker", jdk: "8", jenkins: null ], | ||
[ platform: "windock", jdk: "8", jenkins: null ], | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ARG BASE_DIR=/durabletask | ||
ARG NAME=durable_task_monitor | ||
ARG VERSION=0.0 | ||
|
||
FROM golang:1.16.4-buster AS builder | ||
ARG BASE_DIR | ||
ARG NAME | ||
ARG VERSION | ||
COPY cmd $BASE_DIR/cmd | ||
COPY pkg $BASE_DIR/pkg | ||
WORKDIR $BASE_DIR/pkg/common | ||
RUN go mod tidy | ||
RUN go test -v | ||
WORKDIR $BASE_DIR/cmd/bash | ||
RUN go mod tidy | ||
RUN go test -v | ||
RUN CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o ${NAME}_${VERSION}_darwin_amd_64 | ||
RUN CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -a -o ${NAME}_${VERSION}_darwin_arm_64 | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ${NAME}_${VERSION}_linux_64 | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -o ${NAME}_${VERSION}_linux_32 | ||
# TODO WINDOWS | ||
# WORKDIR $BASE_DIR/cmd/windows | ||
# RUN go mod tidy | ||
# RUN go test -v | ||
|
||
FROM scratch AS export-stage | ||
ARG BASE_DIR | ||
ARG NAME | ||
ARG VERSION | ||
COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_* / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
ARG BASE_DIR=/durabletask | ||
ARG NAME=durable_task_monitor | ||
ARG VERSION=0.0 | ||
|
||
FROM golang:1.16.4-nanoserver AS builder | ||
ARG BASE_DIR | ||
ARG NAME | ||
ARG VERSION | ||
COPY cmd $BASE_DIR/cmd | ||
COPY pkg $BASE_DIR/pkg | ||
WORKDIR $BASE_DIR/pkg/common | ||
RUN go test -v | ||
WORKDIR $BASE_DIR/cmd/bash | ||
# go mod tidy fails in windows CI due to permissions of module cache. Each dependency needs to be fetched with -modcacherw flag | ||
# see golang.org/issue/31481 | ||
# RUN go mod tidy | ||
RUN go get -modcacherw jenkinsci.org/plugins/durabletask/common | ||
RUN go get -modcacherw golang.org/x/sys | ||
# can't test bash on windows | ||
RUN set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %NAME%_%VERSION%_darwin_amd_64 | ||
RUN set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=arm64& go build -a -o %NAME%_%VERSION%_darwin_arm_64 | ||
RUN set CGO_ENABLED=0& set GOOS=linux& set GOARCH=amd64& go build -a -o %NAME%_%VERSION%_linux_64 | ||
RUN set CGO_ENABLED=0& set GOOS=linux& set GOARCH=386& go build -a -o %NAME%_%VERSION%_linux_32 | ||
# TODO: WINDOWS | ||
# WORKDIR $BASE_DIR/cmd/windows | ||
# RUN go mod tidy | ||
# RUN go test -v | ||
|
||
# TODO: uncomment once docker build --output (i.e. BuildKit) is available for windows containers | ||
# see: https://github.com/microsoft/Windows-Containers/issues/34 | ||
# FROM mcr.microsoft.com/windows/nanoserver:20H2 as export-stage | ||
# ARG BASE_DIR | ||
# ARG NAME | ||
# ARG VERSION | ||
# WORKDIR $BASE_DIR | ||
# COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_darwin_amd_64 $BASE_DIR | ||
# COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_darwin_arm_64 $BASE_DIR | ||
# COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_linux_64 $BASE_DIR | ||
# COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_linux_32 $BASE_DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
module jenkinsci.org/plugins/durabletask/bash | ||
|
||
go 1.14 | ||
go 1.16 | ||
|
||
replace jenkinsci.org/plugins/durabletask/common => ../../pkg/common | ||
|
||
require ( | ||
// pin x/sys to 1.14 by manually running: go get golang.org/x/[email protected] | ||
golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf | ||
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096 | ||
jenkinsci.org/plugins/durabletask/common v0.0.0-00010101000000-000000000000 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf h1:+4j7oujXP478CVb/AFvHJmVX5+Pczx2NGts5yirA0oY= | ||
golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096 h1:5PbJGn5Sp3GEUjJ61aYbUP6RIo3Z3r2E4Tv9y2z8UHo= | ||
golang.org/x/sys v0.0.0-20210507161434-a76c4d0a0096/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@echo off | ||
setlocal | ||
|
||
rem docker build --output requires BuildKit, not available for windows containers | ||
rem see https://github.com/microsoft/Windows-Containers/issues/34 | ||
rem instead, create a temporary writeable container layer to copy out the binaries | ||
|
||
rem maven plugin version | ||
set VER=%1 | ||
rem output directory of binaries | ||
set DEST=%2 | ||
set IMG_NAME=durable-task-binary-generator | ||
set BINARY_NAME=durable_task_monitor | ||
set OUTPUT_DIR=/durabletask/cmd/bash | ||
mkdir "%DEST%" | ||
docker build --build-arg VERSION=%VER% -f Dockerfile.windows -t %IMG_NAME%:%VER% . | ||
docker create -ti --name scratch %IMG_NAME%:%VER% | ||
docker cp scratch:%OUTPUT_DIR%/%BINARY_NAME%_%VER%_darwin_amd_64 %DEST% | ||
docker cp scratch:%OUTPUT_DIR%/%BINARY_NAME%_%VER%_darwin_arm_64 %DEST% | ||
docker cp scratch:%OUTPUT_DIR%/%BINARY_NAME%_%VER%_linux_64 %DEST% | ||
docker cp scratch:%OUTPUT_DIR%/%BINARY_NAME%_%VER%_linux_32 %DEST% | ||
docker rm -f scratch | ||
docker rmi %IMG_NAME%:%VER% | ||
|
||
endlocal | ||
@echo on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#! /bin/sh | ||
set -ex | ||
# maven plugin version | ||
VER=$1 | ||
# output directory of binaries | ||
DEST=$2 | ||
export DOCKER_BUILDKIT=1 | ||
docker build --build-arg VERSION=$VER -o $DEST -f Dockerfile.linux . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module jenkinsci.org/plugins/durabletask/common | ||
|
||
go 1.14 | ||
go 1.16 |
This file was deleted.
Oops, something went wrong.