github-advanced-security[bot] commented on code in PR #2244:
URL: 
https://github.com/apache/datafusion-ballista/pull/2244#discussion_r3735533352


##########
.github/workflows/k8s-chaos.yml:
##########
@@ -0,0 +1,104 @@
+# 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.
+
+# Kubernetes (kind) chaos scenarios. Gated: runs only when the chaos harness,
+# the engine, or the docker artifacts change, plus nightly and on demand — it 
is
+# deliberately off the per-PR critical path, since the process-based chaos
+# harness already covers HA on every PR.
+name: k8s-chaos
+
+on:
+  pull_request:
+    paths:
+      - "chaos-testing/**"
+      - "ballista/**"
+      - "Cargo.toml"
+      - "Cargo.lock"
+      - "rust-toolchain.toml"
+      - "dev/docker/chaos.Dockerfile"
+      - "dev/build-chaos-docker.sh"
+      - ".github/workflows/k8s-chaos.yml"
+      # docs-only changes cannot affect this job; exclusions are applied last
+      - "!**/*.md"
+  schedule:
+    - cron: "0 6 * * *"
+  workflow_dispatch:
+
+concurrency:
+  group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ 
github.workflow }}
+  cancel-in-progress: true
+
+jobs:
+  k8s-chaos:
+    name: kind chaos scenarios
+    runs-on: ubuntu-latest
+    timeout-minutes: 45
+    steps:
+      - name: Checkout
+        uses: actions/[email protected]
+        with:
+          fetch-depth: 1
+
+      - name: Install protoc
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y protobuf-compiler
+
+      - name: Setup Rust toolchain
+        run: |
+          rustup update stable
+          rustup toolchain install stable
+          rustup default stable
+
+      - uses: swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 
#2.9.1
+
+      - name: Create the fixture mount directory
+        run: mkdir -p /tmp/ballista-chaos-fixtures
+
+      - name: Build the chaos image
+        run: ./dev/build-chaos-docker.sh
+
+      - name: Install kubectl
+        uses: azure/setup-kubectl@v4
+
+      - name: Create kind cluster
+        uses: helm/kind-action@v1
+        with:
+          cluster_name: ballista-chaos
+          config: chaos-testing/k8s/kind-config.yaml
+
+      - name: Load the chaos image into kind
+        run: kind load docker-image ballista-chaos:test --name ballista-chaos
+
+      - name: Run the kind chaos scenarios
+        env:
+          CHAOS_BACKEND: kind
+          # Match the extraMounts path in chaos-testing/k8s/kind-config.yaml. 
On
+          # Linux runners the kind node binds host paths directly, so /tmp is
+          # fine (the $HOME default is only needed for macOS Docker Desktop).
+          CHAOS_FIXTURE_DIR: /tmp/ballista-chaos-fixtures
+        run: |
+          cargo test -p ballista-chaos --features k8s --test k8s -- 
--test-threads=1 --nocapture
+
+      - name: Dump cluster state on failure
+        if: failure()
+        run: |
+          kubectl get pods -A -o wide || true
+          for ns in $(kubectl get ns -o name | grep chaos- || true); do
+            kubectl logs -n "${ns#namespace/}" -l app=ballista-scheduler 
--tail=-1 || true
+            kubectl logs -n "${ns#namespace/}" -l app=ballista-executor 
--all-containers --tail=-1 || true
+          done

Review Comment:
   ## CodeQL / Workflow does not contain permissions
   
   Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. 
Consider setting an explicit permissions block, using the following as a 
minimal starting point: {{contents: read}}
   
   [Show more 
details](https://github.com/apache/datafusion-ballista/security/code-scanning/67)



-- 
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