kgyrtkirk commented on code in PR #17700:
URL: https://github.com/apache/druid/pull/17700#discussion_r1944679319


##########
.github/scripts/run-unit-tests.sh:
##########
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+set -x
+
+JACOCO_REPORT_HASH="$(echo "$*" | md5sum | cut -d ' ' -f1)"

Review Comment:
   why not use `HASH` which the job should already have?



##########
.github/scripts/create-jacoco-coverage-report.sh:
##########
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+set -x
+
+echo "GITHUB_BASE_REF: ${GITHUB_BASE_REF}"
+
+echo "Setting up git remote"
+git remote set-branches --add origin ${GITHUB_BASE_REF}
+git fetch
+

Review Comment:
   I wonder if we could add this `worker.yml` instead of doing the same in the 
the `jacoco` related script - its not mandatory to name it `origin` 
   
   probably a more interesting question: is `GITHUB_BASE_REF` set when the 
check is running on a branch?



##########
.github/scripts/make-hash-for-artifact-name.sh:
##########
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -e
+set -x
+
+HASH=$(echo -n "$1" | sha256sum | cut -d' ' -f1 | cut -c1-8)
+echo "HASH=$HASH" >> $GITHUB_ENV

Review Comment:
   I wonder if this could probably be inlined into the `yml` ; as its not that 
much...especially if its compacted into a single line
   



##########
.github/workflows/worker.yml:
##########
@@ -0,0 +1,100 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: "Worker"
+
+on:
+  workflow_call:
+    inputs:
+      jdk:
+        required: false
+        type: string
+        default: '17'
+      script:
+        required: true
+        type: string
+        description: "Script to execute"
+      key:
+        required: false
+        type: string
+        description: "Key for the matrix"
+      artifact_prefix:
+        required: false
+        type: string
+        description: "Prefix for the artifact name"
+      artifacts_to_download:
+        required: false
+        type: string
+        description: "Artifacts to download. For example: 
'unit-test-reports-*'"
+
+env:
+  SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
+
+jobs:
+  execute:
+    name: "Execute (${{ inputs.key }})"
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 500
+
+      - uses: actions/setup-java@v4
+        with:
+          distribution: 'zulu'
+          java-version: ${{ inputs.jdk }}
+
+      - name: Download required artifacts
+        if: ${{ inputs.artifacts_to_download != '' }}
+        uses: actions/download-artifact@v4
+        with:
+          pattern: ${{ inputs.artifacts_to_download }}
+          merge-multiple: true
+
+      - name: Calculate hash for artifact name
+        run: |
+          ./.github/scripts/make-hash-for-artifact-name.sh "${{ inputs.key }}"
+
+      - name: 'Execute script: (${{ inputs.key }})'
+        run: |
+          ./${{ inputs.script }} 
+
+      - name: Check for dumps on failure
+        if: ${{ failure() }}
+        id: check_for_dumps
+        run: |
+          DUMP_FILES=$(find "${GITHUB_WORKSPACE}" \( -name '*.hprof' -or -name 
'hs_err_pid*' -or -name 'replay_pid*' -or -regex '.*/core\.[0-9]*' \))
+          
+          if [[ -n "$DUMP_FILES" ]]; then
+            tar -cvzf "${RUNNER_TEMP}/failure-dumps.tar.gz" ${DUMP_FILES}
+            echo "found_dumps=true" >> "$GITHUB_ENV"
+          fi
+
+      - name: Upload Dumps to GitHub
+        if: ${{ failure() && env.found_dumps == 'true' }}
+        uses: actions/upload-artifact@v4
+        with:
+          name: "Failure-${{ inputs.jdk }}-${{ env.HASH }}"
+          path: ${{ runner.temp }}/failure-dumps.tar.gz
+
+      - name: Upload reports

Review Comment:
   nit: shouldn't this be `Upload artifact` instead?



##########
.github/workflows/worker.yml:
##########
@@ -0,0 +1,100 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: "Worker"
+
+on:
+  workflow_call:
+    inputs:
+      jdk:
+        required: false
+        type: string
+        default: '17'
+      script:
+        required: true
+        type: string
+        description: "Script to execute"
+      key:
+        required: false
+        type: string
+        description: "Key for the matrix"
+      artifact_prefix:
+        required: false
+        type: string
+        description: "Prefix for the artifact name"
+      artifacts_to_download:
+        required: false
+        type: string
+        description: "Artifacts to download. For example: 
'unit-test-reports-*'"
+
+env:
+  SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5
+
+jobs:
+  execute:
+    name: "Execute (${{ inputs.key }})"
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 500
+
+      - uses: actions/setup-java@v4
+        with:
+          distribution: 'zulu'
+          java-version: ${{ inputs.jdk }}
+
+      - name: Download required artifacts
+        if: ${{ inputs.artifacts_to_download != '' }}
+        uses: actions/download-artifact@v4
+        with:
+          pattern: ${{ inputs.artifacts_to_download }}
+          merge-multiple: true
+
+      - name: Calculate hash for artifact name
+        run: |
+          ./.github/scripts/make-hash-for-artifact-name.sh "${{ inputs.key }}"
+
+      - name: 'Execute script: (${{ inputs.key }})'
+        run: |
+          ./${{ inputs.script }} 
+
+      - name: Check for dumps on failure
+        if: ${{ failure() }}
+        id: check_for_dumps
+        run: |
+          DUMP_FILES=$(find "${GITHUB_WORKSPACE}" \( -name '*.hprof' -or -name 
'hs_err_pid*' -or -name 'replay_pid*' -or -regex '.*/core\.[0-9]*' \))
+          
+          if [[ -n "$DUMP_FILES" ]]; then
+            tar -cvzf "${RUNNER_TEMP}/failure-dumps.tar.gz" ${DUMP_FILES}
+            echo "found_dumps=true" >> "$GITHUB_ENV"
+          fi

Review Comment:
   remove all this and the upload dumps as well
   add `**/*.hprof` ; `**/*.hs_err` and others to the artifact



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to