Skip to content

kalilinux

kalilinux #95

Workflow file for this run

---
name: kalilinux
on:
pull_request:
push:
paths:
- 'kalilinux/**'
- '.github/workflows/kalilinux.yml'
schedule:
- cron: '10 6,15 * * 1,6'
workflow_dispatch:
permissions: write-all
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
# Test the image builds and works correctly.
test:
name: Test kalilinux
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v4.1.1
- name: Test building image.
run: cd kalilinux && docker build -t kalilinux .
- name: Run the built image.
run: docker run --name test-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw kalilinux
# If on master branch, build and release image.
release:
name: Release
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{ github.repository }}:kalilinux
# generate Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push image.
uses: docker/build-push-action@v5
with:
context: kalilinux/
sbom: true
provenance: mode=max
file: kalilinux/Dockerfile
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ github.repository }}:kalilinux
labels: ${{ steps.meta.outputs.labels }}
- name: Docker Scout
id: docker-scout
if: ${{ github.event_name == 'pull_request' }}
uses: docker/scout-action@v1.6.3
with:
command: quickview,cves,recommendations,sbom,environment
image: ${{ steps.meta.outputs.tags }}
environment: prod
organization: shadownet
only-severities: critical,high,medium
exit-code: true
only-fixed: true