diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index a90109fe..72c63925 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -5,30 +5,23 @@ on: branches: ['*'] jobs: - build-test: - name: Build, lint, test + test-multiarch-image-build: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Go - uses: actions/setup-go@v3 - with: - go-version: '1.25' - - name: Install make - run: sudo apt -y install make - - name: run build - run: make build && git diff --exit-code - - name: run unit tests - run: make test coverage-report - - name: check clean vendors - run: go mod vendor - - name: Report coverage - uses: codecov/codecov-action@v4 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - with: - files: ./cover.out - flags: unittests - fail_ci_if_error: false - verbose: true \ No newline at end of file + - name: install make + run: sudo apt-get install make + - name: set up go 1.x + uses: actions/setup-go@v3 + with: + go-version: '1.25' + - + name: Set up QEMU dependency + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: checkout + uses: actions/checkout@v3 + - name: build and push manifest with images + run: | + MULTIARCH_TARGETS="arm64" IMAGE_ORG=netobserv VERSION=test CLEAN_BUILD=1 make image-build diff --git a/.github/workflows/pull_request_e2e.yml b/.github/workflows/pull_request_e2e.yml deleted file mode 100644 index 84e94042..00000000 --- a/.github/workflows/pull_request_e2e.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: pull request - e2e tests - -#todo: check caching dependencies: https://github.com/actions/cache -on: - push: - branches: [ 'main', 'release-*' ] - pull_request: - branches: [ 'main', 'release-*' ] - -jobs: - e2e-tests: - name: e2e-tests - runs-on: ubuntu-latest - steps: - - name: install make - run: sudo apt-get install make - - name: install oc & kubectl - run: | - wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.15/openshift-client-linux.tar.gz - tar xvf openshift-client-linux.tar.gz oc kubectl - sudo cp oc kubectl /usr/local/bin - oc version - - name: set up go 1.x - uses: actions/setup-go@v3 - with: - go-version: '1.25' - - name: checkout - uses: actions/checkout@v3 - - name: get kernel version - run: uname -r - - name: run end-to-end tests - run: make tests-e2e - - name: upload e2e test logs - uses: actions/upload-artifact@v4 - if: always() - with: - name: e2e-logs - path: | - e2e-logs - e2e/commands - e2e/output \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e49abab2..ef783886 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,6 @@ # We do not use --platform feature to auto fill this ARG because of incompatibility between podman and docker ARG TARGETARCH=amd64 -# Build the manager binary -FROM docker.io/library/golang:1.25 as builder - -ARG TARGETARCH -ARG LDFLAGS - -WORKDIR /opt/app-root - -COPY cmd cmd -COPY internal internal -COPY main.go main.go -COPY go.mod go.mod -COPY go.sum go.sum -COPY vendor/ vendor/ - -# Build collector -RUN GOARCH=$TARGETARCH go build -ldflags "$LDFLAGS" -mod vendor -a -o build/network-observability-cli - -# We still need Makefile & resources for oc-commands; copy them after go build for caching -COPY commands/ commands/ -COPY res/ res/ -COPY scripts/ scripts/ -COPY Makefile Makefile -COPY .mk/ .mk/ - -# Embed commands in case users want to pull it from collector image -RUN USER=netobserv VERSION=main make oc-commands - -# Prepare output dir -RUN mkdir -p output - # Create final image from ubi + built binary and command FROM --platform=linux/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal:9.7-1769056855 @@ -40,8 +9,4 @@ RUN microdnf install -y tar && \ WORKDIR / -COPY --from=builder /opt/app-root/build . -COPY --from=builder --chown=65532:65532 /opt/app-root/output /output USER 65532:65532 - -ENTRYPOINT ["/network-observability-cli"]