From b51b6bee772c6bab5ba152e3e3b8b503d0968bfe Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Wed, 28 Apr 2021 23:41:37 -0600 Subject: [PATCH 01/24] Remove docker maven plugin, refactor for windows builds --- Dockerfile | 4 - Jenkinsfile | 7 ++ pom.xml | 137 ++++++++++++++++------ src/Dockerfile | 10 ++ src/cmd/bash/durable_task_monitor_test.go | 2 +- src/compile-binaries.sh | 18 --- src/generate-binaries.sh | 16 +++ src/rebuild.sh | 20 ---- src/test-and-compile.sh | 42 +++++++ 9 files changed, 177 insertions(+), 79 deletions(-) delete mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100755 src/Dockerfile delete mode 100644 src/compile-binaries.sh create mode 100755 src/generate-binaries.sh delete mode 100755 src/rebuild.sh create mode 100755 src/test-and-compile.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 57d4248..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -# NOTE: golang > 1.14 drops darwin 32-bit support -FROM golang:1.14-buster -WORKDIR /durabletask -ENTRYPOINT /bin/sh compile-binaries.sh ${project.version} diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..3774a42 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,7 @@ +#!/usr/bin/env groovy + +/* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ +buildPlugin(failFast: false, configurations: [ + [ platform: "docker", jdk: "8", jenkins: null ], + [ platform: "windock", jdk: "8", jenkins: null ] +]) \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5cac7f7..338102f 100644 --- a/pom.xml +++ b/pom.xml @@ -72,65 +72,130 @@ <tag>${scmTag}</tag> </scm> - <dependencies> - </dependencies> + <profiles> + <profile> + <id>linux</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <properties> + <docker.script>generate-binaries.sh</docker.script> +<!-- <docker.image.platform_tag>buster</docker.image.platform_tag>--> +<!-- <docker.entrypoint.script>/bin/sh test-and-compile-binaries.sh</docker.entrypoint.script>--> + </properties> + </profile> + <profile> + <id>windows</id> + <activation> + <os> + <family>windows</family> + </os> + </activation> + <properties> + <docker.script>generate-binaries.bat</docker.script> +<!-- <docker.image.platform_tag>nanoserver</docker.image.platform_tag>--> +<!-- <docker.entrypoint.script>cmd.exe test-and-compile-binaries.bat</docker.entrypoint.script>--> + </properties> + </profile> + </profiles> + <build> <plugins> <plugin> - <groupId>io.fabric8</groupId> - <artifactId>docker-maven-plugin</artifactId> - <version>0.35.0</version> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.6.0</version> <configuration> - <images> - <image> - <alias>durable-task-binary-generator</alias> - <name>jenkins-ci.durable-task/binary-generator:${project.version}</name> - <run> - <volumes> - <bind> - <volume>${project.basedir}/src:/durabletask</volume> - </bind> - </volumes> - <log> - <date>default</date> - </log> - <wait> - <log>binary generation complete.</log> - <time>300000</time> - </wait> - </run> - </image> - </images> + <executable>${project.build.directory}/src/${docker.script}</executable> + <workingDirectory>${project.build.directory}/src</workingDirectory> + <arguments> + <argument>${revision}</argument> + <argument>${project.build.directory}/src</argument> + </arguments> </configuration> <executions> <execution> - <id>build-docker-image</id> - <phase>initialize</phase> + <id>docker-generate-binaries</id> + <phase>compile</phase> <goals> - <goal>build</goal> + <goal>exec</goal> </goals> </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <version>3.2.0</version> + <executions> <execution> - <id>compile-in-docker</id> - <phase>compile</phase> + <id>copy-source</id> + <phase>generate-sources</phase> <goals> - <goal>start</goal> + <goal>copy-resources</goal> </goals> + <configuration> + <outputDirectory>${project.build.directory}</outputDirectory> + <overwrite>true</overwrite> + <resources> + <resource> + <directory>${project.basedir}</directory> + <includes> + <include>src/**</include> + </includes> + </resource> + </resources> + </configuration> </execution> <execution> - <id>docker-cleanup</id> - <phase>package</phase> + <id>copy-test-results</id> + <phase>test</phase> + <goals> + <goal>copy-resources</goal> + </goals> + <configuration> + <outputDirectory>${project.build.directory}/surefire-reports/</outputDirectory> + <overwrite>true</overwrite> + <resources> + <resource> + <directory>${project.build.directory}/src/test-results</directory> + <includes> + <include>*</include> + </includes> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-enforcer-plugin</artifactId> + <version>3.0.0-M3</version> + <executions> + <execution> + <id>enforce-no-test-failures</id> + <phase>verify</phase> <goals> - <goal>stop</goal> - <goal>remove</goal> + <goal>enforce</goal> </goals> + <configuration> + <rules> + <requireFilesDontExist> + <files> + <file>${project.build.directory}/surefire-reports/failed</file> + </files> + </requireFilesDontExist> + </rules> + <fail>true</fail> + </configuration> </execution> </executions> </plugin> </plugins> <resources> <resource> - <directory>src</directory> + <directory>${project.build.directory}/src/bin</directory> <includes> <include>durable_task_monitor_*_darwin_*</include> <include>durable_task_monitor_*_unix_*</include> diff --git a/src/Dockerfile b/src/Dockerfile new file mode 100755 index 0000000..92c1594 --- /dev/null +++ b/src/Dockerfile @@ -0,0 +1,10 @@ +# NOTE: golang > 1.14 drops darwin 32-bit support +ARG PLATFORM +FROM golang:1.14-$PLATFORM + +ARG ENTRY_SCRIPT +ARG PLUGIN_VER +ENV SCRIPT=${ENTRY_SCRIPT} +ENV VER=${PLUGIN_VER} +WORKDIR /durabletask +ENTRYPOINT /durabletask/$SCRIPT $VER diff --git a/src/cmd/bash/durable_task_monitor_test.go b/src/cmd/bash/durable_task_monitor_test.go index 405ed3b..ee2a92f 100644 --- a/src/cmd/bash/durable_task_monitor_test.go +++ b/src/cmd/bash/durable_task_monitor_test.go @@ -81,7 +81,7 @@ func TestLauncher(t *testing.T) { wg.Wait() launchOutput := launchBuffer.String() - launchLoggerExp := regexp.MustCompile(`^args 0: sh\nargs 1: -xe\nargs 2: .*\/src\/cmd\/bash\/test-script.sh\nlaunched \d*\nscript exit code: 0`) + launchLoggerExp := regexp.MustCompile(`^args 0: sh\nargs 1: -xe\nargs 2: .*\/cmd\/bash\/test-script.sh\nlaunched \d*\nscript exit code: 0`) if !launchLoggerExp.MatchString(launchOutput) { t.Errorf("launch output incorrect:\n%v", launchOutput) } diff --git a/src/compile-binaries.sh b/src/compile-binaries.sh deleted file mode 100644 index 45c65c9..0000000 --- a/src/compile-binaries.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh -set -x -# maven plugin version -VER=$1 -NAME="durable_task_monitor" -rm -rf ${NAME}_* -cd "cmd/bash" -go mod tidy -env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o ../../${NAME}_${VER}_darwin_64 -env CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -a -o ../../${NAME}_${VER}_darwin_32 -env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ../../${NAME}_${VER}_unix_64 -env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -o ../../${NAME}_${VER}_unix_32 -#TODO: Windows binary generation -#cd "../windows" -#go mod tidy -#env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -o ../../${NAME}_${VER}_win_64 -#env CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -a -o ../../${NAME}_${VER}_win_32 -echo "binary generation complete. If you are still seeing this message, press Ctrl-C to exit." diff --git a/src/generate-binaries.sh b/src/generate-binaries.sh new file mode 100755 index 0000000..68c526f --- /dev/null +++ b/src/generate-binaries.sh @@ -0,0 +1,16 @@ +#! /bin/sh +set -ex +# maven plugin version +VER=$1 +# path to the golang source +SRC=$2 +IMG_NAME="durable-task-binary-generator" +BIN_NAME="durable_task_monitor" +docker build --build-arg PLATFORM="buster" \ + --build-arg ENTRY_SCRIPT="test-and-compile.sh" \ + --build-arg PLUGIN_VER=${VER} \ + -t ${IMG_NAME}:${VER} . +docker run -i --rm \ + --mount type=bind,src=${SRC},dst=/durabletask \ + ${IMG_NAME}:${VER} +docker rmi ${IMG_NAME}:${VER} \ No newline at end of file diff --git a/src/rebuild.sh b/src/rebuild.sh deleted file mode 100755 index 8538b9b..0000000 --- a/src/rebuild.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh -# Convenience script to rebuild golang binaries during development -if [[ $1 -eq 0 ]] ; then - echo 'please provide a plugin version as an argument (ex: 1.32)' - exit 0 -fi -set -x -# maven plugin version -VER=$1 -NAME="durable_task_monitor" -rm -rf ${NAME}_* -cd "cmd/bash" -env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o ../../${NAME}_${VER}_darwin_64 -env CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -a -o ../../${NAME}_${VER}_darwin_32 -env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ../../${NAME}_${VER}_unix_64 -env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -o ../../${NAME}_${VER}_unix_32 -#TODO: Windows -#cd "../windows" -#env CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -a -o ../../${NAME}_${VER}_win_64 -#env CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -a -o ../../${NAME}_${VER}_win_32 diff --git a/src/test-and-compile.sh b/src/test-and-compile.sh new file mode 100755 index 0000000..0bf3cf5 --- /dev/null +++ b/src/test-and-compile.sh @@ -0,0 +1,42 @@ +#! /bin/sh +set -x +# maven plugin version +VER=$1 +BASEDIR=${PWD} +# destination of generated binaries +BIN="${BASEDIR}/bin" +# destination of the test reports +TEST="${BASEDIR}/test-results" +# failure file +FAILED="${TEST}/failed" +NAME="durable_task_monitor" + +# gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 +rm -rf "${TEST}" +mkdir -p "${TEST}" +cd ${BASEDIR}/pkg/common +go mod tidy +go get -v gotest.tools/gotestsum@v0.4.2 +if ! gotestsum --format standard-verbose --junitfile ${TEST}/common-unit-tests.xml +then + echo "common" >> ${FAILED} +fi +cd ${BASEDIR}/cmd/bash +go mod tidy +go get -v gotest.tools/gotestsum@v0.4.2 +if ! gotestsum --format standard-verbose --junitfile ${TEST}/bash-unit-tests.xml +then + echo "bash" >> ${FAILED} +fi + +# build the binaries +rm -rf ${BIN} +mkdir ${BIN} +cd ${BASEDIR}/cmd/bash +env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o ${BIN}/${NAME}_${VER}_darwin_64 +env CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -a -o ${BIN}/${NAME}_${VER}_darwin_32 +env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ${BIN}/${NAME}_${VER}_unix_64 +env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -o ${BIN}/${NAME}_${VER}_unix_32 +# TODO build windows + +echo "binary generation complete. If you are still seeing this message, press Ctrl-C to exit." \ No newline at end of file From ded8f54d20ea435e484f471bd66432e672ca6481 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Thu, 29 Apr 2021 13:56:11 -0600 Subject: [PATCH 02/24] add windows build scripts --- src/generate-binaries.bat | 18 ++++++++++++++++ src/test-and-compile.bat | 43 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 src/generate-binaries.bat create mode 100644 src/test-and-compile.bat diff --git a/src/generate-binaries.bat b/src/generate-binaries.bat new file mode 100644 index 0000000..37c51a8 --- /dev/null +++ b/src/generate-binaries.bat @@ -0,0 +1,18 @@ +setlocal + +rem maven plugin version +set VER=%1 +rem path to the golang source +set SRC=%2 +set IMG_NAME=durable-task-binary-generator +set BIN_NAME=durable_task_monitor +docker build --build-arg PLATFORM=nanoserver ^ + --build-arg ENTRY_SCRIPT=test-and-compile.bat ^ + --build-arg PLUGIN_VER=%VER% ^ + -t %IMG_NAME%:%VER% . +docker run -i --rm ^ + --mount type=bind,src=%SRC%,dst=C:\durabletask ^ + %IMG_NAME%:%VER% +rem docker rmi %IMG_NAME%:%VER% + +endlocal \ No newline at end of file diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat new file mode 100644 index 0000000..9284785 --- /dev/null +++ b/src/test-and-compile.bat @@ -0,0 +1,43 @@ +setlocal +echo off + +rem maven plugin version +set VER=%1 +set BASEDIR=%CD% +set BIN=%BASEDIR%\bin +rem destination of the test reports +set TEST=%BASEDIR%\test-results +rem failure file +set FAILED=%TEST%\failed +set NAME=durable_task_monitor + +rem gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 +del /s /q %TEST% +mkdir %TEST% +cd %BASEDIR%\pkg\common +go mod tidy +go get -v gotest.tools/gotestsum@v0.4.2 +gotestsum --format standard-verbose --junitfile %TEST%\common-unit-tests.xml +if NOT %ERRORLEVEL% == 0 echo command>>%FAILED% +rem TODO test windows +rem cd %BASEDIR%\cmd\windows +rem go mod tidy +rem go get -v gotest.tools/gotestsum@v0.4.2 +rem gotestsum --format standard-verbose --junitfile %TEST%\bash-unit-tests.xml +rem if NOT %ERRORLEVEL% == 0 echo windows>>%FAILED% + +rem build the binaries +del /s /q %BIN% +mkdir %BIN% +cd %BASEDIR%/cmd/bash +set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_darwin_64 +set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_darwin_32 +set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_unix_64 +set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_unix_32 +rem TODO build windows +dir %BIN% + +echo "binary generation complete. If you are still seeing this message, press Ctrl-C to exit." + +echo on +endlocal \ No newline at end of file From 2c75805068081d0d14fbcd6a7abe4151e5cef1d4 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Thu, 29 Apr 2021 23:00:36 -0600 Subject: [PATCH 03/24] Create windows build scripts, refactor dockerfile --- pom.xml | 10 +++------- src/Dockerfile | 8 +------- src/generate-binaries.bat | 14 +++++--------- src/generate-binaries.sh | 10 ++-------- src/test-and-compile.bat | 6 +++--- src/test-and-compile.sh | 2 +- 6 files changed, 15 insertions(+), 35 deletions(-) diff --git a/pom.xml b/pom.xml index 338102f..64fe799 100644 --- a/pom.xml +++ b/pom.xml @@ -79,9 +79,7 @@ <activeByDefault>true</activeByDefault> </activation> <properties> - <docker.script>generate-binaries.sh</docker.script> -<!-- <docker.image.platform_tag>buster</docker.image.platform_tag>--> -<!-- <docker.entrypoint.script>/bin/sh test-and-compile-binaries.sh</docker.entrypoint.script>--> + <docker.creation.script>generate-binaries.sh</docker.creation.script> </properties> </profile> <profile> @@ -92,9 +90,7 @@ </os> </activation> <properties> - <docker.script>generate-binaries.bat</docker.script> -<!-- <docker.image.platform_tag>nanoserver</docker.image.platform_tag>--> -<!-- <docker.entrypoint.script>cmd.exe test-and-compile-binaries.bat</docker.entrypoint.script>--> + <docker.creation.script>generate-binaries.bat</docker.creation.script> </properties> </profile> </profiles> @@ -106,7 +102,7 @@ <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <configuration> - <executable>${project.build.directory}/src/${docker.script}</executable> + <executable>${project.build.directory}/src/${docker.creation.script}</executable> <workingDirectory>${project.build.directory}/src</workingDirectory> <arguments> <argument>${revision}</argument> diff --git a/src/Dockerfile b/src/Dockerfile index 92c1594..46175cb 100755 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,10 +1,4 @@ # NOTE: golang > 1.14 drops darwin 32-bit support ARG PLATFORM FROM golang:1.14-$PLATFORM - -ARG ENTRY_SCRIPT -ARG PLUGIN_VER -ENV SCRIPT=${ENTRY_SCRIPT} -ENV VER=${PLUGIN_VER} -WORKDIR /durabletask -ENTRYPOINT /durabletask/$SCRIPT $VER +WORKDIR /durabletask \ No newline at end of file diff --git a/src/generate-binaries.bat b/src/generate-binaries.bat index 37c51a8..3f460aa 100644 --- a/src/generate-binaries.bat +++ b/src/generate-binaries.bat @@ -1,18 +1,14 @@ setlocal +@echo off rem maven plugin version set VER=%1 rem path to the golang source set SRC=%2 set IMG_NAME=durable-task-binary-generator -set BIN_NAME=durable_task_monitor -docker build --build-arg PLATFORM=nanoserver ^ - --build-arg ENTRY_SCRIPT=test-and-compile.bat ^ - --build-arg PLUGIN_VER=%VER% ^ - -t %IMG_NAME%:%VER% . -docker run -i --rm ^ - --mount type=bind,src=%SRC%,dst=C:\durabletask ^ - %IMG_NAME%:%VER% -rem docker rmi %IMG_NAME%:%VER% +docker build --build-arg PLATFORM=nanoserver -t %IMG_NAME%:%VER% . +docker run -i --rm --mount type=bind,src=%SRC%,dst=C:\durabletask %IMG_NAME%:%VER% C:\durabletask\test-and-compile.bat %VER% +docker rmi %IMG_NAME%:%VER% +@echo on endlocal \ No newline at end of file diff --git a/src/generate-binaries.sh b/src/generate-binaries.sh index 68c526f..a8d21db 100755 --- a/src/generate-binaries.sh +++ b/src/generate-binaries.sh @@ -5,12 +5,6 @@ VER=$1 # path to the golang source SRC=$2 IMG_NAME="durable-task-binary-generator" -BIN_NAME="durable_task_monitor" -docker build --build-arg PLATFORM="buster" \ - --build-arg ENTRY_SCRIPT="test-and-compile.sh" \ - --build-arg PLUGIN_VER=${VER} \ - -t ${IMG_NAME}:${VER} . -docker run -i --rm \ - --mount type=bind,src=${SRC},dst=/durabletask \ - ${IMG_NAME}:${VER} +docker build --build-arg PLATFORM="buster" -t ${IMG_NAME}:${VER} . +docker run -i --rm --mount type=bind,src=${SRC},dst=/durabletask ${IMG_NAME}:${VER} /durabletask/test-and-compile.sh ${VER} docker rmi ${IMG_NAME}:${VER} \ No newline at end of file diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat index 9284785..2425c57 100644 --- a/src/test-and-compile.bat +++ b/src/test-and-compile.bat @@ -1,5 +1,5 @@ setlocal -echo off +@echo off rem maven plugin version set VER=%1 @@ -37,7 +37,7 @@ set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME rem TODO build windows dir %BIN% -echo "binary generation complete. If you are still seeing this message, press Ctrl-C to exit." +echo "binary generation complete." -echo on +@echo on endlocal \ No newline at end of file diff --git a/src/test-and-compile.sh b/src/test-and-compile.sh index 0bf3cf5..22a43c2 100755 --- a/src/test-and-compile.sh +++ b/src/test-and-compile.sh @@ -39,4 +39,4 @@ env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ${BIN}/${NAME}_${VER}_u env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -o ${BIN}/${NAME}_${VER}_unix_32 # TODO build windows -echo "binary generation complete. If you are still seeing this message, press Ctrl-C to exit." \ No newline at end of file +echo "binary generation complete." \ No newline at end of file From d26e5d7eb6a02355c5b2b330bb204fed5abbc1ea Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Thu, 29 Apr 2021 23:31:45 -0600 Subject: [PATCH 04/24] updating permission of go.mod and go.sum files --- src/cmd/bash/go.mod | 0 src/cmd/bash/go.sum | 0 src/pkg/common/go.mod | 0 src/pkg/common/go.sum | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 src/cmd/bash/go.mod mode change 100644 => 100755 src/cmd/bash/go.sum mode change 100644 => 100755 src/pkg/common/go.mod mode change 100644 => 100755 src/pkg/common/go.sum diff --git a/src/cmd/bash/go.mod b/src/cmd/bash/go.mod old mode 100644 new mode 100755 diff --git a/src/cmd/bash/go.sum b/src/cmd/bash/go.sum old mode 100644 new mode 100755 diff --git a/src/pkg/common/go.mod b/src/pkg/common/go.mod old mode 100644 new mode 100755 diff --git a/src/pkg/common/go.sum b/src/pkg/common/go.sum old mode 100644 new mode 100755 From 7772e491bc0e7c1c5ae37ac937a07dabb22c585e Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Thu, 29 Apr 2021 23:49:40 -0600 Subject: [PATCH 05/24] Revert "updating permission of go.mod and go.sum files" This reverts commit d26e5d7eb6a02355c5b2b330bb204fed5abbc1ea. --- src/cmd/bash/go.mod | 0 src/cmd/bash/go.sum | 0 src/pkg/common/go.mod | 0 src/pkg/common/go.sum | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 src/cmd/bash/go.mod mode change 100755 => 100644 src/cmd/bash/go.sum mode change 100755 => 100644 src/pkg/common/go.mod mode change 100755 => 100644 src/pkg/common/go.sum diff --git a/src/cmd/bash/go.mod b/src/cmd/bash/go.mod old mode 100755 new mode 100644 diff --git a/src/cmd/bash/go.sum b/src/cmd/bash/go.sum old mode 100755 new mode 100644 diff --git a/src/pkg/common/go.mod b/src/pkg/common/go.mod old mode 100755 new mode 100644 diff --git a/src/pkg/common/go.sum b/src/pkg/common/go.sum old mode 100755 new mode 100644 From bc7e7cacc36ddd31cecb82ebf1131884822ffebe Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Thu, 29 Apr 2021 23:51:48 -0600 Subject: [PATCH 06/24] set GODEBUG=modcacheunzipinplace=1 to resolve go.mod/sum access denied issues --- src/test-and-compile.bat | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat index 2425c57..27425ac 100644 --- a/src/test-and-compile.bat +++ b/src/test-and-compile.bat @@ -10,6 +10,8 @@ set TEST=%BASEDIR%\test-results rem failure file set FAILED=%TEST%\failed set NAME=durable_task_monitor +rem resolves https://golang.org/issue/36568 for windows machines +set GODEBUG=modcacheunzipinplace=1 rem gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 del /s /q %TEST% From fa1b3dc00c110b55443cce048bb470cabbefe2d5 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Thu, 29 Apr 2021 23:57:01 -0600 Subject: [PATCH 07/24] remove GODEBUG flag, directly add gotestsum to go.mod --- src/cmd/bash/go.mod | 1 + src/cmd/bash/go.sum | 45 +++++++++++++++++++++++++++++++++++++++ src/pkg/common/go.mod | 2 ++ src/pkg/common/go.sum | 46 ++++++++++++++++++++++++++++++++++++++++ src/test-and-compile.bat | 4 ---- src/test-and-compile.sh | 2 -- 6 files changed, 94 insertions(+), 6 deletions(-) diff --git a/src/cmd/bash/go.mod b/src/cmd/bash/go.mod index 763af64..b5ce204 100644 --- a/src/cmd/bash/go.mod +++ b/src/cmd/bash/go.mod @@ -7,5 +7,6 @@ replace jenkinsci.org/plugins/durabletask/common => ../../pkg/common require ( // pin x/sys to 1.14 by manually running: go get golang.org/x/sys@release-branch.go1.14-std golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf + gotest.tools/gotestsum v0.4.2 // indirect jenkinsci.org/plugins/durabletask/common v0.0.0-00010101000000-000000000000 ) diff --git a/src/cmd/bash/go.sum b/src/cmd/bash/go.sum index d4c5117..888d3d3 100644 --- a/src/cmd/bash/go.sum +++ b/src/cmd/bash/go.sum @@ -1,2 +1,47 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.6.0 h1:66qjqZk8kalYAvDRtM1AdAJQI0tj4Wrue3Eq3B3pmFU= +github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.0.5 h1:8c8b5uO0zS4X6RPl/sd1ENwSkIc0/H2PaHxE3udaE8I= +github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4= +gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/src/pkg/common/go.mod b/src/pkg/common/go.mod index 20773c2..f14f405 100644 --- a/src/pkg/common/go.mod +++ b/src/pkg/common/go.mod @@ -1,3 +1,5 @@ module jenkinsci.org/plugins/durabletask/common go 1.14 + +require gotest.tools/gotestsum v0.4.2 // indirect diff --git a/src/pkg/common/go.sum b/src/pkg/common/go.sum index e69de29..d1c04c0 100644 --- a/src/pkg/common/go.sum +++ b/src/pkg/common/go.sum @@ -0,0 +1,46 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fatih/color v1.6.0 h1:66qjqZk8kalYAvDRtM1AdAJQI0tj4Wrue3Eq3B3pmFU= +github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= +github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= +github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= +github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= +github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sirupsen/logrus v1.0.5 h1:8c8b5uO0zS4X6RPl/sd1ENwSkIc0/H2PaHxE3udaE8I= +github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4= +gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y= +gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat index 27425ac..833116b 100644 --- a/src/test-and-compile.bat +++ b/src/test-and-compile.bat @@ -10,21 +10,17 @@ set TEST=%BASEDIR%\test-results rem failure file set FAILED=%TEST%\failed set NAME=durable_task_monitor -rem resolves https://golang.org/issue/36568 for windows machines -set GODEBUG=modcacheunzipinplace=1 rem gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 del /s /q %TEST% mkdir %TEST% cd %BASEDIR%\pkg\common go mod tidy -go get -v gotest.tools/gotestsum@v0.4.2 gotestsum --format standard-verbose --junitfile %TEST%\common-unit-tests.xml if NOT %ERRORLEVEL% == 0 echo command>>%FAILED% rem TODO test windows rem cd %BASEDIR%\cmd\windows rem go mod tidy -rem go get -v gotest.tools/gotestsum@v0.4.2 rem gotestsum --format standard-verbose --junitfile %TEST%\bash-unit-tests.xml rem if NOT %ERRORLEVEL% == 0 echo windows>>%FAILED% diff --git a/src/test-and-compile.sh b/src/test-and-compile.sh index 22a43c2..8de8449 100755 --- a/src/test-and-compile.sh +++ b/src/test-and-compile.sh @@ -16,14 +16,12 @@ rm -rf "${TEST}" mkdir -p "${TEST}" cd ${BASEDIR}/pkg/common go mod tidy -go get -v gotest.tools/gotestsum@v0.4.2 if ! gotestsum --format standard-verbose --junitfile ${TEST}/common-unit-tests.xml then echo "common" >> ${FAILED} fi cd ${BASEDIR}/cmd/bash go mod tidy -go get -v gotest.tools/gotestsum@v0.4.2 if ! gotestsum --format standard-verbose --junitfile ${TEST}/bash-unit-tests.xml then echo "bash" >> ${FAILED} From deae0067bc0546fa254a2fa05c80a7394021518c Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Fri, 30 Apr 2021 00:23:02 -0600 Subject: [PATCH 08/24] Revert "remove GODEBUG flag, directly add gotestsum to go.mod" This reverts commit fa1b3dc00c110b55443cce048bb470cabbefe2d5. --- src/cmd/bash/go.mod | 1 - src/cmd/bash/go.sum | 45 --------------------------------------- src/pkg/common/go.mod | 2 -- src/pkg/common/go.sum | 46 ---------------------------------------- src/test-and-compile.bat | 4 ++++ src/test-and-compile.sh | 2 ++ 6 files changed, 6 insertions(+), 94 deletions(-) diff --git a/src/cmd/bash/go.mod b/src/cmd/bash/go.mod index b5ce204..763af64 100644 --- a/src/cmd/bash/go.mod +++ b/src/cmd/bash/go.mod @@ -7,6 +7,5 @@ replace jenkinsci.org/plugins/durabletask/common => ../../pkg/common require ( // pin x/sys to 1.14 by manually running: go get golang.org/x/sys@release-branch.go1.14-std golang.org/x/sys v0.0.0-20200201011859-915c9c3d4ccf - gotest.tools/gotestsum v0.4.2 // indirect jenkinsci.org/plugins/durabletask/common v0.0.0-00010101000000-000000000000 ) diff --git a/src/cmd/bash/go.sum b/src/cmd/bash/go.sum index 888d3d3..d4c5117 100644 --- a/src/cmd/bash/go.sum +++ b/src/cmd/bash/go.sum @@ -1,47 +1,2 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.6.0 h1:66qjqZk8kalYAvDRtM1AdAJQI0tj4Wrue3Eq3B3pmFU= -github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.0.5 h1:8c8b5uO0zS4X6RPl/sd1ENwSkIc0/H2PaHxE3udaE8I= -github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4= -gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/src/pkg/common/go.mod b/src/pkg/common/go.mod index f14f405..20773c2 100644 --- a/src/pkg/common/go.mod +++ b/src/pkg/common/go.mod @@ -1,5 +1,3 @@ module jenkinsci.org/plugins/durabletask/common go 1.14 - -require gotest.tools/gotestsum v0.4.2 // indirect diff --git a/src/pkg/common/go.sum b/src/pkg/common/go.sum index d1c04c0..e69de29 100644 --- a/src/pkg/common/go.sum +++ b/src/pkg/common/go.sum @@ -1,46 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.6.0 h1:66qjqZk8kalYAvDRtM1AdAJQI0tj4Wrue3Eq3B3pmFU= -github.com/fatih/color v1.6.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-isatty v0.0.3 h1:ns/ykhmWi7G9O+8a448SecJU3nSMBXJfqQkl0upE1jI= -github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sirupsen/logrus v1.0.5 h1:8c8b5uO0zS4X6RPl/sd1ENwSkIc0/H2PaHxE3udaE8I= -github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gotest.tools/gotestsum v0.4.2 h1:QOdtb6bnnPUuHKkR9+/QQa8e6qjpTTP7cDi7G9/10C4= -gotest.tools/gotestsum v0.4.2/go.mod h1:a32lmn/7xfm0+QHj8K5NyQY1NNNNhZoAp+/OHkLs77Y= -gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat index 833116b..27425ac 100644 --- a/src/test-and-compile.bat +++ b/src/test-and-compile.bat @@ -10,17 +10,21 @@ set TEST=%BASEDIR%\test-results rem failure file set FAILED=%TEST%\failed set NAME=durable_task_monitor +rem resolves https://golang.org/issue/36568 for windows machines +set GODEBUG=modcacheunzipinplace=1 rem gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 del /s /q %TEST% mkdir %TEST% cd %BASEDIR%\pkg\common go mod tidy +go get -v gotest.tools/gotestsum@v0.4.2 gotestsum --format standard-verbose --junitfile %TEST%\common-unit-tests.xml if NOT %ERRORLEVEL% == 0 echo command>>%FAILED% rem TODO test windows rem cd %BASEDIR%\cmd\windows rem go mod tidy +rem go get -v gotest.tools/gotestsum@v0.4.2 rem gotestsum --format standard-verbose --junitfile %TEST%\bash-unit-tests.xml rem if NOT %ERRORLEVEL% == 0 echo windows>>%FAILED% diff --git a/src/test-and-compile.sh b/src/test-and-compile.sh index 8de8449..22a43c2 100755 --- a/src/test-and-compile.sh +++ b/src/test-and-compile.sh @@ -16,12 +16,14 @@ rm -rf "${TEST}" mkdir -p "${TEST}" cd ${BASEDIR}/pkg/common go mod tidy +go get -v gotest.tools/gotestsum@v0.4.2 if ! gotestsum --format standard-verbose --junitfile ${TEST}/common-unit-tests.xml then echo "common" >> ${FAILED} fi cd ${BASEDIR}/cmd/bash go mod tidy +go get -v gotest.tools/gotestsum@v0.4.2 if ! gotestsum --format standard-verbose --junitfile ${TEST}/bash-unit-tests.xml then echo "bash" >> ${FAILED} From 0f1bff1539199f182ea8934cce15e650f4060c0d Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Fri, 30 Apr 2021 00:25:08 -0600 Subject: [PATCH 09/24] use golang 1.14.15 --- src/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dockerfile b/src/Dockerfile index 46175cb..7d06e44 100755 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,4 +1,4 @@ # NOTE: golang > 1.14 drops darwin 32-bit support ARG PLATFORM -FROM golang:1.14-$PLATFORM +FROM golang:1.14.15-$PLATFORM WORKDIR /durabletask \ No newline at end of file From e6439cbf2471a53eb0d31ae04b2e2a2bfeb6c401 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Fri, 30 Apr 2021 00:33:33 -0600 Subject: [PATCH 10/24] Remove junit reporting in windows --- Jenkinsfile | 4 +++- src/test-and-compile.bat | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3774a42..bf964e3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,9 @@ #!/usr/bin/env groovy /* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ +// tests skipped on windows because no surefire reports generated. However, unit tests are still being run and will +// fail build if failed buildPlugin(failFast: false, configurations: [ [ platform: "docker", jdk: "8", jenkins: null ], - [ platform: "windock", jdk: "8", jenkins: null ] + [ platform: "windock", jdk: "8", jenkins: null, skipTests: true ] ]) \ No newline at end of file diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat index 27425ac..f44d949 100644 --- a/src/test-and-compile.bat +++ b/src/test-and-compile.bat @@ -10,16 +10,16 @@ set TEST=%BASEDIR%\test-results rem failure file set FAILED=%TEST%\failed set NAME=durable_task_monitor -rem resolves https://golang.org/issue/36568 for windows machines -set GODEBUG=modcacheunzipinplace=1 rem gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 del /s /q %TEST% mkdir %TEST% cd %BASEDIR%\pkg\common go mod tidy -go get -v gotest.tools/gotestsum@v0.4.2 -gotestsum --format standard-verbose --junitfile %TEST%\common-unit-tests.xml +rem https://golang.org/issue/36568 prevents downloading gotestsum, unable to generate junit test reports +rem go get -v gotest.tools/gotestsum@v0.4.2 +rem gotestsum --format standard-verbose --junitfile %TEST%\common-unit-tests.xml +go test -v if NOT %ERRORLEVEL% == 0 echo command>>%FAILED% rem TODO test windows rem cd %BASEDIR%\cmd\windows From 16b2a51323a5a5cf850a7ef1098872d9b1609185 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Fri, 30 Apr 2021 00:37:46 -0600 Subject: [PATCH 11/24] tweak jenkinsfile --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bf964e3..e1d82ad 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,9 +1,8 @@ #!/usr/bin/env groovy /* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ -// tests skipped on windows because no surefire reports generated. However, unit tests are still being run and will -// fail build if failed -buildPlugin(failFast: false, configurations: [ +// tests skipped because no surefire reports generated on windows. However, unit tests are still being run and will fail build if failed +buildPlugin(failFast: false, skipTests: true, configurations: [ [ platform: "docker", jdk: "8", jenkins: null ], - [ platform: "windock", jdk: "8", jenkins: null, skipTests: true ] + [ platform: "windock", jdk: "8", jenkins: null ] ]) \ No newline at end of file From d50b8ba5217e199e8494ee12977232a0dae3293c Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Fri, 7 May 2021 17:35:42 -0600 Subject: [PATCH 12/24] add dockerfile for linux --- Jenkinsfile | 4 ++-- src/Dockerfile | 4 ---- src/Dockerfile.linux | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 6 deletions(-) delete mode 100755 src/Dockerfile create mode 100644 src/Dockerfile.linux diff --git a/Jenkinsfile b/Jenkinsfile index e1d82ad..b1495c1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,7 +2,7 @@ /* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ // tests skipped because no surefire reports generated on windows. However, unit tests are still being run and will fail build if failed -buildPlugin(failFast: false, skipTests: true, configurations: [ +buildPlugin(failFast: false, tests: [skip: true], configurations: [ [ platform: "docker", jdk: "8", jenkins: null ], - [ platform: "windock", jdk: "8", jenkins: null ] + [ platform: "windock", jdk: "8", jenkins: null ], ]) \ No newline at end of file diff --git a/src/Dockerfile b/src/Dockerfile deleted file mode 100755 index 7d06e44..0000000 --- a/src/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -# NOTE: golang > 1.14 drops darwin 32-bit support -ARG PLATFORM -FROM golang:1.14.15-$PLATFORM -WORKDIR /durabletask \ No newline at end of file diff --git a/src/Dockerfile.linux b/src/Dockerfile.linux new file mode 100644 index 0000000..bbd4a88 --- /dev/null +++ b/src/Dockerfile.linux @@ -0,0 +1,27 @@ +ARG BASE_DIR=/durabletask +ARG NAME=dtmon +ARG VERSION=0.1 + +# NOTE: golang > 1.14 drops darwin 32-bit support +FROM golang:1.14.15-buster AS builder +ARG BASE_DIR +ARG NAME +ARG VERSION +ADD cmd $BASE_DIR/cmd +ADD 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_64 +RUN CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -a -o ${NAME}_${VERSION}_darwin_32 +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 + +FROM scratch AS export-stage +ARG BASE_DIR +ARG NAME +ARG VERSION +COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_* . From aa135b481377138f5f449d11c9bc475a60beae25 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Fri, 7 May 2021 23:50:55 -0600 Subject: [PATCH 13/24] add dockerfile for windows, update to golang 1.16, build on apple silicon --- src/Dockerfile.linux | 11 +++++++---- src/Dockerfile.windows | 39 +++++++++++++++++++++++++++++++++++++++ src/cmd/bash/go.mod | 5 ++--- src/cmd/bash/go.sum | 4 ++-- src/pkg/common/go.mod | 2 +- 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 src/Dockerfile.windows diff --git a/src/Dockerfile.linux b/src/Dockerfile.linux index bbd4a88..b227886 100644 --- a/src/Dockerfile.linux +++ b/src/Dockerfile.linux @@ -2,8 +2,7 @@ ARG BASE_DIR=/durabletask ARG NAME=dtmon ARG VERSION=0.1 -# NOTE: golang > 1.14 drops darwin 32-bit support -FROM golang:1.14.15-buster AS builder +FROM golang:1.16.4-buster AS builder ARG BASE_DIR ARG NAME ARG VERSION @@ -15,10 +14,14 @@ 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_64 -RUN CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -a -o ${NAME}_${VERSION}_darwin_32 +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 diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows new file mode 100644 index 0000000..d006b35 --- /dev/null +++ b/src/Dockerfile.windows @@ -0,0 +1,39 @@ +ARG BASE_DIR=/durabletask +ARG NAME=dtmon +ARG VERSION=0.1 + +FROM golang:1.16.4-nanoserver AS builder +ARG BASE_DIR +ARG NAME +ARG VERSION +ADD cmd $BASE_DIR/cmd +ADD 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 +# 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 + +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 +# docker build --output requires BuildKit, not available for windows containers +# docker build -f Dockerfile.windows -t dtgen:test . +# docker create -ti --name dummy dtgen:test cmd +# docker cp dummy:/durabletask/dtmon_0.1_darwin_amd_64 . +# docker rm -f dummy \ No newline at end of file diff --git a/src/cmd/bash/go.mod b/src/cmd/bash/go.mod index 763af64..0db38c7 100644 --- a/src/cmd/bash/go.mod +++ b/src/cmd/bash/go.mod @@ -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/sys@release-branch.go1.14-std - 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 ) diff --git a/src/cmd/bash/go.sum b/src/cmd/bash/go.sum index d4c5117..cde092f 100644 --- a/src/cmd/bash/go.sum +++ b/src/cmd/bash/go.sum @@ -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= diff --git a/src/pkg/common/go.mod b/src/pkg/common/go.mod index 20773c2..53cfaf7 100644 --- a/src/pkg/common/go.mod +++ b/src/pkg/common/go.mod @@ -1,3 +1,3 @@ module jenkinsci.org/plugins/durabletask/common -go 1.14 +go 1.16 From c7fed2521daca771c6a84381c663b25cf700f699 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sat, 8 May 2021 15:12:37 -0600 Subject: [PATCH 14/24] no windows support for buildkit, replace with docker create script clean up variable names and pom --- pom.xml | 3 +-- src/Dockerfile.linux | 4 ++-- src/Dockerfile.windows | 31 ++++++++++++++----------------- src/docker-generate-binaries.bat | 22 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 src/docker-generate-binaries.bat diff --git a/pom.xml b/pom.xml index 64fe799..4f7a598 100644 --- a/pom.xml +++ b/pom.xml @@ -34,11 +34,10 @@ </parent> <groupId>io.jenkins.plugins</groupId> <artifactId>lib-durable-task</artifactId> - <packaging>jar</packaging> <version>${revision}${changelist}</version> <name>Durable Task Library</name> <description>Generates and packages the binaries used by Durable Task Plugin</description> - <url>http://maven.apache.org</url> + <url>https://github.com/jenkinsci/lib-durable-task</url> <licenses> <license> <name>MIT License</name> diff --git a/src/Dockerfile.linux b/src/Dockerfile.linux index b227886..aac9b19 100644 --- a/src/Dockerfile.linux +++ b/src/Dockerfile.linux @@ -1,6 +1,6 @@ ARG BASE_DIR=/durabletask -ARG NAME=dtmon -ARG VERSION=0.1 +ARG NAME=durable_task_monitor +ARG VERSION=0.0 FROM golang:1.16.4-buster AS builder ARG BASE_DIR diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index d006b35..d6864eb 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -1,6 +1,6 @@ ARG BASE_DIR=/durabletask -ARG NAME=dtmon -ARG VERSION=0.1 +ARG NAME=durable_task_monitor +ARG VERSION=0.0 FROM golang:1.16.4-nanoserver AS builder ARG BASE_DIR @@ -18,22 +18,19 @@ RUN set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %NAME%_ 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 +# TODO: WINDOWS # WORKDIR $BASE_DIR/cmd/windows # RUN go mod tidy # RUN go test -v -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 -# docker build --output requires BuildKit, not available for windows containers -# docker build -f Dockerfile.windows -t dtgen:test . -# docker create -ti --name dummy dtgen:test cmd -# docker cp dummy:/durabletask/dtmon_0.1_darwin_amd_64 . -# docker rm -f dummy \ No newline at end of file +# 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 \ No newline at end of file diff --git a/src/docker-generate-binaries.bat b/src/docker-generate-binaries.bat new file mode 100644 index 0000000..3f11874 --- /dev/null +++ b/src/docker-generate-binaries.bat @@ -0,0 +1,22 @@ +@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 +set VER=%1 +set DEST=%2 +set IMG_NAME=durable-task-binary-generator +set BINARY_NAME=durable_task_monitor +set OUTPUT_DIR=/durabletask/cmd/bash +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 \ No newline at end of file From 48efa4fe70f4ba2b9a29944253e7934a4afd8406 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sat, 8 May 2021 22:28:35 -0600 Subject: [PATCH 15/24] refactor pom to call simplified docker binary generation scripts --- pom.xml | 88 ++------------------------------ src/docker-generate-binaries.bat | 4 ++ src/docker-generate-binaries.sh | 7 +++ src/generate-binaries.bat | 14 ----- src/generate-binaries.sh | 10 ---- src/test-and-compile.bat | 45 ---------------- src/test-and-compile.sh | 42 --------------- 7 files changed, 16 insertions(+), 194 deletions(-) create mode 100755 src/docker-generate-binaries.sh delete mode 100644 src/generate-binaries.bat delete mode 100755 src/generate-binaries.sh delete mode 100644 src/test-and-compile.bat delete mode 100755 src/test-and-compile.sh diff --git a/pom.xml b/pom.xml index 4f7a598..58da674 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ <activeByDefault>true</activeByDefault> </activation> <properties> - <docker.creation.script>generate-binaries.sh</docker.creation.script> + <binary.generation.script>docker-generate-binaries.sh</binary.generation.script> </properties> </profile> <profile> @@ -89,7 +89,7 @@ </os> </activation> <properties> - <docker.creation.script>generate-binaries.bat</docker.creation.script> + <binary.generation.script>docker-generate-binaries.bat</binary.generation.script> </properties> </profile> </profiles> @@ -101,11 +101,11 @@ <artifactId>exec-maven-plugin</artifactId> <version>1.6.0</version> <configuration> - <executable>${project.build.directory}/src/${docker.creation.script}</executable> - <workingDirectory>${project.build.directory}/src</workingDirectory> + <executable>${project.basedir}/src/${binary.generation.script}</executable> + <workingDirectory>${project.basedir}/src</workingDirectory> <arguments> <argument>${revision}</argument> - <argument>${project.build.directory}/src</argument> + <argument>${project.build.directory}/classes</argument> </arguments> </configuration> <executions> @@ -118,85 +118,7 @@ </execution> </executions> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-resources-plugin</artifactId> - <version>3.2.0</version> - <executions> - <execution> - <id>copy-source</id> - <phase>generate-sources</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}</outputDirectory> - <overwrite>true</overwrite> - <resources> - <resource> - <directory>${project.basedir}</directory> - <includes> - <include>src/**</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - <execution> - <id>copy-test-results</id> - <phase>test</phase> - <goals> - <goal>copy-resources</goal> - </goals> - <configuration> - <outputDirectory>${project.build.directory}/surefire-reports/</outputDirectory> - <overwrite>true</overwrite> - <resources> - <resource> - <directory>${project.build.directory}/src/test-results</directory> - <includes> - <include>*</include> - </includes> - </resource> - </resources> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-enforcer-plugin</artifactId> - <version>3.0.0-M3</version> - <executions> - <execution> - <id>enforce-no-test-failures</id> - <phase>verify</phase> - <goals> - <goal>enforce</goal> - </goals> - <configuration> - <rules> - <requireFilesDontExist> - <files> - <file>${project.build.directory}/surefire-reports/failed</file> - </files> - </requireFilesDontExist> - </rules> - <fail>true</fail> - </configuration> - </execution> - </executions> - </plugin> </plugins> - <resources> - <resource> - <directory>${project.build.directory}/src/bin</directory> - <includes> - <include>durable_task_monitor_*_darwin_*</include> - <include>durable_task_monitor_*_unix_*</include> - </includes> - </resource> - </resources> </build> </project> diff --git a/src/docker-generate-binaries.bat b/src/docker-generate-binaries.bat index 3f11874..cafb69d 100644 --- a/src/docker-generate-binaries.bat +++ b/src/docker-generate-binaries.bat @@ -4,11 +4,15 @@ 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% diff --git a/src/docker-generate-binaries.sh b/src/docker-generate-binaries.sh new file mode 100755 index 0000000..35d3110 --- /dev/null +++ b/src/docker-generate-binaries.sh @@ -0,0 +1,7 @@ +#! /bin/sh +set -ex +# maven plugin version +VER=$1 +# output directory of binaries +DEST=$2 +docker build --build-arg VERSION=$VER -o $DEST -f Dockerfile.linux . \ No newline at end of file diff --git a/src/generate-binaries.bat b/src/generate-binaries.bat deleted file mode 100644 index 3f460aa..0000000 --- a/src/generate-binaries.bat +++ /dev/null @@ -1,14 +0,0 @@ -setlocal -@echo off - -rem maven plugin version -set VER=%1 -rem path to the golang source -set SRC=%2 -set IMG_NAME=durable-task-binary-generator -docker build --build-arg PLATFORM=nanoserver -t %IMG_NAME%:%VER% . -docker run -i --rm --mount type=bind,src=%SRC%,dst=C:\durabletask %IMG_NAME%:%VER% C:\durabletask\test-and-compile.bat %VER% -docker rmi %IMG_NAME%:%VER% - -@echo on -endlocal \ No newline at end of file diff --git a/src/generate-binaries.sh b/src/generate-binaries.sh deleted file mode 100755 index a8d21db..0000000 --- a/src/generate-binaries.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /bin/sh -set -ex -# maven plugin version -VER=$1 -# path to the golang source -SRC=$2 -IMG_NAME="durable-task-binary-generator" -docker build --build-arg PLATFORM="buster" -t ${IMG_NAME}:${VER} . -docker run -i --rm --mount type=bind,src=${SRC},dst=/durabletask ${IMG_NAME}:${VER} /durabletask/test-and-compile.sh ${VER} -docker rmi ${IMG_NAME}:${VER} \ No newline at end of file diff --git a/src/test-and-compile.bat b/src/test-and-compile.bat deleted file mode 100644 index f44d949..0000000 --- a/src/test-and-compile.bat +++ /dev/null @@ -1,45 +0,0 @@ -setlocal -@echo off - -rem maven plugin version -set VER=%1 -set BASEDIR=%CD% -set BIN=%BASEDIR%\bin -rem destination of the test reports -set TEST=%BASEDIR%\test-results -rem failure file -set FAILED=%TEST%\failed -set NAME=durable_task_monitor - -rem gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 -del /s /q %TEST% -mkdir %TEST% -cd %BASEDIR%\pkg\common -go mod tidy -rem https://golang.org/issue/36568 prevents downloading gotestsum, unable to generate junit test reports -rem go get -v gotest.tools/gotestsum@v0.4.2 -rem gotestsum --format standard-verbose --junitfile %TEST%\common-unit-tests.xml -go test -v -if NOT %ERRORLEVEL% == 0 echo command>>%FAILED% -rem TODO test windows -rem cd %BASEDIR%\cmd\windows -rem go mod tidy -rem go get -v gotest.tools/gotestsum@v0.4.2 -rem gotestsum --format standard-verbose --junitfile %TEST%\bash-unit-tests.xml -rem if NOT %ERRORLEVEL% == 0 echo windows>>%FAILED% - -rem build the binaries -del /s /q %BIN% -mkdir %BIN% -cd %BASEDIR%/cmd/bash -set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_darwin_64 -set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_darwin_32 -set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_unix_64 -set CGO_ENABLED=0& set GOOS=darwin& set GOARCH=amd64& go build -a -o %BIN%/%NAME%_%VER%_unix_32 -rem TODO build windows -dir %BIN% - -echo "binary generation complete." - -@echo on -endlocal \ No newline at end of file diff --git a/src/test-and-compile.sh b/src/test-and-compile.sh deleted file mode 100755 index 22a43c2..0000000 --- a/src/test-and-compile.sh +++ /dev/null @@ -1,42 +0,0 @@ -#! /bin/sh -set -x -# maven plugin version -VER=$1 -BASEDIR=${PWD} -# destination of generated binaries -BIN="${BASEDIR}/bin" -# destination of the test reports -TEST="${BASEDIR}/test-results" -# failure file -FAILED="${TEST}/failed" -NAME="durable_task_monitor" - -# gotestsum will generate junit test reports. v0.4.2 is the latest compatible with golang 1.14 -rm -rf "${TEST}" -mkdir -p "${TEST}" -cd ${BASEDIR}/pkg/common -go mod tidy -go get -v gotest.tools/gotestsum@v0.4.2 -if ! gotestsum --format standard-verbose --junitfile ${TEST}/common-unit-tests.xml -then - echo "common" >> ${FAILED} -fi -cd ${BASEDIR}/cmd/bash -go mod tidy -go get -v gotest.tools/gotestsum@v0.4.2 -if ! gotestsum --format standard-verbose --junitfile ${TEST}/bash-unit-tests.xml -then - echo "bash" >> ${FAILED} -fi - -# build the binaries -rm -rf ${BIN} -mkdir ${BIN} -cd ${BASEDIR}/cmd/bash -env CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -a -o ${BIN}/${NAME}_${VER}_darwin_64 -env CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -a -o ${BIN}/${NAME}_${VER}_darwin_32 -env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ${BIN}/${NAME}_${VER}_unix_64 -env CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -a -o ${BIN}/${NAME}_${VER}_unix_32 -# TODO build windows - -echo "binary generation complete." \ No newline at end of file From f8784c120ecc9ef69cb49206b059885f7f48faba Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sat, 8 May 2021 23:34:00 -0600 Subject: [PATCH 16/24] additional cleanup --- Jenkinsfile | 2 +- pom.xml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b1495c1..deaf68b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ #!/usr/bin/env groovy /* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ -// tests skipped because no surefire reports generated on windows. However, unit tests are still being run and will fail build if failed +// tests skipped because no junit reports generated. However, unit tests are still being run and will fail build if failed buildPlugin(failFast: false, tests: [skip: true], configurations: [ [ platform: "docker", jdk: "8", jenkins: null ], [ platform: "windock", jdk: "8", jenkins: null ], diff --git a/pom.xml b/pom.xml index 58da674..6f64312 100644 --- a/pom.xml +++ b/pom.xml @@ -74,9 +74,6 @@ <profiles> <profile> <id>linux</id> - <activation> - <activeByDefault>true</activeByDefault> - </activation> <properties> <binary.generation.script>docker-generate-binaries.sh</binary.generation.script> </properties> From ef79fc334efeb8b4db5926e0954aba524bff2b53 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sat, 8 May 2021 23:46:30 -0600 Subject: [PATCH 17/24] switch to parent pom for libraries, fix pom profile bug --- pom.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 6f64312..012e7c4 100644 --- a/pom.xml +++ b/pom.xml @@ -27,9 +27,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.jenkins-ci.plugins</groupId> - <artifactId>plugin</artifactId> - <version>4.18</version> + <groupId>org.jenkins-ci</groupId> + <artifactId>jenkins</artifactId> + <version>1.63</version> <relativePath /> </parent> <groupId>io.jenkins.plugins</groupId> @@ -73,7 +73,10 @@ <profiles> <profile> - <id>linux</id> + <id>bash</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> <properties> <binary.generation.script>docker-generate-binaries.sh</binary.generation.script> </properties> From 9194a82c35b54a96ab2ce19404fe800f205f1249 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sat, 8 May 2021 23:53:45 -0600 Subject: [PATCH 18/24] Fix dockerfiles --- src/Dockerfile.linux | 2 +- src/Dockerfile.windows | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Dockerfile.linux b/src/Dockerfile.linux index aac9b19..fc8b8cf 100644 --- a/src/Dockerfile.linux +++ b/src/Dockerfile.linux @@ -27,4 +27,4 @@ FROM scratch AS export-stage ARG BASE_DIR ARG NAME ARG VERSION -COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_* . +COPY --from=builder $BASE_DIR/cmd/bash/${NAME}_${VERSION}_* / diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index d6864eb..7a587a3 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -8,6 +8,7 @@ ARG NAME ARG VERSION ADD cmd $BASE_DIR/cmd ADD pkg $BASE_DIR/pkg +ENV GODEBUG=modcacheunzipinplace=1 WORKDIR $BASE_DIR/pkg/common RUN go mod tidy RUN go test -v From e0d05567db7dde98cb6d64dc8cbbec476cca8024 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sat, 8 May 2021 23:59:07 -0600 Subject: [PATCH 19/24] remove godebug variable, no longer recognized in 1.16 --- src/Dockerfile.windows | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index 7a587a3..d6864eb 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -8,7 +8,6 @@ ARG NAME ARG VERSION ADD cmd $BASE_DIR/cmd ADD pkg $BASE_DIR/pkg -ENV GODEBUG=modcacheunzipinplace=1 WORKDIR $BASE_DIR/pkg/common RUN go mod tidy RUN go test -v From c7651ed8737c1454ae207957a4d6a847c65dc34e Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sun, 9 May 2021 00:28:00 -0600 Subject: [PATCH 20/24] add disable read-only flag for windows container --- src/Dockerfile.windows | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index d6864eb..7840c6b 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -9,10 +9,10 @@ ARG VERSION ADD cmd $BASE_DIR/cmd ADD pkg $BASE_DIR/pkg WORKDIR $BASE_DIR/pkg/common -RUN go mod tidy +RUN go mod tidy -modcacherw RUN go test -v WORKDIR $BASE_DIR/cmd/bash -RUN go mod tidy +RUN go mod tidy -modcacherw # 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 From a071b0a59f14efa75e7586591ec52b38bb4d30fb Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sun, 9 May 2021 01:22:53 -0600 Subject: [PATCH 21/24] manually grab each dependency --- src/Dockerfile.windows | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index 7840c6b..2bd1532 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -9,10 +9,10 @@ ARG VERSION ADD cmd $BASE_DIR/cmd ADD pkg $BASE_DIR/pkg WORKDIR $BASE_DIR/pkg/common -RUN go mod tidy -modcacherw RUN go test -v WORKDIR $BASE_DIR/cmd/bash -RUN go mod tidy -modcacherw +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 From e9925635ee8a1a2cc165feb13445af77f27a57a2 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sun, 9 May 2021 01:53:58 -0600 Subject: [PATCH 22/24] document windows CI behavior --- src/Dockerfile.windows | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index 2bd1532..11ac640 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -11,6 +11,9 @@ ADD 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 From c20429452f5e76a6e4412a2aed659b725def3b4a Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Sun, 9 May 2021 01:56:40 -0600 Subject: [PATCH 23/24] removed incorrect comment --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index deaf68b..8a1c1a6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,7 @@ #!/usr/bin/env groovy /* `buildPlugin` step provided by: https://github.com/jenkins-infra/pipeline-library */ -// tests skipped because no junit reports generated. However, unit tests are still being run and will fail build if failed +// 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 ], From edf248cdcad1bfbdeffaf522df83184bc31be644 Mon Sep 17 00:00:00 2001 From: Carroll Chiou <cchiou@cloudbees.com> Date: Wed, 12 May 2021 07:46:00 -0600 Subject: [PATCH 24/24] set BUILD_KIT flag, change from ADD to COPY --- src/Dockerfile.linux | 4 ++-- src/Dockerfile.windows | 4 ++-- src/docker-generate-binaries.sh | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Dockerfile.linux b/src/Dockerfile.linux index fc8b8cf..8fa3bbf 100644 --- a/src/Dockerfile.linux +++ b/src/Dockerfile.linux @@ -6,8 +6,8 @@ FROM golang:1.16.4-buster AS builder ARG BASE_DIR ARG NAME ARG VERSION -ADD cmd $BASE_DIR/cmd -ADD pkg $BASE_DIR/pkg +COPY cmd $BASE_DIR/cmd +COPY pkg $BASE_DIR/pkg WORKDIR $BASE_DIR/pkg/common RUN go mod tidy RUN go test -v diff --git a/src/Dockerfile.windows b/src/Dockerfile.windows index 11ac640..b90a364 100644 --- a/src/Dockerfile.windows +++ b/src/Dockerfile.windows @@ -6,8 +6,8 @@ FROM golang:1.16.4-nanoserver AS builder ARG BASE_DIR ARG NAME ARG VERSION -ADD cmd $BASE_DIR/cmd -ADD pkg $BASE_DIR/pkg +COPY cmd $BASE_DIR/cmd +COPY pkg $BASE_DIR/pkg WORKDIR $BASE_DIR/pkg/common RUN go test -v WORKDIR $BASE_DIR/cmd/bash diff --git a/src/docker-generate-binaries.sh b/src/docker-generate-binaries.sh index 35d3110..d830b0d 100755 --- a/src/docker-generate-binaries.sh +++ b/src/docker-generate-binaries.sh @@ -4,4 +4,5 @@ set -ex VER=$1 # output directory of binaries DEST=$2 +export DOCKER_BUILDKIT=1 docker build --build-arg VERSION=$VER -o $DEST -f Dockerfile.linux . \ No newline at end of file