Skip to content

Commit

Permalink
Merge pull request #194 from ns1labs/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
leoparente authored Feb 1, 2022
2 parents e0addbd + 2e3e21c commit 90f165d
Show file tree
Hide file tree
Showing 187 changed files with 19,816 additions and 4,668 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ integration_tests/external*
Dockerfile
.dockerignore
.gitignore
.git
appimage/Dockerfile.part
appimage/export.sh
appimage/Makefile
Expand Down
60 changes: 34 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CTEST_OUTPUT_ON_FAILURE: 1
CONAN_NON_INTERACTIVE: 1

jobs:
build:
Expand All @@ -39,28 +41,11 @@ jobs:
# uses: turtlebrowser/get-conan@4dc7e6dd45c8b1e02e909979d7cfc5ebba6ddbe2
uses: turtlebrowser/get-conan@v1.0

- name: Conan profile and settings
run: |
conan profile new --detect default
conan config set general.revisions_enabled=1
- name: Conan profile (linux-workaround)
if: matrix.os == 'ubuntu-latest'
run:
conan profile update settings.compiler.libcxx=libstdc++11 default

- name: Conan install (osx-workaround)
if: matrix.os == 'macos-latest'
working-directory: ${{github.workspace}}/build
run: |
conan remote add ns1labs-conan https://ns1labs.jfrog.io/artifactory/api/conan/ns1labs-conan
conan install --build=missing ..
- name: linux package install
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends golang ca-certificates jq
sudo apt-get install --yes --no-install-recommends jq
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
Expand All @@ -85,6 +70,12 @@ jobs:
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C $BUILD_TYPE

- name: Login to ns1labs conan
run: CONAN_USER_HOME=${{github.workspace}}/build/conan_home conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }}

- name: Cache conan packages
run: CONAN_USER_HOME=${{github.workspace}}/build/conan_home conan upload "*" --all -r ns1labs -c

package:
needs: build
runs-on: ubuntu-latest
Expand All @@ -100,12 +91,6 @@ jobs:
- name: Get Conan
uses: turtlebrowser/get-conan@v1.0

- name: Conan profile and settings
run: |
conan profile new --detect default
conan config set general.revisions_enabled=1
conan profile update settings.compiler.libcxx=libstdc++11 default
- name: Configure CMake to generate VERSION
shell: bash
working-directory: ${{github.workspace}}/build
Expand Down Expand Up @@ -152,8 +137,7 @@ jobs:
- name: Manage Github ref tags
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
# note deleteRef can't start with refs/, but create createRef does.
github-token: ${{ github.token }} # note deleteRef can't start with refs/, but create createRef does.
script: |
try {
await github.git.deleteRef({
Expand Down Expand Up @@ -184,6 +168,30 @@ jobs:
docker build . --file docker/Dockerfile --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
docker push -a ${{ env.IMAGE_NAME }}
- name: Build + push - pktvisor-cli
env:
CLI_BINARY: pktvisor-cli
IMAGE_NAME: ns1labs/pktvisor-cli
run: |
docker build . --file docker/Dockerfile.pktvisor-cli --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
docker push -a ${{ env.IMAGE_NAME }}
echo "CONT_ID=$(docker create --name ${{ env.CLI_BINARY }}-slim-tmp ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }})" >> $GITHUB_ENV
- name: Extract static pktvisor-cli asset
env:
CLI_BINARY: pktvisor-cli
IMAGE_NAME: ns1labs/pktvisor-cli
run: |
docker cp ${{ env.CONT_ID }}:/${{ env.CLI_BINARY }} ${{github.workspace}}/${{ env.CLI_BINARY }}-linux-x86_64-${{ env.VERSION }}
- name: Upload pktvisor-cli artifact
env:
BINARY_NAME: pktvisor-cli-linux-x86_64-${{ env.VERSION }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.BINARY_NAME }}
path: ${{github.workspace}}/${{ env.BINARY_NAME }}

- name: Build + push - pktvisor-prom-write
env:
IMAGE_NAME: ns1labs/pktvisor-prom-write
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/debug_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Debug Builds

on:
workflow_dispatch:
push:
branches:
- develop
- release

jobs:
package:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Get Conan
uses: turtlebrowser/get-conan@v1.0

- name: Configure CMake to generate VERSION
shell: bash
working-directory: ${{github.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug

- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Debug branch name
run: echo ${{ env.BRANCH_NAME }}

- name: Get VERSION
run: |
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}

- name: Generate ref tag (master)
if: ${{ env.BRANCH_NAME == 'master' }}
run: |
echo "REF_TAG=latest-debug" >> $GITHUB_ENV
- name: Generate ref tag (develop)
if: ${{ env.BRANCH_NAME == 'develop' }}
run: |
echo "REF_TAG=latest-develop-debug" >> $GITHUB_ENV
- name: Generate ref tag (release candidate)
if: ${{ env.BRANCH_NAME == 'release' }}
run: |
echo "REF_TAG=latest-rc-debug" >> $GITHUB_ENV
- name: Debug ref tag
run: echo ${{ env.REF_TAG }}

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build + push - pktvisor debug
env:
IMAGE_NAME: ns1labs/pktvisor
run: |
docker build . --file docker/Dockerfile.debug --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
docker push -a ${{ env.IMAGE_NAME }}
129 changes: 129 additions & 0 deletions .github/workflows/static_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: Static Build

on:
workflow_dispatch:
pull_request:
branches:
- develop
- release
push:
branches:
- develop
- release

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
CTEST_OUTPUT_ON_FAILURE: 1

jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Build and test static base
run: |
docker build -f docker/Dockerfile.static-base -t ns1labs/static-base .
- name: Get branch name
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV

- name: Debug branch name
run: echo ${{ env.BRANCH_NAME }}

- name: Get VERSION
run: |
echo "VERSION=`docker run --rm -a stdout --entrypoint cat ns1labs/static-base VERSION`" >> $GITHUB_ENV
- name: Debug version
run: echo ${{ env.VERSION }}

- name: Generate ref tag (master)
if: github.event_name != 'pull_request' && ${{ env.BRANCH_NAME == 'master' }}
run: |
echo "REF_TAG=latest" >> $GITHUB_ENV
- name: Generate ref tag (develop)
if: github.event_name != 'pull_request' && ${{ env.BRANCH_NAME == 'develop' }}
run: |
echo "REF_TAG=latest-develop" >> $GITHUB_ENV
- name: Generate ref tag (release candidate)
if: github.event_name != 'pull_request' && ${{ env.BRANCH_NAME == 'release' }}
run: |
echo "REF_TAG=latest-rc" >> $GITHUB_ENV
- name: Debug ref tag
if: github.event_name != 'pull_request'
run: echo ${{ env.REF_TAG }}

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push static pktvisord container
if: github.event_name != 'pull_request'
env:
BASE_BINARY: pktvisord
IMAGE_NAME: ns1labs/pktvisord-slim
run: |
docker build -f docker/Dockerfile.${{ env.BASE_BINARY }}-static -t ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} -t ${{ env.IMAGE_NAME }}:${{ env.VERSION }} .
docker push -a ${{ env.IMAGE_NAME }}
echo "CONT_ID=$(docker create --name ${{ env.BASE_BINARY }}-slim-tmp ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }})" >> $GITHUB_ENV
- name: Extract static pktvisord asset
if: github.event_name != 'pull_request'
env:
BASE_BINARY: pktvisord
IMAGE_NAME: ns1labs/pktvisord-slim
run: |
docker cp ${{ env.CONT_ID }}:/${{ env.BASE_BINARY }} ${{github.workspace}}/${{ env.BASE_BINARY }}-linux-x86_64-${{ env.VERSION }}
- name: Upload pktvisord artifact
if: github.event_name != 'pull_request'
env:
BINARY_NAME: pktvisord-linux-x86_64-${{ env.VERSION }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.BINARY_NAME }}
path: ${{github.workspace}}/${{ env.BINARY_NAME }}

- name: Build and push static pktvisor-reader container
if: github.event_name != 'pull_request'
env:
BASE_BINARY: pktvisor-reader
IMAGE_NAME: ns1labs/pktvisor-reader
run: |
docker build -f docker/Dockerfile.${{ env.BASE_BINARY }}-static -t ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} -t ${{ env.IMAGE_NAME }}:${{ env.VERSION }} .
docker push -a ${{ env.IMAGE_NAME }}
echo "CONT_ID=$(docker create --name ${{ env.BASE_BINARY }}-slim-tmp ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }})" >> $GITHUB_ENV
- name: Extract static pktvisor-reader asset
if: github.event_name != 'pull_request'
env:
BASE_BINARY: pktvisor-reader
IMAGE_NAME: ns1labs/pktvisor-reader
run: |
docker cp ${{ env.CONT_ID }}:/${{ env.BASE_BINARY }} ${{github.workspace}}/${{ env.BASE_BINARY }}-linux-x86_64-${{ env.VERSION }}
- name: Upload pktvisor-reader artifact
if: github.event_name != 'pull_request'
env:
BINARY_NAME: pktvisor-reader-linux-x86_64-${{ env.VERSION }}
uses: actions/upload-artifact@v2
with:
name: ${{ env.BINARY_NAME }}
path: ${{github.workspace}}/${{ env.BINARY_NAME }}
3 changes: 2 additions & 1 deletion 3rd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
message(STATUS "3rd party libraries")

add_subdirectory(datasketches)
add_subdirectory(fstrm)
add_subdirectory(rng)
add_subdirectory(sflow)
add_subdirectory(timer)
add_subdirectory(libmaxminddb)
31 changes: 31 additions & 0 deletions 3rd/fstrm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.9)
project(fstrm)

add_library(fstrm
fstrm/control.c
fstrm/file.c
fstrm/iothr.c
fstrm/rdwr.c
fstrm/reader.c
fstrm/tcp_writer.c
fstrm/time.c
fstrm/unix_writer.c
fstrm/writer.c
libmy/argv.c
libmy/my_queue_mb.c
libmy/my_queue_mutex.c
)
add_library(fstrm::fstrm ALIAS fstrm)
target_compile_options(fstrm PRIVATE -Wno-pedantic)

target_include_directories(fstrm
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>>
)

set(FSTRM_HEADERS
fstrm/fstrm.h
)
set_target_properties(fstrm PROPERTIES PUBLIC_HEADER "${FSTRM_HEADERS}")

20 changes: 20 additions & 0 deletions 3rd/fstrm/COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2014 by Farsight Security, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 90f165d

Please sign in to comment.