Skip to content
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
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 <everton.taques@encora.com>"
LABEL maintainer="Orb Community"
LABEL maintainer="NS1 Labs"
LABEL version="1.0.0"

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

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==1.59.0' --force-reinstall
pip3 install conan

RUN chmod +x /entrypoint.sh

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

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

symbol_url:
description: "symbol url"
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: 10 additions & 21 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_BUGSPLAT_SYMBOL_URL ]] && echo "Bugsplat symbol url is required" && exit 1 || echo "Bugsplat symbol url pŕesent"
[[ -z $INPUT_SYMBOL_URL ]] && echo "Backtrace symbol url is required" && exit 1 || echo "Backtrace symbol url present"
}

function build() {
Expand All @@ -14,52 +14,41 @@ 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 move() {
function compact() {
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/
chmod -R 777 /tmp/build/conan_home/
cp -rf /tmp/build/conan_home/ /github/workspace/build/
#version for pktvisor-cli
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 publishToBugsplat() {
echo "========================= Publishing symbol to bugsplat ========================="
function publish() {
echo "========================= Publishing symbol to backtrace ========================="
cd /tmp/build
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
curl --data-binary @pktvisord.zip -H "Expect: gzip" "${INPUT_SYMBOL_URL}"
}

validateParams
build
move
publishToBugsplat
compact
publish
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 <everton.taques@encora.com>"
LABEL maintainer="netboxlabs"
LABEL maintainer="NS1 Labs"
LABEL version="1.0.0"

COPY ./entrypoint.sh /entrypoint.sh
Expand Down
12 changes: 1 addition & 11 deletions .github/actions/build-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,8 @@ 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
GOOS=$INPUT_GOOS GOARCH=$INPUT_GOARCH go build -o pktvisor-cli cmd/pktvisor-cli/main.go
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/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 && ./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 && ./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/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 && ./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 && ./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/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 && ./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 && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
Loading