Skip to content

Commit

Permalink
pktvisor release 4.2.0
Browse files Browse the repository at this point in the history
pktvisor release 4.2.0
  • Loading branch information
etaques authored Dec 7, 2022
2 parents efbce2e + 370cb0e commit 16f35e1
Show file tree
Hide file tree
Showing 319 changed files with 65,531 additions and 4,322 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-cpp/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL author="Everton Haise Taques <everton.taques@encora.com>"
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"
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 Down
12 changes: 11 additions & 1 deletion .github/actions/build-cpp/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ inputs:
description: "symbol url"
required: true
default: ""

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

asan:
description: "asan"
required: true
default: "ON"

file:
description: "Dockerfile used to build the image"
Expand All @@ -21,4 +31,4 @@ inputs:
runs:
using: 'docker'
image: 'Dockerfile'


13 changes: 9 additions & 4 deletions .github/actions/build-cpp/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function build() {
cp -rf /github/workspace/src/ /pktvisor-src/src/
cp -rf /github/workspace/cmd/ /pktvisor-src/cmd/
cp -rf /github/workspace/3rd/ /pktvisor-src/3rd/
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/integration_tests/ /pktvisor-src/integration_tests/
Expand All @@ -19,10 +20,10 @@ function build() {
cp -rf /github/workspace/conanfile.txt /pktvisor-src/
mkdir /tmp/build
cd /tmp/build
conan profile new --detect default && \
conan profile update settings.compiler.libcxx=libstdc++11 default && \
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=Debug -DASAN=ON /pktvisor-src && \
PKG_CONFIG_PATH=/local/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=$INPUT_BUILD_TYPE -DASAN=$INPUT_ASAN /pktvisor-src
make all -j 4
}

Expand All @@ -31,10 +32,14 @@ function compact() {
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
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() {
Expand All @@ -46,4 +51,4 @@ function publish() {
validateParams
build
compact
publish
publish
20 changes: 20 additions & 0 deletions .github/hosted-runner/amd64/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "aws_instance" "orb-devops" {
ami = lookup(var.amis, var.aws_region)
instance_type = var.instance_type
security_groups = [aws_security_group.sg_SelfRunner_amd64.id]
key_name = var.key_name
user_data = file("user_data.sh")
associate_public_ip_address = true
subnet_id = "subnet-086909352c7cc4e61"

ebs_block_device {
device_name = "/dev/sda1"
volume_size = 20
}

tags = {
Name = "orb-pktvisor-self-runner-${var.environment}"
Provider = "terraform"
Role = "test"
}
}
3 changes: 3 additions & 0 deletions .github/hosted-runner/amd64/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "ip" {
value = aws_instance.orb-devops.public_ip
}
5 changes: 5 additions & 0 deletions .github/hosted-runner/amd64/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.aws_region
}
32 changes: 32 additions & 0 deletions .github/hosted-runner/amd64/security-group.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "aws_security_group" "sg_SelfRunner_amd64" {
name = "sg_pktvisor_SelfRunner_amd64_${var.environment}"
description = "Allow all outbound traffic and inbound 22/80"
vpc_id = "vpc-0cd4a525c008d8d71"

ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

tags = {
Name = "SelfRunner_amd64_${var.environment}"
Provisioner = "terraform"

}
}
26 changes: 26 additions & 0 deletions .github/hosted-runner/amd64/user_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

#installing packages
apt-get update -y
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python xvfb \
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf g++-10-multilib-arm-linux-gnueabihf \
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd cmake zip -y

#set permission to use docker
usermod -aG docker ubuntu

#creating directory git actions runner
mkdir actions-runner && cd actions-runner

chown ubuntu.ubuntu /actions-runner -R

#get git actions self-runner
/bin/su -c "cd /actions-runner && curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log

#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 && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
29 changes: 29 additions & 0 deletions .github/hosted-runner/amd64/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "aws_access_key" {
default = "AWSID"
}
variable "aws_secret_key" {
default = "AWSSECRET"
}

variable "environment" {
default = "ENVIRONMENT"
}

variable "aws_region" {
default = "us-east-1"
}

variable "amis" {
type = map
default = {
us-east-1 = "ami-0c4f7023847b90238" //ubuntu 20.04 amd64 us-east-1
}
}

variable "key_name" {
default = "devops-key"
}

variable "instance_type" {
default = "t3.xlarge"
}
20 changes: 20 additions & 0 deletions .github/hosted-runner/arm32/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "aws_instance" "orb-devops" {
ami = lookup(var.amis, var.aws_region)
instance_type = var.instance_type
security_groups = [aws_security_group.sg_SelfRunner_arm32.id]
key_name = var.key_name
user_data = file("user_data.sh")
associate_public_ip_address = true
subnet_id = "subnet-0e4137bca8a8a81da"

ebs_block_device {
device_name = "/dev/sda1"
volume_size = 20
}

tags = {
Name = "orb-pktvisor-self-runner-${var.environment}"
Provider = "terraform"
Role = "test"
}
}
3 changes: 3 additions & 0 deletions .github/hosted-runner/arm32/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "ip" {
value = aws_instance.orb-devops.public_ip
}
5 changes: 5 additions & 0 deletions .github/hosted-runner/arm32/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.aws_region
}
32 changes: 32 additions & 0 deletions .github/hosted-runner/arm32/security-group.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "aws_security_group" "sg_SelfRunner_arm32" {
name = "sg_pktvisor_SelfRunner_arm32_${var.environment}"
description = "Allow all outbound traffic and inbound 22/80"
vpc_id = "vpc-0cd4a525c008d8d71"

ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

tags = {
Name = "SelfRunner_arm32_${var.environment}"
Provisioner = "terraform"

}
}
26 changes: 26 additions & 0 deletions .github/hosted-runner/arm32/user_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

#installing packages
apt-get update -y
apt-get install apt-transport-https qemu qemu-user-static ca-certificates gnupg2 curl tar software-properties-common build-essential zlib1g-dev \
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev python3 python3-pip python3-dev python xvfb \
libfontconfig1 libfreetype6 xfonts-scalable fonts-liberation fonts-noto-cjk g++-10-arm-linux-gnueabihf g++-10-multilib-arm-linux-gnueabihf \
gcc-10-arm-linux-gnueabihf gcc-10-arm-linux-gnueabihf-base gcc-10-multilib-arm-linux-gnueabihf python3-venv tcpreplay docker.io containerd cmake zip -y

#set permission to use docker
usermod -aG docker ubuntu

#creating directory git actions runner
mkdir actions-runner && cd actions-runner

chown ubuntu.ubuntu /actions-runner -R

#get git actions self-runner
/bin/su -c "cd /actions-runner && curl -o actions-runner-linux-x64-2.296.2.tar.gz -L https://github.com/actions/runner/releases/download/v2.296.2/actions-runner-linux-x64-2.296.2.tar.gz" - ubuntu >> /home/ubuntu/user-data.log

#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 && ./run.sh" - ubuntu >> /home/ubuntu/user-data.log
29 changes: 29 additions & 0 deletions .github/hosted-runner/arm32/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variable "aws_access_key" {
default = "AWSID"
}
variable "aws_secret_key" {
default = "AWSSECRET"
}

variable "environment" {
default = "ENVIRONMENT"
}

variable "aws_region" {
default = "us-east-1"
}

variable "amis" {
type = map
default = {
us-east-1 = "ami-070650c005cce4203" //ubuntu 20.04 arm64 on us-east-1
}
}

variable "key_name" {
default = "devops-key"
}

variable "instance_type" {
default = "t3.xlarge"
}
20 changes: 20 additions & 0 deletions .github/hosted-runner/arm64/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "aws_instance" "orb-devops" {
ami = lookup(var.amis, var.aws_region)
instance_type = var.instance_type
security_groups = [aws_security_group.sg_SelfRunner_arm64.id]
key_name = var.key_name
user_data = file("user_data.sh")
associate_public_ip_address = true
subnet_id = "subnet-0e4137bca8a8a81da"

ebs_block_device {
device_name = "/dev/sda1"
volume_size = 20
}

tags = {
Name = "orb-pktvisor-self-runner-${var.environment}"
Provider = "terraform"
Role = "test"
}
}
3 changes: 3 additions & 0 deletions .github/hosted-runner/arm64/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "ip" {
value = aws_instance.orb-devops.public_ip
}
5 changes: 5 additions & 0 deletions .github/hosted-runner/arm64/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
provider "aws" {
access_key = var.aws_access_key
secret_key = var.aws_secret_key
region = var.aws_region
}
32 changes: 32 additions & 0 deletions .github/hosted-runner/arm64/security-group.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
resource "aws_security_group" "sg_SelfRunner_arm64" {
name = "sg_pktvisor_SelfRunner_arm64_${var.environment}"
description = "Allow all outbound traffic and inbound 22/80"
vpc_id = "vpc-0cd4a525c008d8d71"

ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}

tags = {
Name = "SelfRunner_arm64_${var.environment}"
Provisioner = "terraform"

}
}
Loading

0 comments on commit 16f35e1

Please sign in to comment.