diff --git a/.github/workflows/docker-publish-nptest.yml b/.github/workflows/docker-publish-nptest.yml new file mode 100644 index 0000000000..1a131a59c2 --- /dev/null +++ b/.github/workflows/docker-publish-nptest.yml @@ -0,0 +1,39 @@ +name: Build and Push Docker Image for network/benchmarks/netperf/nptest + +on: + push: + tags: + - '**' + +jobs: + build-and-push: + permissions: + packages: write # Write permission is required to publish Docker images to GitHub Container Registry + contents: read + + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + run: | + cd network/benchmarks/netperf + make push + env: + DOCKERREPO: ghcr.io/${{ github.repository_owner }}/nptest + IMAGE_TAG: ${{ github.ref_name }} diff --git a/network/benchmarks/netperf/Makefile b/network/benchmarks/netperf/Makefile index 6440e54f45..7fe848b924 100644 --- a/network/benchmarks/netperf/Makefile +++ b/network/benchmarks/netperf/Makefile @@ -15,14 +15,15 @@ all: docker push launch runtests DOCKERREPO := $(or $(DOCKERREPO), girishkalele/netperf-latest) +IMAGE_TAG := $(or $(IMAGE_TAG), latest) -docker: launch +docker: test mkdir -p Dockerbuild && \ cp -rf nptest/* Dockerbuild/ && \ - docker build -t $(DOCKERREPO) Dockerbuild/ + docker build -t $(DOCKERREPO):$(IMAGE_TAG) Dockerbuild/ push: docker - gcloud docker push $(DOCKERREPO) + docker push $(DOCKERREPO):$(IMAGE_TAG) clean: @rm -f Dockerbuild/* @@ -33,6 +34,10 @@ clean: launch: launch.go go build -o launch launch.go +test: + go test ./... + cd nptest && go test ./... + # 'runtests' is the test runner target runtests: launch @echo Launching network performance tests @@ -42,7 +47,5 @@ runtests: launch @echo Results file netperf-latest.csv and SVG/PNG graphs generated successfully localtest: docker - docker push $(DOCKERREPO) - go run launch.go -image=$(DOCKERREPO) -json -kubeConfig ./kubeConfig - - + docker push $(DOCKERREPO):$(IMAGE_TAG) + go run launch.go -image=$(DOCKERREPO):$(IMAGE_TAG) -json -kubeConfig ./kubeConfig diff --git a/network/benchmarks/netperf/nptest/Dockerfile b/network/benchmarks/netperf/nptest/Dockerfile index 5b82454be8..327b843123 100644 --- a/network/benchmarks/netperf/nptest/Dockerfile +++ b/network/benchmarks/netperf/nptest/Dockerfile @@ -52,6 +52,12 @@ RUN cd iperf-3.1 && ./configure --prefix=/usr/local --bindir /usr/local/bin && m RUN curl -LO https://github.com/HewlettPackard/netperf/archive/netperf-2.7.0.tar.gz && tar -xzf netperf-2.7.0.tar.gz && mv netperf-netperf-2.7.0/ netperf-2.7.0 RUN cd netperf-2.7.0 && ./configure --prefix=/usr/local --bindir /usr/local/bin && make CFLAGS=-fcommon && make install +# Validate the installation of qperf, iperf3 and netperf +RUN usr/local/bin/qperf --help +RUN usr/local/bin/iperf3 -v +RUN usr/local/bin/netperf -V +RUN usr/local/bin/netserver -V + COPY --from=builder /workspace/nptests /usr/bin/ ENTRYPOINT ["nptests"]