From b053ad9d57f6beed1fd0a32adb46eadd6265f701 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 10:48:41 +0100 Subject: [PATCH 1/7] Updates make assemble to produce a zip file Since the unified build needs a single artifact (zip or tar.gz) --- .ci/make.sh | 9 ++++++++- build/scripts/Targets.fs | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.ci/make.sh b/.ci/make.sh index b67b46f8701..8c813e72993 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -11,6 +11,7 @@ repo=$(realpath "$script_path/../") # shellcheck disable=SC1090 CMD=$1 TASK=$1 +TASK_ARGS=() VERSION=$2 STACK_VERSION=$VERSION set -euo pipefail @@ -32,8 +33,14 @@ docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . echo -e "\033[1m>>>>> Run [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" case $CMD in + clean) + echo -e "\033[36;1mRemoving $output_folder\033[0m" + TASK=clean + rm -rf "$output_folder" + ;; assemble) TASK=release + TASK_ARGS=("$VERSION" "$output_folder" "skiptests") ;; *) echo -e "\nUsage:\n\t $CMD is not supported right now\n" @@ -47,4 +54,4 @@ docker run \ --volume "${OUTPUT_DIR}:/sln/${output_folder}" \ --rm \ elastic/elasticsearch-net \ - ./build.sh $TASK "$VERSION" "$output_folder" "skiptests" + ./build.sh $TASK "${TASK_ARGS[@]}" diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index fc43a0b3a98..7ed1d6563dd 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -10,6 +10,7 @@ open System.IO open Bullseye open ProcNet open Fake.Core +open Fake.IO.Globbing.Operators module Main = @@ -60,7 +61,7 @@ module Main = let canaryChain = [ "version"; "release"; "test-nuget-package";] // the following are expected to be called as targets directly - conditional "clean" parsed.ReleaseBuild <| fun _ -> Build.Clean parsed + conditional "clean" (parsed.ReleaseBuild || parsed.Target = "clean") <| fun _ -> Build.Clean parsed target "version" <| fun _ -> printfn "Artifacts Version: %O" artifactsVersion target "restore" Build.Restore @@ -92,6 +93,13 @@ module Main = printfn "Finished Release Build %O, artifacts available at: %s" artifactsVersion Paths.BuildOutput | Some path -> Fake.IO.Shell.cp_r Paths.BuildOutput path + let zipName = sprintf "elasticsearch-net-%O.zip" artifactsVersion.Full + let outputZip = Path.Combine(path, zipName) + Fake.IO.Zip.zipOfIncludes outputZip + ["", + !! (sprintf "%s/*.*" path) + -- outputZip + ] printfn "Finished Release Build %O, output copied to: %s" artifactsVersion path conditional "test-nuget-package" (not parsed.SkipTests) <| fun _ -> Tests.RunReleaseUnitTests artifactsVersion parsed From e3e3701b940b1238bd071f963fbe24f8cd6bddd6 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 13:13:46 +0100 Subject: [PATCH 2/7] make sure the zip file is flattened --- .ci/make.sh | 2 +- build/scripts/Targets.fs | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.ci/make.sh b/.ci/make.sh index 8c813e72993..f3d0e6c0ff1 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -34,7 +34,7 @@ echo -e "\033[1m>>>>> Run [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>> case $CMD in clean) - echo -e "\033[36;1mRemoving $output_folder\033[0m" + echo -e "\033[36;1mRemoving $output_folder\033[0m" TASK=clean rm -rf "$output_folder" ;; diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 7ed1d6563dd..c36d1810b75 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -95,11 +95,8 @@ module Main = Fake.IO.Shell.cp_r Paths.BuildOutput path let zipName = sprintf "elasticsearch-net-%O.zip" artifactsVersion.Full let outputZip = Path.Combine(path, zipName) - Fake.IO.Zip.zipOfIncludes outputZip - ["", - !! (sprintf "%s/*.*" path) - -- outputZip - ] + let files = !! (sprintf "%s/*.*" path) -- outputZip + Fake.IO.Zip.createZip "." outputZip "elastic/elasticsearch-net artifact" 9 true files printfn "Finished Release Build %O, output copied to: %s" artifactsVersion path conditional "test-nuget-package" (not parsed.SkipTests) <| fun _ -> Tests.RunReleaseUnitTests artifactsVersion parsed From b96ab6c039e9809a307f8f2543438561366c3076 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 13:30:13 +0100 Subject: [PATCH 3/7] add unified release to github actions --- .github/workflows/unified-release.yml | 44 +++++++++++++++++++++++++++ build/scripts/scripts.fsproj | 3 ++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/unified-release.yml diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml new file mode 100644 index 00000000000..1e62e4bc079 --- /dev/null +++ b/.github/workflows/unified-release.yml @@ -0,0 +1,44 @@ +name: Unified Release + + +on: + pull_request: + paths-ignore: + - 'README.md' + - '.editorconfig' + push: + paths-ignore: + - 'README.md' + - '.editorconfig' + branches: + - main + - master + - '[0-9]+.[0-9]+' + - '[0-9]+.x' + +jobs: + assemble: + name: Assemble + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + stack_version: [ '8.0.0-SNAPSHOT'] + + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: actions/setup-dotnet@v1 + with: + dotnet-version: '5.0.100' + - uses: satackey/action-docker-layer-caching@v0.0.11 + # Ignore the failure of a step and avoid terminating the job. + continue-on-error: true + with: + key: make-docker-cache-{hash} + restore-keys: | + make-docker-cache- + + - run: "./.ci/make.sh assemble ${{ matrix.stack_version }}" + name: ${{ matrix.stack_version }} + diff --git a/build/scripts/scripts.fsproj b/build/scripts/scripts.fsproj index 8f5b63c4c6f..eaaa1800d1c 100644 --- a/build/scripts/scripts.fsproj +++ b/build/scripts/scripts.fsproj @@ -28,6 +28,9 @@ test-jobs.yml stale-jobs.yml integration-jobs.yml + + unified-release.yml + From ec96782837476a208d8df84388576992efd5873f Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 13:32:05 +0100 Subject: [PATCH 4/7] fix workflow indendaton --- .github/workflows/unified-release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml index 1e62e4bc079..746984c4e49 100644 --- a/.github/workflows/unified-release.yml +++ b/.github/workflows/unified-release.yml @@ -32,11 +32,11 @@ jobs: with: dotnet-version: '5.0.100' - uses: satackey/action-docker-layer-caching@v0.0.11 - # Ignore the failure of a step and avoid terminating the job. - continue-on-error: true - with: - key: make-docker-cache-{hash} - restore-keys: | + # Ignore the failure of a step and avoid terminating the job. + continue-on-error: true + with: + key: make-docker-cache-{hash} + restore-keys: | make-docker-cache- - run: "./.ci/make.sh assemble ${{ matrix.stack_version }}" From 7e3c186539d46465f83702faa4cd41e227ad1ace Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 13:38:33 +0100 Subject: [PATCH 5/7] Empty update to check caching of docker image From 5918b9913393fa1ce7e49de1f63b12a00f53f041 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 13:45:29 +0100 Subject: [PATCH 6/7] Empty update to check caching of docker image --- .github/workflows/unified-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml index 746984c4e49..0bc808b3e36 100644 --- a/.github/workflows/unified-release.yml +++ b/.github/workflows/unified-release.yml @@ -40,5 +40,5 @@ jobs: make-docker-cache- - run: "./.ci/make.sh assemble ${{ matrix.stack_version }}" - name: ${{ matrix.stack_version }} + name: Assembke ${{ matrix.stack_version }} From dea43c9eaee15050184eba3549ca6229c4c29691 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 16 Mar 2021 14:17:46 +0100 Subject: [PATCH 7/7] caching layers is slow? --- .github/workflows/unified-release.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/unified-release.yml b/.github/workflows/unified-release.yml index 0bc808b3e36..3e1a2a0257e 100644 --- a/.github/workflows/unified-release.yml +++ b/.github/workflows/unified-release.yml @@ -31,14 +31,7 @@ jobs: - uses: actions/setup-dotnet@v1 with: dotnet-version: '5.0.100' - - uses: satackey/action-docker-layer-caching@v0.0.11 - # Ignore the failure of a step and avoid terminating the job. - continue-on-error: true - with: - key: make-docker-cache-{hash} - restore-keys: | - make-docker-cache- - run: "./.ci/make.sh assemble ${{ matrix.stack_version }}" - name: Assembke ${{ matrix.stack_version }} + name: Assemble ${{ matrix.stack_version }}