Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use text files to list build and runtime dependencies #873

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions .docker/prod-oldstable.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,19 @@ ARG DEBIAN_FRONTEND=noninteractive

# Install
COPY . /source
RUN sh /source/.github/install-build-dependencies.sh
RUN cmake -DCMAKE_BUILD_TYPE=Release -DOPENVASD=0 -B/build /source
RUN DESTDIR=/install cmake --build /build -- install
RUN sh /source/.github/install-dependencies.sh \
/source/.github/build-dependencies.list \
&& rm -rf /var/lib/apt/lists/*
RUN cmake -DCMAKE_BUILD_TYPE=Release -DOPENVASD=0 -B/build /source \
&& DESTDIR=/install cmake --build /build -j$(nproc) -- install

FROM debian:oldstable-slim

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcjson1 \
libgcrypt20 \
libglib2.0-0 \
libgnutls30 \
libgpgme11 \
libhiredis0.14 \
libldap-common \
libnet1 \
libpaho-mqtt1.3 \
libpcap0.8 \
libradcli4 \
libssh-4 \
libuuid1 \
libxml2 \
RUN --mount=type=bind,source=.github,target=/source/ \
sh /source/install-dependencies.sh \
/source/runtime-dependencies.oldstable.list \
&& rm -rf /var/lib/apt/lists/*

COPY --from=build /install/ /
Expand Down
28 changes: 8 additions & 20 deletions .docker/prod-testing.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,19 @@ ARG DEBIAN_FRONTEND=noninteractive

# Install
COPY . /source
RUN sh /source/.github/install-build-dependencies.sh
RUN cmake -DCMAKE_BUILD_TYPE=Release -B/build /source
RUN DESTDIR=/install cmake --build /build -- install
RUN sh /source/.github/install-dependencies.sh \
/source/.github/build-dependencies.list \
&& rm -rf /var/lib/apt/lists/*
RUN cmake -DCMAKE_BUILD_TYPE=Release -B/build /source \
&& DESTDIR=/install cmake --build /build -j$(nproc) -- install

FROM debian:testing-slim

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcjson1 \
libcurl3t64-gnutls \
libgcrypt20 \
libglib2.0-0 \
libgnutls30 \
libgpgme11 \
libhiredis1.1.0 \
libldap-common \
libnet1 \
libpaho-mqtt1.3 \
libpcap0.8 \
libradcli4 \
libssh-4 \
libuuid1 \
libxml2 \
RUN --mount=type=bind,source=.github,target=/source/ \
sh /source/install-dependencies.sh \
/source/runtime-dependencies.testing.list \
&& rm -rf /var/lib/apt/lists/*

COPY --from=build /install/ /
Expand Down
28 changes: 8 additions & 20 deletions .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,19 @@ ARG DEBIAN_FRONTEND=noninteractive

# Install
COPY . /source
RUN sh /source/.github/install-build-dependencies.sh
RUN cmake -DCMAKE_BUILD_TYPE=Release -B/build /source
RUN DESTDIR=/install cmake --build /build -j$(nproc) -- install
RUN sh /source/.github/install-dependencies.sh \
/source/.github/build-dependencies.list \
&& rm -rf /var/lib/apt/lists/*
RUN cmake -DCMAKE_BUILD_TYPE=Release -B/build /source \
&& DESTDIR=/install cmake --build /build -j$(nproc) -- install

FROM debian:stable-slim

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcjson1 \
libcurl3-gnutls \
libgcrypt20 \
libglib2.0-0 \
libgnutls30 \
libgpgme11 \
libhiredis0.14 \
libldap-common \
libnet1 \
libpaho-mqtt1.3 \
libpcap0.8 \
libradcli4 \
libssh-4 \
libuuid1 \
libxml2 \
RUN --mount=type=bind,source=.github,target=/source/ \
sh /source/install-dependencies.sh \
/source/runtime-dependencies.stable.list \
&& rm -rf /var/lib/apt/lists/*

COPY --from=build /install/ /
Expand Down
21 changes: 21 additions & 0 deletions .github/build-dependencies.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
build-essential
cmake
curl
gnupg
lcov
libcjson-dev
libcurl4-gnutls-dev
libgcrypt-dev
libglib2.0-dev
libgnutls28-dev
libgpgme-dev
libhiredis-dev
libldap2-dev
libnet1-dev
libpaho-mqtt-dev
libpcap-dev
libradcli-dev
libssh-dev
libxml2-dev
pkg-config
uuid-dev
28 changes: 0 additions & 28 deletions .github/install-build-dependencies.sh

This file was deleted.

16 changes: 16 additions & 0 deletions .github/install-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# This script installs gvm-libs dependencies
set -e

BASEDIR=$(dirname "$0")
DEFAULT_DEPENDENCIES_FILE="$BASEDIR/build-dependencies.list"
DEPENDENCIES_FILE=${1:-$DEFAULT_DEPENDENCIES_FILE}

if [[ ! -f "$DEPENDENCIES_FILE" ]]; then
echo "Dependencies file not found: $DEPENDENCIES_FILE"
exit 1
fi

apt-get update && \
apt-get install -y --no-install-recommends --no-install-suggests \
$(grep -v '#' "$DEPENDENCIES_FILE")
14 changes: 14 additions & 0 deletions .github/runtime-dependencies.oldstable.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
libcjson1
libgcrypt20
libglib2.0-0
libgnutls30
libgpgme11
libhiredis0.14
libldap-common
libnet1
libpaho-mqtt1.3
libpcap0.8
libradcli4
libssh-4
libuuid1
libxml2
15 changes: 15 additions & 0 deletions .github/runtime-dependencies.stable.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
libcjson1
libcurl3-gnutls
libgcrypt20
libglib2.0-0
libgnutls30
libgpgme11
libhiredis0.14
libldap-common
libnet1
libpaho-mqtt1.3
libpcap0.8
libradcli4
libssh-4
libuuid1
libxml2
15 changes: 15 additions & 0 deletions .github/runtime-dependencies.testing.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
libcjson1
libcurl3t64-gnutls
libgcrypt20
libglib2.0-0
libgnutls30
libgpgme11
libhiredis1.1.0
libldap-common
libnet1
libpaho-mqtt1.3
libpcap0.8
libradcli4
libssh-4
libuuid1
libxml2
3 changes: 2 additions & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: 'Build Documentation'

on:
push:
branches: [ main, stable, oldstable ]
branches:
- main

jobs:
generate-doc-and-upload-coverage:
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/ci-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ name: Build and test C

on:
push:
branches: [ main, oldstable, stable ]
branches:
- main
pull_request:
branches: [ main, oldstable, stable ]

branches:
- main

jobs:
c-format-check:
Expand All @@ -21,18 +22,17 @@ jobs:
tests:
name: Unit Tests
runs-on: 'ubuntu-latest'
container: greenbone/gvm-libs:edge
container: debian:stable-slim
steps:
- name: Install git for Codecov uploader
run: |
apt-get update
apt-get install --no-install-recommends -y ca-certificates git
rm -rf /var/lib/apt/lists/*
- uses: actions/checkout@v4
- name: Set git safe.directory
run: git config --global --add safe.directory '*'
- name: Install build dependencies
run: sh .github/install-build-dependencies.sh
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Install cgreen
uses: greenbone/actions/install-cgreen@v3
- name: Configure and Compile gvm-libs
Expand All @@ -52,19 +52,18 @@ jobs:
scan-build:
name: Scan-build gvm-libs with clang
runs-on: 'ubuntu-latest'
container: greenbone/gvm-libs:edge
container: debian:stable-slim
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
run: sh .github/install-build-dependencies.sh
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Install clang tools
run: |
apt update
apt install --no-install-recommends -y clang clang-format clang-tools
rm -rf /var/lib/apt/lists/*
apt-get install --no-install-recommends -y clang clang-format clang-tools
- name: Configure and Scan Build gvm-libs
run: |
cmake -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake -B build -DCMAKE_BUILD_TYPE=Release
scan-build -o ~/scan-build-report cmake --build build
- name: Upload scan-build report
if: failure()
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/codeql-analysis-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ name: "CodeQL"

on:
push:
branches: [ main, oldstable, stable ]
branches:
- main
pull_request:
branches: [ main, oldstable, stable ]
branches:
- main
paths-ignore:
- '**/*.md'
- '**/*.txt'
Expand All @@ -31,7 +33,7 @@ jobs:
uses: actions/checkout@v4

- name: Install build dependencies
run: sh .github/install-build-dependencies.sh
run: sh .github/install-dependencies.sh .github/build-dependencies.list
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ name: Build & Push Container Images

on:
push:
branches: [ main ]
tags: ["v*"]
branches:
- main
tags:
- "v*"
pull_request:
branches: [ main ]
branches:
- main
workflow_dispatch:
inputs:
ref-name:
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sbom-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ name: SBOM upload
on:
workflow_dispatch:
push:
branches: ["main"]
branches:
- main

jobs:
SBOM-upload:
runs-on: ubuntu-latest
Expand Down
Loading