Skip to content

Commit

Permalink
Pktvisor release 4.3.0
Browse files Browse the repository at this point in the history
Pktvisor release 4.3.0
  • Loading branch information
etaques authored Apr 24, 2023
2 parents 1309121 + 087e1da commit 3fc9673
Show file tree
Hide file tree
Showing 148 changed files with 6,827 additions and 1,423 deletions.
8 changes: 4 additions & 4 deletions .github/actions/build-cpp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM debian:bullseye-slim

LABEL author="Everton Haise Taques <[email protected]>"
LABEL maintainer="NS1 Labs"
LABEL maintainer="Orb Community"
LABEL version="1.0.0"

ENV BUILD_DEPS "g++ cmake make git pkgconf jq python3-pip python3-setuptools ca-certificates libasan6 zip curl python"
ENV BUILD_DEPS "g++ cmake make git pkgconf jq python3-pip python3-setuptools ca-certificates libasan6 zip curl python wget"

COPY ./entrypoint.sh /entrypoint.sh

Expand All @@ -15,8 +15,8 @@ WORKDIR /pktvisor-src
RUN apt-get update && \
apt-get upgrade --yes --force-yes && \
apt-get install --yes --force-yes --no-install-recommends ${BUILD_DEPS} && \
pip3 install conan

pip3 install 'conan==1.59.0' --force-reinstall
RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
Expand Down
18 changes: 14 additions & 4 deletions .github/actions/build-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
name: 'docker'
author: 'Everton Haise Taques <[email protected]>'
description: 'NS1 Labs'
description: 'Orb Community'

inputs:
context:
description: "Docker build context"
required: true
default: "./"

symbol_url:
description: "symbol url"
bugsplat_key:
description: "bugsplat key"
required: true
default: ""

bugsplat_symbol_url:
description: "bugsplat symbol url"
required: true
default: ""

build_type:
description: "build type"
required: true
default: "Debug"

bugsplat:
description: "bugsplat active"
required: true
default: "true"

asan:
description: "asan"
required: true
Expand Down
31 changes: 21 additions & 10 deletions .github/actions/build-cpp/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
function validateParams() {
echo "========================= Checking parameters ========================="
[[ -z $INPUT_SYMBOL_URL ]] && echo "Backtrace symbol url is required" && exit 1 || echo "Backtrace symbol url present"
[[ -z $INPUT_BUGSPLAT_SYMBOL_URL ]] && echo "Bugsplat symbol url is required" && exit 1 || echo "Bugsplat symbol url pŕesent"
}

function build() {
Expand All @@ -14,41 +14,52 @@ function build() {
cp -rf /github/workspace/libs/ /pktvisor-src/libs/
cp -rf /github/workspace/docker/ /pktvisor-src/docker/
cp -rf /github/workspace/golang/ /pktvisor-src/golang/
cp -rf /github/workspace/build/ /pktvisor-src/build/
cp -rf /github/workspace/integration_tests/ /pktvisor-src/integration_tests/
cp -rf /github/workspace/cmake/ /pktvisor-src/cmake/
cp -rf /github/workspace/CMakeLists.txt /pktvisor-src/
cp -rf /github/workspace/conanfile.txt /pktvisor-src/
mkdir /tmp/build
cd /tmp/build
cp -rf /pktvisor-src/build/conan_home/ .
chmod -R 777 /tmp/build/conan_home/
conan profile new --detect default
conan profile update settings.compiler.libcxx=libstdc++11 default
conan config set general.revisions_enabled=1
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE -DASAN=$INPUT_ASAN /pktvisor-src
make all -j 4
}

function compact() {
function move() {
echo "========================= Compacting binary and copying ========================="
cd /tmp/build
zip pktvisord.zip /tmp/build/bin/pktvisord
cp -rf /tmp/build/bin/pktvisord /github/workspace/
strip -s /tmp/build/bin/crashpad_handler
cp -rf /tmp/build/bin/crashpad_handler /github/workspace/
cp -rf /tmp/build/bin/pktvisor-reader /github/workspace/
cp -rf /tmp/build/VERSION /github/workspace/
#version for pktvisor-cli
chmod -R 777 /tmp/build/conan_home/
cp -rf /tmp/build/conan_home/ /github/workspace/build/
cp -rf /pktvisor-src/golang/pkg/client/version.go /github/workspace/version.go
#copy pktvisor custom iana port service names file
cp -rf /pktvisor-src/src/tests/fixtures/pktvisor-port-service-names.csv /github/workspace/custom-iana.csv
}

function publish() {
echo "========================= Publishing symbol to backtrace ========================="
function publishToBugsplat() {
echo "========================= Publishing symbol to bugsplat ========================="
cd /tmp/build
curl --data-binary @pktvisord.zip -H "Expect: gzip" "${INPUT_SYMBOL_URL}"
if [ "$INPUT_BUGSPLAT" == "true" ]; then
wget https://github.com/orb-community/CrashpadTools/raw/main/linux/dump_syms
chmod a+x ./dump_syms
wget https://github.com/orb-community/CrashpadTools/raw/main/linux/symupload
chmod a+x ./symupload
./dump_syms /github/workspace/pktvisord > pktvisor.sym
PKTVISOR_VERSION=$(cat VERSION)
ls -lha
./symupload -k $INPUT_BUGSPLAT_KEY pktvisor.sym $INPUT_BUGSPLAT_SYMBOL_URL$PKTVISOR_VERSION 2>/dev/null
fi
}

validateParams
build
compact
publish
move
publishToBugsplat
2 changes: 1 addition & 1 deletion .github/actions/build-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:latest

LABEL author="Everton Haise Taques <[email protected]>"
LABEL maintainer="NS1 Labs"
LABEL maintainer="netboxlabs"
LABEL version="1.0.0"

COPY ./entrypoint.sh /entrypoint.sh
Expand Down
12 changes: 11 additions & 1 deletion .github/actions/build-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ inputs:
description: "Dockerfile used to build the image"
required: true
default: "./Dockerfile"

goos:
description: "OS for cross-build"
required: false
default: "linux"

goarch:
description: "ARCH for cross-build"
required: false
default: "amd64"

runs:
using: 'docker'
image: 'Dockerfile'


4 changes: 2 additions & 2 deletions .github/actions/build-go/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function build() {
# Copying this from previous build (cpp)
cp -rf ./version.go /src/pkg/client/version.go
cd /src
go build -o pktvisor-cli cmd/pktvisor-cli/main.go
GOOS=$INPUT_GOOS GOARCH=$INPUT_GOARCH go build -o pktvisor-cli cmd/pktvisor-cli/main.go
}

function copy() {
Expand All @@ -15,4 +15,4 @@ function copy() {
}

build
copy
copy
2 changes: 1 addition & 1 deletion .github/hosted-runner/amd64/user_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ chown ubuntu.ubuntu /actions-runner -R
#extract git actions runner installer
/bin/su -c "cd /actions-runner && tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log

/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/orb-community/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log

/bin/su -c "cd /actions-runner && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
2 changes: 1 addition & 1 deletion .github/hosted-runner/arm32/user_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ chown ubuntu.ubuntu /actions-runner -R
#extract git actions runner installer
/bin/su -c "cd /actions-runner && tar xzf ./actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log

/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/orb-community/pktvisor --token RUNNER_TOKEN --name AMD64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log

/bin/su -c "cd /actions-runner && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
2 changes: 1 addition & 1 deletion .github/hosted-runner/arm64/user_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ chown ubuntu.ubuntu /actions-runner -R
#extract git actions runner installer
/bin/su -c "cd /actions-runner && tar xzf ./actions-runner-linux-arm64-2.294.0.tar.gz" - ubuntu >> /home/ubuntu/user-data.log

/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/ns1labs/pktvisor --token RUNNER_TOKEN --name ARM64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log
/bin/su -c "cd /actions-runner && ./config.sh --unattended --url https://github.com/orb-community/pktvisor --token RUNNER_TOKEN --name ARM64_RUNNER --labels RUNNER_LABEL --work _work --runasservice" - ubuntu >> /home/ubuntu/user-data.log

/bin/su -c "cd /actions-runner && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
Loading

0 comments on commit 3fc9673

Please sign in to comment.