Skip to content

Commit 1ebf7f1

Browse files
ci: run selector bats in checks, harden flux install, 3-way fragment apply
- Run hack/build-matrix_test.bats and hack/select-e2e_test.bats in the checks job so a selector parse regression is caught in CI rather than shipping. - curl -fsSL the flux install so an HTTP error page is not piped to sudo bash. - git apply --3way in finalize so two fragments touching adjacent lines of a shared file merge instead of the second apply aborting the whole step. - Add least-privilege permissions: {contents: read} to the plan and checks jobs. Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent ba6763a commit 1ebf7f1

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎.github/workflows/build-main.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Set up build toolchain
6161
run: |
6262
command -v flux >/dev/null \
63-
|| curl -s https://fluxcd.io/install.sh | sudo bash
63+
|| curl -fsSL https://fluxcd.io/install.sh | sudo bash
6464
6565
- name: Set up Docker config
6666
run: |

‎.github/workflows/pull-requests.yaml‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
plan:
2222
name: Plan build
2323
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
2426
outputs:
2527
code: ${{ steps.p.outputs.code }}
2628
matrix: ${{ steps.p.outputs.matrix }}
@@ -57,6 +59,8 @@ jobs:
5759
name: Unit & controller tests
5860
runs-on: ${{ contains(github.event.pull_request.labels.*.name, 'debug') && 'self-hosted' || 'oracle-vm-4cpu-16gb-x86-64' }}
5961
timeout-minutes: 30
62+
permissions:
63+
contents: read
6064
needs: ["plan"]
6165
if: |
6266
needs.plan.outputs.code == 'true'
@@ -76,6 +80,10 @@ jobs:
7680
run: make unit-tests
7781
- name: Run controller Go tests
7882
run: make test-controllers
83+
- name: Run selector unit tests (bats)
84+
run: |
85+
command -v bats >/dev/null 2>&1 || { sudo apt-get update && sudo apt-get install -y bats; }
86+
bats hack/build-matrix_test.bats hack/select-e2e_test.bats
7987
8088
# One image (package) per job, fanned out across the ephemeral pool. Each job
8189
# gets its own buildx (docker-container driver) so the shared-buildkit
@@ -109,7 +117,7 @@ jobs:
109117
- name: Set up build toolchain
110118
run: |
111119
command -v flux >/dev/null \
112-
|| curl -s https://fluxcd.io/install.sh | sudo bash
120+
|| curl -fsSL https://fluxcd.io/install.sh | sudo bash
113121
- name: Set up Docker config
114122
run: |
115123
if [ -d ~/.docker ]; then
@@ -263,7 +271,7 @@ jobs:
263271
- name: Set up build toolchain
264272
run: |
265273
command -v flux >/dev/null \
266-
|| curl -s https://fluxcd.io/install.sh | sudo bash
274+
|| curl -fsSL https://fluxcd.io/install.sh | sudo bash
267275
- name: Download patch fragments
268276
uses: actions/download-artifact@v4
269277
with:
@@ -273,10 +281,14 @@ jobs:
273281
- name: Apply digest fragments
274282
run: |
275283
applied=0
284+
# Each fragment patches only its own package's files; --3way lets two
285+
# fragments that touch adjacent lines of a shared file (e.g. a package
286+
# Makefile that writes a sibling package's values.yaml) merge cleanly
287+
# instead of the second apply aborting the whole finalize.
276288
for f in _out/fragments/*.patch; do
277289
[ -s "$f" ] || continue
278290
echo "Applying $f"
279-
git apply "$f"
291+
git apply --3way "$f"
280292
applied=$((applied + 1))
281293
done
282294
echo "Applied $applied fragment(s)"

0 commit comments

Comments
 (0)