Skip to content

Commit d89733c

Browse files
committed
Merge branch 'main' into refactor/role-based-peer-setup
2 parents b7d87bb + 1024d45 commit d89733c

File tree

293 files changed

+49156
-2999
lines changed

Some content is hidden

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

293 files changed

+49156
-2999
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.env
2+
.env.*
3+
*.pem
4+
*.key
5+
*.crt
6+
*.p12

.github/workflows/check-license-dependencies.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,27 @@ jobs:
2323

2424
- name: Check for problematic license dependencies
2525
run: |
26-
echo "Checking for dependencies on management/, signal/, and relay/ packages..."
26+
echo "Checking for dependencies on management/, signal/, relay/, and proxy/ packages..."
2727
echo ""
2828
2929
# Find all directories except the problematic ones and system dirs
3030
FOUND_ISSUES=0
3131
while IFS= read -r dir; do
3232
echo "=== Checking $dir ==="
3333
# Search for problematic imports, excluding test files
34-
RESULTS=$(grep -r "github.com/netbirdio/netbird/\(management\|signal\|relay\)" "$dir" --include="*.go" 2>/dev/null | grep -v "_test.go" | grep -v "test_" | grep -v "/test/" || true)
34+
RESULTS=$(grep -r "github.com/netbirdio/netbird/\(management\|signal\|relay\|proxy\)" "$dir" --include="*.go" 2>/dev/null | grep -v "_test.go" | grep -v "test_" | grep -v "/test/" || true)
3535
if [ -n "$RESULTS" ]; then
3636
echo "❌ Found problematic dependencies:"
3737
echo "$RESULTS"
3838
FOUND_ISSUES=1
3939
else
4040
echo "✓ No problematic dependencies found"
4141
fi
42-
done < <(find . -maxdepth 1 -type d -not -name "." -not -name "management" -not -name "signal" -not -name "relay" -not -name ".git*" | sort)
42+
done < <(find . -maxdepth 1 -type d -not -name "." -not -name "management" -not -name "signal" -not -name "relay" -not -name "proxy" -not -name "combined" -not -name ".git*" | sort)
4343
4444
echo ""
4545
if [ $FOUND_ISSUES -eq 1 ]; then
46-
echo "❌ Found dependencies on management/, signal/, or relay/ packages"
46+
echo "❌ Found dependencies on management/, signal/, relay/, or proxy/ packages"
4747
echo "These packages are licensed under AGPLv3 and must not be imported by BSD-licensed code"
4848
exit 1
4949
else
@@ -88,7 +88,7 @@ jobs:
8888
IMPORTERS=$(go list -json -deps ./... 2>/dev/null | jq -r "select(.Imports[]? == \"$package\") | .ImportPath")
8989
9090
# Check if any importer is NOT in management/signal/relay
91-
BSD_IMPORTER=$(echo "$IMPORTERS" | grep -v "github.com/netbirdio/netbird/\(management\|signal\|relay\)" | head -1)
91+
BSD_IMPORTER=$(echo "$IMPORTERS" | grep -v "github.com/netbirdio/netbird/\(management\|signal\|relay\|proxy\|combined\)" | head -1)
9292
9393
if [ -n "$BSD_IMPORTER" ]; then
9494
echo "❌ $package ($license) is imported by BSD-licensed code: $BSD_IMPORTER"

.github/workflows/golang-test-darwin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ jobs:
4343
run: git --no-pager diff --exit-code
4444

4545
- name: Test
46-
run: NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -tags=devcert -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 5m -p 1 $(go list ./... | grep -v /management)
46+
run: NETBIRD_STORE_ENGINE=${{ matrix.store }} CI=true go test -tags=devcert -exec 'sudo --preserve-env=CI,NETBIRD_STORE_ENGINE' -timeout 5m -p 1 $(go list ./... | grep -v -e /management -e /signal -e /relay -e /proxy -e /combined)
4747

.github/workflows/golang-test-freebsd.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,5 @@ jobs:
4646
time go test -timeout 1m -failfast ./client/iface/...
4747
time go test -timeout 1m -failfast ./route/...
4848
time go test -timeout 1m -failfast ./sharedsock/...
49-
time go test -timeout 1m -failfast ./signal/...
5049
time go test -timeout 1m -failfast ./util/...
5150
time go test -timeout 1m -failfast ./version/...

.github/workflows/golang-test-linux.yml

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ jobs:
9797
working-directory: relay
9898
run: CGO_ENABLED=1 GOARCH=386 go build -o relay-386 .
9999

100+
- name: Build combined
101+
if: steps.cache.outputs.cache-hit != 'true'
102+
working-directory: combined
103+
run: CGO_ENABLED=1 go build .
104+
105+
- name: Build combined 386
106+
if: steps.cache.outputs.cache-hit != 'true'
107+
working-directory: combined
108+
run: CGO_ENABLED=1 GOARCH=386 go build -o combined-386 .
109+
100110
test:
101111
name: "Client / Unit"
102112
needs: [build-cache]
@@ -144,7 +154,7 @@ jobs:
144154
run: git --no-pager diff --exit-code
145155

146156
- name: Test
147-
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} CI=true go test -tags devcert -exec 'sudo' -timeout 10m -p 1 $(go list ./... | grep -v -e /management -e /signal -e /relay)
157+
run: CGO_ENABLED=1 GOARCH=${{ matrix.arch }} CI=true go test -tags devcert -exec 'sudo' -timeout 10m -p 1 $(go list ./... | grep -v -e /management -e /signal -e /relay -e /proxy -e /combined)
148158

149159
test_client_on_docker:
150160
name: "Client (Docker) / Unit"
@@ -204,7 +214,7 @@ jobs:
204214
sh -c ' \
205215
apk update; apk add --no-cache \
206216
ca-certificates iptables ip6tables dbus dbus-dev libpcap-dev build-base; \
207-
go test -buildvcs=false -tags devcert -v -timeout 10m -p 1 $(go list -buildvcs=false ./... | grep -v -e /management -e /signal -e /relay -e /client/ui -e /upload-server)
217+
go test -buildvcs=false -tags devcert -v -timeout 10m -p 1 $(go list -buildvcs=false ./... | grep -v -e /management -e /signal -e /relay -e /proxy -e /combined -e /client/ui -e /upload-server)
208218
'
209219
210220
test_relay:
@@ -261,6 +271,53 @@ jobs:
261271
-exec 'sudo' \
262272
-timeout 10m -p 1 ./relay/... ./shared/relay/...
263273
274+
test_proxy:
275+
name: "Proxy / Unit"
276+
needs: [build-cache]
277+
strategy:
278+
fail-fast: false
279+
matrix:
280+
arch: [ '386','amd64' ]
281+
runs-on: ubuntu-22.04
282+
steps:
283+
- name: Checkout code
284+
uses: actions/checkout@v4
285+
286+
- name: Install Go
287+
uses: actions/setup-go@v5
288+
with:
289+
go-version-file: "go.mod"
290+
cache: false
291+
292+
- name: Install dependencies
293+
run: sudo apt update && sudo apt install -y gcc-multilib g++-multilib libc6-dev-i386
294+
295+
- name: Get Go environment
296+
run: |
297+
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV
298+
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV
299+
300+
- name: Cache Go modules
301+
uses: actions/cache/restore@v4
302+
with:
303+
path: |
304+
${{ env.cache }}
305+
${{ env.modcache }}
306+
key: ${{ runner.os }}-gotest-cache-${{ hashFiles('**/go.sum') }}
307+
restore-keys: |
308+
${{ runner.os }}-gotest-cache-
309+
310+
- name: Install modules
311+
run: go mod tidy
312+
313+
- name: check git status
314+
run: git --no-pager diff --exit-code
315+
316+
- name: Test
317+
run: |
318+
CGO_ENABLED=1 GOARCH=${{ matrix.arch }} \
319+
go test -timeout 10m -p 1 ./proxy/...
320+
264321
test_signal:
265322
name: "Signal / Unit"
266323
needs: [build-cache]

.github/workflows/golang-test-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe env -w GOMODCACHE=${{ env.cache }}
6464
- run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe env -w GOCACHE=${{ env.modcache }}
6565
- run: PsExec64 -s -w ${{ github.workspace }} C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe mod tidy
66-
- run: echo "files=$(go list ./... | ForEach-Object { $_ } | Where-Object { $_ -notmatch '/management' } | Where-Object { $_ -notmatch '/relay' } | Where-Object { $_ -notmatch '/signal' })" >> $env:GITHUB_ENV
66+
- run: echo "files=$(go list ./... | ForEach-Object { $_ } | Where-Object { $_ -notmatch '/management' } | Where-Object { $_ -notmatch '/relay' } | Where-Object { $_ -notmatch '/signal' } | Where-Object { $_ -notmatch '/proxy' } | Where-Object { $_ -notmatch '/combined' })" >> $env:GITHUB_ENV
6767

6868
- name: test
6969
run: PsExec64 -s -w ${{ github.workspace }} cmd.exe /c "C:\hostedtoolcache\windows\go\${{ steps.go.outputs.go-version }}\x64\bin\go.exe test -tags=devcert -timeout 10m -p 1 ${{ env.files }} > test-out.txt 2>&1"

.github/workflows/golangci-lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ jobs:
1919
- name: codespell
2020
uses: codespell-project/actions-codespell@v2
2121
with:
22-
ignore_words_list: erro,clienta,hastable,iif,groupd,testin,groupe,cros,ans
23-
skip: go.mod,go.sum
22+
ignore_words_list: erro,clienta,hastable,iif,groupd,testin,groupe,cros,ans,deriver
23+
skip: go.mod,go.sum,**/proxy/web/**
2424
golangci:
2525
strategy:
2626
fail-fast: false

.github/workflows/release.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010

1111
env:
12-
SIGN_PIPE_VER: "v0.1.0"
12+
SIGN_PIPE_VER: "v0.1.1"
1313
GORELEASER_VER: "v2.3.2"
1414
PRODUCT_NAME: "NetBird"
1515
COPYRIGHT: "NetBird GmbH"
@@ -160,7 +160,7 @@ jobs:
160160
username: ${{ secrets.DOCKER_USER }}
161161
password: ${{ secrets.DOCKER_TOKEN }}
162162
- name: Log in to the GitHub container registry
163-
if: github.event_name != 'pull_request'
163+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
164164
uses: docker/login-action@v3
165165
with:
166166
registry: ghcr.io
@@ -176,6 +176,7 @@ jobs:
176176
- name: Generate windows syso arm64
177177
run: goversioninfo -arm -64 -icon client/ui/assets/netbird.ico -manifest client/manifest.xml -product-name ${{ env.PRODUCT_NAME }} -copyright "${{ env.COPYRIGHT }}" -ver-major ${{ steps.semver_parser.outputs.major }} -ver-minor ${{ steps.semver_parser.outputs.minor }} -ver-patch ${{ steps.semver_parser.outputs.patch }} -ver-build 0 -file-version ${{ steps.semver_parser.outputs.fullversion }}.0 -product-version ${{ steps.semver_parser.outputs.fullversion }}.0 -o client/resources_windows_arm64.syso
178178
- name: Run GoReleaser
179+
id: goreleaser
179180
uses: goreleaser/goreleaser-action@v4
180181
with:
181182
version: ${{ env.GORELEASER_VER }}
@@ -185,6 +186,19 @@ jobs:
185186
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
186187
UPLOAD_DEBIAN_SECRET: ${{ secrets.PKG_UPLOAD_SECRET }}
187188
UPLOAD_YUM_SECRET: ${{ secrets.PKG_UPLOAD_SECRET }}
189+
- name: Tag and push PR images (amd64 only)
190+
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
191+
run: |
192+
PR_TAG="pr-${{ github.event.pull_request.number }}"
193+
echo '${{ steps.goreleaser.outputs.artifacts }}' | \
194+
jq -r '.[] | select(.type == "Docker Image") | select(.goarch == "amd64") | .name' | \
195+
grep '^ghcr.io/' | while read -r SRC; do
196+
IMG_NAME="${SRC%%:*}"
197+
DST="${IMG_NAME}:${PR_TAG}"
198+
echo "Tagging ${SRC} -> ${DST}"
199+
docker tag "$SRC" "$DST"
200+
docker push "$DST"
201+
done
188202
- name: upload non tags for debug purposes
189203
uses: actions/upload-artifact@v4
190204
with:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.run
33
*.iml
44
dist/
5+
!proxy/web/dist/
56
bin/
67
.env
78
conf.json

0 commit comments

Comments
 (0)