Skip to content

Commit 90f165d

Browse files
author
leoparente
authored
Merge pull request #194 from ns1labs/release
Release
2 parents e0addbd + 2e3e21c commit 90f165d

File tree

187 files changed

+19816
-4668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+19816
-4668
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ integration_tests/external*
33
Dockerfile
44
.dockerignore
55
.gitignore
6-
.git
76
appimage/Dockerfile.part
87
appimage/export.sh
98
appimage/Makefile

.github/workflows/build.yml

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
env:
1515
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
1616
BUILD_TYPE: Release
17+
CTEST_OUTPUT_ON_FAILURE: 1
18+
CONAN_NON_INTERACTIVE: 1
1719

1820
jobs:
1921
build:
@@ -39,28 +41,11 @@ jobs:
3941
# uses: turtlebrowser/get-conan@4dc7e6dd45c8b1e02e909979d7cfc5ebba6ddbe2
4042
uses: turtlebrowser/[email protected]
4143

42-
- name: Conan profile and settings
43-
run: |
44-
conan profile new --detect default
45-
conan config set general.revisions_enabled=1
46-
47-
- name: Conan profile (linux-workaround)
48-
if: matrix.os == 'ubuntu-latest'
49-
run:
50-
conan profile update settings.compiler.libcxx=libstdc++11 default
51-
52-
- name: Conan install (osx-workaround)
53-
if: matrix.os == 'macos-latest'
54-
working-directory: ${{github.workspace}}/build
55-
run: |
56-
conan remote add ns1labs-conan https://ns1labs.jfrog.io/artifactory/api/conan/ns1labs-conan
57-
conan install --build=missing ..
58-
5944
- name: linux package install
6045
if: matrix.os == 'ubuntu-latest'
6146
run: |
6247
sudo apt-get update
63-
sudo apt-get install --yes --no-install-recommends golang ca-certificates jq
48+
sudo apt-get install --yes --no-install-recommends jq
6449
6550
- name: Configure CMake
6651
# Use a bash shell so we can use the same syntax for environment variable
@@ -85,6 +70,12 @@ jobs:
8570
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
8671
run: ctest -C $BUILD_TYPE
8772

73+
- name: Login to ns1labs conan
74+
run: CONAN_USER_HOME=${{github.workspace}}/build/conan_home conan user -p ${{ secrets.CONAN_LABS_PASSWORD }} -r ns1labs ${{ secrets.CONAN_LABS_USERNAME }}
75+
76+
- name: Cache conan packages
77+
run: CONAN_USER_HOME=${{github.workspace}}/build/conan_home conan upload "*" --all -r ns1labs -c
78+
8879
package:
8980
needs: build
9081
runs-on: ubuntu-latest
@@ -100,12 +91,6 @@ jobs:
10091
- name: Get Conan
10192
uses: turtlebrowser/[email protected]
10293

103-
- name: Conan profile and settings
104-
run: |
105-
conan profile new --detect default
106-
conan config set general.revisions_enabled=1
107-
conan profile update settings.compiler.libcxx=libstdc++11 default
108-
10994
- name: Configure CMake to generate VERSION
11095
shell: bash
11196
working-directory: ${{github.workspace}}/build
@@ -152,8 +137,7 @@ jobs:
152137
- name: Manage Github ref tags
153138
uses: actions/github-script@v3
154139
with:
155-
github-token: ${{ github.token }}
156-
# note deleteRef can't start with refs/, but create createRef does.
140+
github-token: ${{ github.token }} # note deleteRef can't start with refs/, but create createRef does.
157141
script: |
158142
try {
159143
await github.git.deleteRef({
@@ -184,6 +168,30 @@ jobs:
184168
docker build . --file docker/Dockerfile --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
185169
docker push -a ${{ env.IMAGE_NAME }}
186170
171+
- name: Build + push - pktvisor-cli
172+
env:
173+
CLI_BINARY: pktvisor-cli
174+
IMAGE_NAME: ns1labs/pktvisor-cli
175+
run: |
176+
docker build . --file docker/Dockerfile.pktvisor-cli --tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
177+
docker push -a ${{ env.IMAGE_NAME }}
178+
echo "CONT_ID=$(docker create --name ${{ env.CLI_BINARY }}-slim-tmp ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }})" >> $GITHUB_ENV
179+
180+
- name: Extract static pktvisor-cli asset
181+
env:
182+
CLI_BINARY: pktvisor-cli
183+
IMAGE_NAME: ns1labs/pktvisor-cli
184+
run: |
185+
docker cp ${{ env.CONT_ID }}:/${{ env.CLI_BINARY }} ${{github.workspace}}/${{ env.CLI_BINARY }}-linux-x86_64-${{ env.VERSION }}
186+
187+
- name: Upload pktvisor-cli artifact
188+
env:
189+
BINARY_NAME: pktvisor-cli-linux-x86_64-${{ env.VERSION }}
190+
uses: actions/upload-artifact@v2
191+
with:
192+
name: ${{ env.BINARY_NAME }}
193+
path: ${{github.workspace}}/${{ env.BINARY_NAME }}
194+
187195
- name: Build + push - pktvisor-prom-write
188196
env:
189197
IMAGE_NAME: ns1labs/pktvisor-prom-write

.github/workflows/debug_build.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Debug Builds
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- develop
8+
- release
9+
10+
jobs:
11+
package:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Create Build Environment
18+
run: cmake -E make_directory ${{github.workspace}}/build
19+
20+
- name: Get Conan
21+
uses: turtlebrowser/[email protected]
22+
23+
- name: Configure CMake to generate VERSION
24+
shell: bash
25+
working-directory: ${{github.workspace}}/build
26+
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=Debug
27+
28+
- name: Get branch name
29+
shell: bash
30+
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
31+
32+
- name: Debug branch name
33+
run: echo ${{ env.BRANCH_NAME }}
34+
35+
- name: Get VERSION
36+
run: |
37+
echo "VERSION=`cat ${{github.workspace}}/build/VERSION`" >> $GITHUB_ENV
38+
39+
- name: Debug version
40+
run: echo ${{ env.VERSION }}
41+
42+
- name: Generate ref tag (master)
43+
if: ${{ env.BRANCH_NAME == 'master' }}
44+
run: |
45+
echo "REF_TAG=latest-debug" >> $GITHUB_ENV
46+
47+
- name: Generate ref tag (develop)
48+
if: ${{ env.BRANCH_NAME == 'develop' }}
49+
run: |
50+
echo "REF_TAG=latest-develop-debug" >> $GITHUB_ENV
51+
52+
- name: Generate ref tag (release candidate)
53+
if: ${{ env.BRANCH_NAME == 'release' }}
54+
run: |
55+
echo "REF_TAG=latest-rc-debug" >> $GITHUB_ENV
56+
57+
- name: Debug ref tag
58+
run: echo ${{ env.REF_TAG }}
59+
60+
- name: Login to Docker Hub
61+
uses: docker/login-action@v1
62+
with:
63+
username: ${{ secrets.DOCKERHUB_USERNAME }}
64+
password: ${{ secrets.DOCKERHUB_TOKEN }}
65+
66+
- name: Build + push - pktvisor debug
67+
env:
68+
IMAGE_NAME: ns1labs/pktvisor
69+
run: |
70+
docker build . --file docker/Dockerfile.debug --tag ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }}
71+
docker push -a ${{ env.IMAGE_NAME }}

.github/workflows/static_build.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Static Build
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- develop
8+
- release
9+
push:
10+
branches:
11+
- develop
12+
- release
13+
14+
env:
15+
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
16+
BUILD_TYPE: Release
17+
CTEST_OUTPUT_ON_FAILURE: 1
18+
19+
jobs:
20+
build:
21+
# The CMake configure and build commands are platform agnostic and should work equally
22+
# well on Windows or Mac. You can convert this to a matrix build if you need
23+
# cross-platform coverage.
24+
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
25+
strategy:
26+
matrix:
27+
os: [ ubuntu-latest ]
28+
runs-on: ${{ matrix.os }}
29+
30+
steps:
31+
- uses: actions/checkout@v2
32+
33+
- name: Build and test static base
34+
run: |
35+
docker build -f docker/Dockerfile.static-base -t ns1labs/static-base .
36+
37+
- name: Get branch name
38+
shell: bash
39+
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
40+
41+
- name: Debug branch name
42+
run: echo ${{ env.BRANCH_NAME }}
43+
44+
- name: Get VERSION
45+
run: |
46+
echo "VERSION=`docker run --rm -a stdout --entrypoint cat ns1labs/static-base VERSION`" >> $GITHUB_ENV
47+
48+
- name: Debug version
49+
run: echo ${{ env.VERSION }}
50+
51+
- name: Generate ref tag (master)
52+
if: github.event_name != 'pull_request' && ${{ env.BRANCH_NAME == 'master' }}
53+
run: |
54+
echo "REF_TAG=latest" >> $GITHUB_ENV
55+
56+
- name: Generate ref tag (develop)
57+
if: github.event_name != 'pull_request' && ${{ env.BRANCH_NAME == 'develop' }}
58+
run: |
59+
echo "REF_TAG=latest-develop" >> $GITHUB_ENV
60+
61+
- name: Generate ref tag (release candidate)
62+
if: github.event_name != 'pull_request' && ${{ env.BRANCH_NAME == 'release' }}
63+
run: |
64+
echo "REF_TAG=latest-rc" >> $GITHUB_ENV
65+
66+
- name: Debug ref tag
67+
if: github.event_name != 'pull_request'
68+
run: echo ${{ env.REF_TAG }}
69+
70+
- name: Login to Docker Hub
71+
if: github.event_name != 'pull_request'
72+
uses: docker/login-action@v1
73+
with:
74+
username: ${{ secrets.DOCKERHUB_USERNAME }}
75+
password: ${{ secrets.DOCKERHUB_TOKEN }}
76+
77+
- name: Build and push static pktvisord container
78+
if: github.event_name != 'pull_request'
79+
env:
80+
BASE_BINARY: pktvisord
81+
IMAGE_NAME: ns1labs/pktvisord-slim
82+
run: |
83+
docker build -f docker/Dockerfile.${{ env.BASE_BINARY }}-static -t ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} -t ${{ env.IMAGE_NAME }}:${{ env.VERSION }} .
84+
docker push -a ${{ env.IMAGE_NAME }}
85+
echo "CONT_ID=$(docker create --name ${{ env.BASE_BINARY }}-slim-tmp ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }})" >> $GITHUB_ENV
86+
87+
- name: Extract static pktvisord asset
88+
if: github.event_name != 'pull_request'
89+
env:
90+
BASE_BINARY: pktvisord
91+
IMAGE_NAME: ns1labs/pktvisord-slim
92+
run: |
93+
docker cp ${{ env.CONT_ID }}:/${{ env.BASE_BINARY }} ${{github.workspace}}/${{ env.BASE_BINARY }}-linux-x86_64-${{ env.VERSION }}
94+
95+
- name: Upload pktvisord artifact
96+
if: github.event_name != 'pull_request'
97+
env:
98+
BINARY_NAME: pktvisord-linux-x86_64-${{ env.VERSION }}
99+
uses: actions/upload-artifact@v2
100+
with:
101+
name: ${{ env.BINARY_NAME }}
102+
path: ${{github.workspace}}/${{ env.BINARY_NAME }}
103+
104+
- name: Build and push static pktvisor-reader container
105+
if: github.event_name != 'pull_request'
106+
env:
107+
BASE_BINARY: pktvisor-reader
108+
IMAGE_NAME: ns1labs/pktvisor-reader
109+
run: |
110+
docker build -f docker/Dockerfile.${{ env.BASE_BINARY }}-static -t ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }} -t ${{ env.IMAGE_NAME }}:${{ env.VERSION }} .
111+
docker push -a ${{ env.IMAGE_NAME }}
112+
echo "CONT_ID=$(docker create --name ${{ env.BASE_BINARY }}-slim-tmp ${{ env.IMAGE_NAME }}:${{ env.REF_TAG }})" >> $GITHUB_ENV
113+
114+
- name: Extract static pktvisor-reader asset
115+
if: github.event_name != 'pull_request'
116+
env:
117+
BASE_BINARY: pktvisor-reader
118+
IMAGE_NAME: ns1labs/pktvisor-reader
119+
run: |
120+
docker cp ${{ env.CONT_ID }}:/${{ env.BASE_BINARY }} ${{github.workspace}}/${{ env.BASE_BINARY }}-linux-x86_64-${{ env.VERSION }}
121+
122+
- name: Upload pktvisor-reader artifact
123+
if: github.event_name != 'pull_request'
124+
env:
125+
BINARY_NAME: pktvisor-reader-linux-x86_64-${{ env.VERSION }}
126+
uses: actions/upload-artifact@v2
127+
with:
128+
name: ${{ env.BINARY_NAME }}
129+
path: ${{github.workspace}}/${{ env.BINARY_NAME }}

3rd/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
message(STATUS "3rd party libraries")
33

44
add_subdirectory(datasketches)
5+
add_subdirectory(fstrm)
56
add_subdirectory(rng)
7+
add_subdirectory(sflow)
68
add_subdirectory(timer)
7-
add_subdirectory(libmaxminddb)

3rd/fstrm/CMakeLists.txt

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 3.9)
2+
project(fstrm)
3+
4+
add_library(fstrm
5+
fstrm/control.c
6+
fstrm/file.c
7+
fstrm/iothr.c
8+
fstrm/rdwr.c
9+
fstrm/reader.c
10+
fstrm/tcp_writer.c
11+
fstrm/time.c
12+
fstrm/unix_writer.c
13+
fstrm/writer.c
14+
libmy/argv.c
15+
libmy/my_queue_mb.c
16+
libmy/my_queue_mutex.c
17+
)
18+
add_library(fstrm::fstrm ALIAS fstrm)
19+
target_compile_options(fstrm PRIVATE -Wno-pedantic)
20+
21+
target_include_directories(fstrm
22+
PUBLIC
23+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
24+
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>>
25+
)
26+
27+
set(FSTRM_HEADERS
28+
fstrm/fstrm.h
29+
)
30+
set_target_properties(fstrm PROPERTIES PUBLIC_HEADER "${FSTRM_HEADERS}")
31+

3rd/fstrm/COPYRIGHT

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2014 by Farsight Security, Inc.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included
12+
in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)