diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 1ec8abf9..61e29831 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -26,34 +26,30 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# Temporarily disabled, since adapters have dependency on nimbus and this PR contains changes -# for both nimbus and for adapters. Due to which this job is failing. Once the adapters dependency -# for nimbus updated in a subsequent PR this job will be enabled. - -# test: -# name: Test -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# -# - name: Setup go -# uses: actions/setup-go@v4 -# with: -# go-version: '1.20' -# -# - name: go fmt -# run: make fmt -# -# - name: Lint -# id: lint -# uses: golangci/golangci-lint-action@v3 -# with: -# version: v1.54 -# args: --deadline=30m --out-format=line-number -# skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778 -# -# - name: Run unit tests -# run: make test + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: go fmt + run: make fmt + + - name: Lint + id: lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + args: --deadline=30m --out-format=line-number + skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778 + + - name: Run unit tests + run: make test go-sec: runs-on: ubuntu-latest @@ -87,19 +83,17 @@ jobs: - name: Build image run: make docker-build -# Same here. - -# build-adapters-image: -# strategy: -# matrix: -# adapters: [ "nimbus-kubearmor", "nimbus-netpol" ] -# name: Build ${{ matrix.adapters }} adapter's image -# runs-on: ubuntu-latest -# timeout-minutes: 20 -# steps: -# - name: Checkout source code -# uses: actions/checkout@v3 -# -# - name: Build image -# working-directory: ./pkg/adapter/${{ matrix.adapters }} -# run: make docker-build + build-adapters-image: + strategy: + matrix: + adapters: [ "nimbus-kubearmor", "nimbus-netpol" ] + name: Build ${{ matrix.adapters }} adapter's image + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - name: Checkout source code + uses: actions/checkout@v3 + + - name: Build image + working-directory: ./pkg/adapter/${{ matrix.adapters }} + run: make docker-build diff --git a/pkg/adapter/nimbus-kubearmor/Dockerfile b/pkg/adapter/nimbus-kubearmor/Dockerfile index 4c1df8c9..ca62f302 100644 --- a/pkg/adapter/nimbus-kubearmor/Dockerfile +++ b/pkg/adapter/nimbus-kubearmor/Dockerfile @@ -18,6 +18,7 @@ RUN go mod download COPY main.go main.go COPY manager/ manager/ COPY processor/ processor/ +COPY watcher/ watcher/ # Build # the GOARCH has not a default value to allow the binary be built according to the host where the command diff --git a/pkg/adapter/nimbus-kubearmor/go.mod b/pkg/adapter/nimbus-kubearmor/go.mod index 089f13a0..be1af002 100644 --- a/pkg/adapter/nimbus-kubearmor/go.mod +++ b/pkg/adapter/nimbus-kubearmor/go.mod @@ -3,7 +3,7 @@ module github.com/5GSEC/nimbus/pkg/adapter/nimbus-kubearmor go 1.21 require ( - github.com/5GSEC/nimbus v0.0.0-20240129090659-01178b5c28c7 + github.com/5GSEC/nimbus v0.0.0-20240208070656-624660f34768 github.com/go-logr/logr v1.4.1 github.com/kubearmor/KubeArmor/pkg/KubeArmorController v0.0.0-20240125171707-8e6641511fe3 k8s.io/apimachinery v0.29.1 diff --git a/pkg/adapter/nimbus-kubearmor/go.sum b/pkg/adapter/nimbus-kubearmor/go.sum index 1d7218cc..8e5bfd38 100644 --- a/pkg/adapter/nimbus-kubearmor/go.sum +++ b/pkg/adapter/nimbus-kubearmor/go.sum @@ -1,5 +1,7 @@ github.com/5GSEC/nimbus v0.0.0-20240129090659-01178b5c28c7 h1:adBGcrCAKeU7PLiz6m2c+3c8uuL5UPkHN5O6FHJQm7I= github.com/5GSEC/nimbus v0.0.0-20240129090659-01178b5c28c7/go.mod h1:VXo/w78XDmQEunuZYIsDyGDthCKealQR13X9OkY25D0= +github.com/5GSEC/nimbus v0.0.0-20240208070656-624660f34768 h1:v2fY3lWXydstfekQSHs9n0TpNnTteC7Iws3ojwGtFJk= +github.com/5GSEC/nimbus v0.0.0-20240208070656-624660f34768/go.mod h1:yw79m9f1+f3tBSZCMQKbNVKL39Q71FyGyoa8nClo1Hs= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= diff --git a/pkg/adapter/nimbus-kubearmor/manager/manager.go b/pkg/adapter/nimbus-kubearmor/manager/manager.go index eaa90e15..a1f148d0 100644 --- a/pkg/adapter/nimbus-kubearmor/manager/manager.go +++ b/pkg/adapter/nimbus-kubearmor/manager/manager.go @@ -19,10 +19,11 @@ import ( intentv1 "github.com/5GSEC/nimbus/api/v1" "github.com/5GSEC/nimbus/pkg/adapter/common" "github.com/5GSEC/nimbus/pkg/adapter/k8s" - "github.com/5GSEC/nimbus/pkg/adapter/nimbus-kubearmor/processor" - kspwatcher "github.com/5GSEC/nimbus/pkg/adapter/nimbus-kubearmor/watcher" adapterutil "github.com/5GSEC/nimbus/pkg/adapter/util" globalwatcher "github.com/5GSEC/nimbus/pkg/adapter/watcher" + + "github.com/5GSEC/nimbus/pkg/adapter/nimbus-kubearmor/processor" + kspwatcher "github.com/5GSEC/nimbus/pkg/adapter/nimbus-kubearmor/watcher" ) var ( diff --git a/pkg/adapter/nimbus-netpol/Dockerfile b/pkg/adapter/nimbus-netpol/Dockerfile index 8aefda73..cc39a348 100644 --- a/pkg/adapter/nimbus-netpol/Dockerfile +++ b/pkg/adapter/nimbus-netpol/Dockerfile @@ -18,6 +18,7 @@ RUN go mod download COPY main.go main.go COPY manager/ manager/ COPY processor/ processor/ +COPY watcher/ watcher/ # Build # the GOARCH has not a default value to allow the binary be built according to the host where the command diff --git a/pkg/adapter/nimbus-netpol/go.mod b/pkg/adapter/nimbus-netpol/go.mod index 14933acf..1b82b8ba 100644 --- a/pkg/adapter/nimbus-netpol/go.mod +++ b/pkg/adapter/nimbus-netpol/go.mod @@ -3,7 +3,7 @@ module github.com/5GSEC/nimbus/pkg/adapter/nimbus-netpol go 1.21 require ( - github.com/5GSEC/nimbus v0.0.0-20240129090659-01178b5c28c7 + github.com/5GSEC/nimbus v0.0.0-20240208070656-624660f34768 github.com/go-logr/logr v1.4.1 k8s.io/api v0.29.1 k8s.io/apimachinery v0.29.1 diff --git a/pkg/adapter/nimbus-netpol/go.sum b/pkg/adapter/nimbus-netpol/go.sum index 4568990d..40de45ce 100644 --- a/pkg/adapter/nimbus-netpol/go.sum +++ b/pkg/adapter/nimbus-netpol/go.sum @@ -1,5 +1,7 @@ github.com/5GSEC/nimbus v0.0.0-20240129090659-01178b5c28c7 h1:adBGcrCAKeU7PLiz6m2c+3c8uuL5UPkHN5O6FHJQm7I= github.com/5GSEC/nimbus v0.0.0-20240129090659-01178b5c28c7/go.mod h1:VXo/w78XDmQEunuZYIsDyGDthCKealQR13X9OkY25D0= +github.com/5GSEC/nimbus v0.0.0-20240208070656-624660f34768 h1:v2fY3lWXydstfekQSHs9n0TpNnTteC7Iws3ojwGtFJk= +github.com/5GSEC/nimbus v0.0.0-20240208070656-624660f34768/go.mod h1:yw79m9f1+f3tBSZCMQKbNVKL39Q71FyGyoa8nClo1Hs= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= diff --git a/pkg/adapter/nimbus-netpol/manager/netpols_manager.go b/pkg/adapter/nimbus-netpol/manager/netpols_manager.go index d73ea35c..86a75a35 100644 --- a/pkg/adapter/nimbus-netpol/manager/netpols_manager.go +++ b/pkg/adapter/nimbus-netpol/manager/netpols_manager.go @@ -19,10 +19,11 @@ import ( intentv1 "github.com/5GSEC/nimbus/api/v1" "github.com/5GSEC/nimbus/pkg/adapter/common" "github.com/5GSEC/nimbus/pkg/adapter/k8s" - "github.com/5GSEC/nimbus/pkg/adapter/nimbus-netpol/processor" - netpolwatcher "github.com/5GSEC/nimbus/pkg/adapter/nimbus-netpol/watcher" adapterutil "github.com/5GSEC/nimbus/pkg/adapter/util" globalwatcher "github.com/5GSEC/nimbus/pkg/adapter/watcher" + + "github.com/5GSEC/nimbus/pkg/adapter/nimbus-netpol/processor" + netpolwatcher "github.com/5GSEC/nimbus/pkg/adapter/nimbus-netpol/watcher" ) var (