From 7d75db6126c0b172daa8c3ee08317bf43a1b3dde Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 24 Mar 2021 12:02:56 +0100 Subject: [PATCH 1/6] check codegen again --- .github/workflows/make-codegen.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/make-codegen.yml b/.github/workflows/make-codegen.yml index 0a0b3e36024..cd961170bb1 100644 --- a/.github/workflows/make-codegen.yml +++ b/.github/workflows/make-codegen.yml @@ -2,6 +2,9 @@ name: Code Generation on: schedule: - cron: "0 0/2 * * *" + push: + branches: + - 'feature/master/check-codegen' jobs: active-branches: From 3768d53cea0ab329f15d88235a31ddb0a485b9f0 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 24 Mar 2021 12:10:35 +0100 Subject: [PATCH 2/6] update to version of pull-request that no longer uses set-env --- .github/workflows/make-codegen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-codegen.yml b/.github/workflows/make-codegen.yml index cd961170bb1..95d002095ec 100644 --- a/.github/workflows/make-codegen.yml +++ b/.github/workflows/make-codegen.yml @@ -36,7 +36,7 @@ jobs: name: "code-gen ${{ matrix.branch }}" - name: "PR ${{ matrix.branch }}" # fixate to known release. - uses: peter-evans/create-pull-request@5ea31358e901bfaf28ca19849903d802fd0a891b + uses: peter-evans/create-pull-request@052fc72b4198ba9fbc81b818c6e1859f747d49a8 with: token: ${{ secrets.GITHUB_TOKEN }} branch: "fix/${{ matrix.branch }}/code-gen" From d9f9503ad84445d36e3aea2fbacda3e4220f97ed Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 24 Mar 2021 12:16:38 +0100 Subject: [PATCH 3/6] remove_last_downloaded_version.txt and move it into temp directory --- src/ApiGenerator/Configuration/GeneratorLocations.cs | 3 ++- src/ApiGenerator/last_downloaded_version.txt | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 src/ApiGenerator/last_downloaded_version.txt diff --git a/src/ApiGenerator/Configuration/GeneratorLocations.cs b/src/ApiGenerator/Configuration/GeneratorLocations.cs index 13ff28f9a6e..01a6d498eeb 100644 --- a/src/ApiGenerator/Configuration/GeneratorLocations.cs +++ b/src/ApiGenerator/Configuration/GeneratorLocations.cs @@ -11,7 +11,8 @@ public static class GeneratorLocations { // @formatter:off — disable formatter after this line public static string EsNetFolder { get; } = $@"{Root}../../src/Elasticsearch.Net/"; - public static string LastDownloadedRef { get; } = Path.Combine(Root, "last_downloaded_version.txt"); + + public static string LastDownloadedRef { get; } = Path.Combine(Path.GetTempPath(), "last_downloaded_version.txt"); public static string NestFolder { get; } = $@"{Root}../../src/Nest/"; public static string RestSpecificationFolder { get; } = $@"{Root}RestSpecification/"; diff --git a/src/ApiGenerator/last_downloaded_version.txt b/src/ApiGenerator/last_downloaded_version.txt deleted file mode 100644 index e5385a6ab9e..00000000000 --- a/src/ApiGenerator/last_downloaded_version.txt +++ /dev/null @@ -1 +0,0 @@ -47b8ea53cca02c74a34f4dcea0fb1274ee29b9d4 \ No newline at end of file From e7f0ae6f20fc40513a0896bb3eaf85c0b5589c9d Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 24 Mar 2021 12:56:51 +0100 Subject: [PATCH 4/6] run in docker as user not root so we do not have chown issues later --- .ci/DockerFile | 7 +++++++ .ci/make.sh | 4 +++- .ci/run-repository.sh | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.ci/DockerFile b/.ci/DockerFile index e09f0525222..08475cff57d 100644 --- a/.ci/DockerFile +++ b/.ci/DockerFile @@ -3,6 +3,13 @@ FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS elasticsearch-net-build WORKDIR /sln +ARG USER_ID +ARG GROUP_ID + +RUN addgroup --gid $GROUP_ID user +RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user +USER user + COPY ./*.sln ./nuget.config ./*.Build.props ./*.Build.targets ./ COPY ./dotnet-tools.json ./ diff --git a/.ci/make.sh b/.ci/make.sh index 06ffe960ace..8b9ade4971c 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -28,7 +28,9 @@ echo -e "\033[34;1mINFO:\033[0m DOTNET_VERSION ${DOTNET_VERSION}\033[0m" echo -e "\033[1m>>>>> Build [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" -docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . +docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . \ + --build-arg USER_ID=$(id -u) \ + --build-arg GROUP_ID=$(id -g) . echo -e "\033[1m>>>>> Run [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index d40465df8e9..f004f992c70 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -37,7 +37,9 @@ echo -e "\033[34;1mINFO:\033[0m DOTNET_VERSION ${DOTNET_VERSION}\033[0m" echo -e "\033[1m>>>>> Build [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" -docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . +docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . \ + --build-arg USER_ID=$(id -u) \ + --build-arg GROUP_ID=$(id -g) . echo -e "\033[1m>>>>> Run [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" From 7a2a75e7a7692396656bd048ac6ce7a1be9335c6 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 24 Mar 2021 13:23:40 +0100 Subject: [PATCH 5/6] update ownership in docker and no longer run as root --- .ci/DockerFile | 16 ++++++++++++---- .ci/make.sh | 8 +++++--- .ci/run-repository.sh | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.ci/DockerFile b/.ci/DockerFile index 08475cff57d..715212fa27b 100644 --- a/.ci/DockerFile +++ b/.ci/DockerFile @@ -1,15 +1,15 @@ ARG DOTNET_VERSION=5.0.103 FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION} AS elasticsearch-net-build -WORKDIR /sln - ARG USER_ID ARG GROUP_ID +RUN echo addgroup --gid $GROUP_ID user RUN addgroup --gid $GROUP_ID user RUN adduser --disabled-password --gecos '' --uid $USER_ID --gid $GROUP_ID user -USER user +WORKDIR /sln +RUN chown $GROUP_ID:$USER_ID $(pwd) COPY ./*.sln ./nuget.config ./*.Build.props ./*.Build.targets ./ COPY ./dotnet-tools.json ./ @@ -31,6 +31,11 @@ RUN for file in $(find . -name "*.?sproj"); do mkdir -p $(dirname $file)/$(basen COPY build/scripts/scripts.fsproj ./build/scripts/ COPY .ci/Jenkins.csproj ./.ci/ +RUN chown -R $GROUP_ID:$USER_ID $(pwd) +RUN chown -R $GROUP_ID:$USER_ID $(pwd) +RUN chown -R $GROUP_ID:$USER_ID /tmp/NuGetScratch +USER user + # Install app dependencies RUN dotnet restore @@ -38,4 +43,7 @@ RUN dotnet restore COPY . . # making sure enough git info is available inside the container -RUN git rev-parse HEAD . \ No newline at end of file +RUN git rev-parse HEAD . + + + diff --git a/.ci/make.sh b/.ci/make.sh index 8b9ade4971c..b2604b79807 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -28,9 +28,11 @@ echo -e "\033[34;1mINFO:\033[0m DOTNET_VERSION ${DOTNET_VERSION}\033[0m" echo -e "\033[1m>>>>> Build [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" -docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . \ - --build-arg USER_ID=$(id -u) \ - --build-arg GROUP_ID=$(id -g) . + echo --build-arg USER_ID="$(id -u)" \ + echo --build-arg GROUP_ID="$(id -g)" . +docker build --file .ci/DockerFile --tag elastic/elasticsearch-net \ + --build-arg USER_ID="$(id -u)" \ + --build-arg GROUP_ID="$(id -g)" . echo -e "\033[1m>>>>> Run [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" diff --git a/.ci/run-repository.sh b/.ci/run-repository.sh index f004f992c70..146c8736eb2 100755 --- a/.ci/run-repository.sh +++ b/.ci/run-repository.sh @@ -37,7 +37,7 @@ echo -e "\033[34;1mINFO:\033[0m DOTNET_VERSION ${DOTNET_VERSION}\033[0m" echo -e "\033[1m>>>>> Build [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" -docker build --file .ci/DockerFile --tag elastic/elasticsearch-net . \ +docker build --file .ci/DockerFile --tag elastic/elasticsearch-net \ --build-arg USER_ID=$(id -u) \ --build-arg GROUP_ID=$(id -g) . From cd9264c5dd4edfb1ad18ec3ccc15be1b5c30bf77 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Wed, 24 Mar 2021 13:30:19 +0100 Subject: [PATCH 6/6] remove branch check --- .ci/make.sh | 2 -- .github/workflows/make-codegen.yml | 3 --- 2 files changed, 5 deletions(-) diff --git a/.ci/make.sh b/.ci/make.sh index b2604b79807..349a5dc36af 100755 --- a/.ci/make.sh +++ b/.ci/make.sh @@ -28,8 +28,6 @@ echo -e "\033[34;1mINFO:\033[0m DOTNET_VERSION ${DOTNET_VERSION}\033[0m" echo -e "\033[1m>>>>> Build [elastic/elasticsearch-net container] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>\033[0m" - echo --build-arg USER_ID="$(id -u)" \ - echo --build-arg GROUP_ID="$(id -g)" . docker build --file .ci/DockerFile --tag elastic/elasticsearch-net \ --build-arg USER_ID="$(id -u)" \ --build-arg GROUP_ID="$(id -g)" . diff --git a/.github/workflows/make-codegen.yml b/.github/workflows/make-codegen.yml index 95d002095ec..b1f1aaf65d9 100644 --- a/.github/workflows/make-codegen.yml +++ b/.github/workflows/make-codegen.yml @@ -2,9 +2,6 @@ name: Code Generation on: schedule: - cron: "0 0/2 * * *" - push: - branches: - - 'feature/master/check-codegen' jobs: active-branches: