Skip to content

Commit 57dde64

Browse files
Merge pull request #1377 from TheHive-Project/ci-improvements-3
CI - Revert to Python-slim builds for K8S compatibility
2 parents 7941839 + d9b5b05 commit 57dde64

1 file changed

Lines changed: 35 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,19 @@ jobs:
145145
command_value="${{ env.COMMAND }}"
146146
147147
# Add multiple workers separated by spaces
148-
special_alpine_workers="PaloAltoNGFW Worker2 Worker3 AnotherWorker"
148+
#special_alpine_workers="PaloAltoNGFW Worker2 Worker3 AnotherWorker"
149149
150150
if [ ! -f "$dockerfile_path" ]; then
151151
echo "Dockerfile not found in $dockerfile_path. Creating one..."
152-
echo "FROM python:3-alpine" > "$dockerfile_path"
153-
echo "RUN apk add --no-cache openssl ca-certificates" >> "$dockerfile_path"
152+
#echo "FROM python:3-alpine" > "$dockerfile_path"
153+
#echo "RUN apk add --no-cache openssl ca-certificates" >> "$dockerfile_path"
154+
echo "FROM python:3-slim" > "$dockerfile_path"
155+
# echo "RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*" >> "$dockerfile_path"
154156
155157
# Check if current worker is among special alpine workers
156-
if echo "$special_alpine_workers" | grep -qw "$matrix_directory"; then
157-
echo "RUN apk add --no-cache file-dev && rm -rf /var/cache/apk/*" >> "$dockerfile_path"
158-
fi
158+
#if echo "$special_alpine_workers" | grep -qw "$matrix_directory"; then
159+
# echo "RUN apk add --no-cache file-dev && rm -rf /var/cache/apk/*" >> "$dockerfile_path"
160+
#fi
159161
160162
echo "WORKDIR /worker" >> "$dockerfile_path"
161163
echo "COPY requirements.txt ${matrix_directory}/" >> "$dockerfile_path"
@@ -272,6 +274,16 @@ jobs:
272274
org.opencontainers.image.url=https://thehive-project.org
273275
org.opencontainers.image.version=${{ env.VERSION }}
274276
277+
- name: Scan image for vulnerabilities (Trivy)
278+
uses: aquasecurity/trivy-action@0.32.0
279+
with:
280+
image-ref: ghcr.io/${{ env.LOWER_REPO_OWNER }}/${{ env.LOWERCASE_NAME }}:${{ env.IMAGE_TAG }}
281+
format: table
282+
vuln-type: 'os,library'
283+
severity: 'CRITICAL,HIGH'
284+
exit-code: 0
285+
ignore-unfixed: true
286+
275287
- name: Test imports in the container (amd64)
276288
if: ${{ steps.check-rebuild.outputs.rebuild == 'true' && contains(env.PLATFORMS, 'linux/amd64') }}
277289
run: |
@@ -553,18 +565,18 @@ jobs:
553565
command_value="${{ env.COMMAND }}"
554566
555567
# Add multiple workers separated by spaces
556-
special_alpine_workers="PaloAltoNGFW Worker2 Worker3 AnotherWorker"
568+
# special_alpine_workers="PaloAltoNGFW Worker2 Worker3 AnotherWorker"
557569
558570
if [ ! -f "$dockerfile_path" ]; then
559571
echo "Dockerfile not found in $dockerfile_path. Creating one..."
560-
echo "FROM python:3-alpine" > "$dockerfile_path"
561-
echo "RUN apk add --no-cache openssl ca-certificates" >> "$dockerfile_path"
562-
572+
# echo "FROM python:3-alpine" > "$dockerfile_path"
573+
# echo "RUN apk add --no-cache openssl ca-certificates bind-tools" >> "$dockerfile_path"
574+
echo "FROM python:3-slim" > "$dockerfile_path"
563575
564576
# Check if current worker is among special alpine workers
565-
if echo "$special_alpine_workers" | grep -qw "$matrix_directory"; then
566-
echo "RUN apk add --no-cache file-dev && rm -rf /var/cache/apk/*" >> "$dockerfile_path"
567-
fi
577+
#if echo "$special_alpine_workers" | grep -qw "$matrix_directory"; then
578+
# echo "RUN apk add --no-cache file-dev && rm -rf /var/cache/apk/*" >> "$dockerfile_path"
579+
#fi
568580
569581
echo "WORKDIR /worker" >> "$dockerfile_path"
570582
echo "COPY requirements.txt ${matrix_directory}/" >> "$dockerfile_path"
@@ -682,6 +694,16 @@ jobs:
682694
org.opencontainers.image.url=https://thehive-project.org
683695
org.opencontainers.image.version=${{ env.VERSION }}
684696
697+
- name: Scan image for vulnerabilities (Trivy)
698+
uses: aquasecurity/trivy-action@0.32.0
699+
with:
700+
image-ref: ghcr.io/${{ env.LOWER_REPO_OWNER }}/${{ env.LOWERCASE_NAME }}:${{ env.IMAGE_TAG }}
701+
format: table
702+
vuln-type: 'os,library'
703+
severity: 'CRITICAL,HIGH'
704+
exit-code: 0
705+
ignore-unfixed: true
706+
685707
- name: Test imports in the container (amd64)
686708
if: ${{ steps.check-rebuild.outputs.rebuild == 'true' && contains(env.PLATFORMS, 'linux/amd64') }}
687709
run: |

0 commit comments

Comments
 (0)