Skip to content

Commit

Permalink
build: use the latest builder image
Browse files Browse the repository at this point in the history
Signed-off-by: Huamin Chen <[email protected]>
  • Loading branch information
rootfs committed Dec 6, 2023
1 parent e2c9397 commit b310bbf
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 430 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/image_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.builder
file: ./build/Dockerfile.builder
platforms: linux/amd64
push: true
tags: quay.io/sustainable_computing_io/kepler_builder:ubi-9-libbpf-1.2.0
Expand Down
33 changes: 0 additions & 33 deletions Dockerfile.base

This file was deleted.

89 changes: 12 additions & 77 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VERSION ?= $(GIT_VERSION)
LDFLAGS := "-w -s -X 'github.com/sustainable-computing-io/kepler/pkg/version.Version=$(VERSION)'"
ROOTLESS ?= false
IMAGE_REPO ?= quay.io/sustainable_computing_io
BUILDER_IMAGE ?= quay.io/sustainable_computing_io/kepler_builder:ubi-9-libbpf-1.2.0-go1.18
BUILDER_IMAGE ?= quay.io/sustainable_computing_io/kepler_builder:ubi-9-libbpf-1.2.0
IMAGE_NAME ?= kepler
IMAGE_TAG ?= latest
CTR_CMD ?= $(or $(shell which podman 2>/dev/null), $(shell which docker 2>/dev/null))
Expand Down Expand Up @@ -44,75 +44,15 @@ GOOS := $(shell go env GOOS)
GOARCH := $(shell go env GOARCH)
GOENV := GOOS=$(GOOS) GOARCH=$(GOARCH)

ifdef ATTACHER_TAG
ATTACHER_TAG := $(ATTACHER_TAG)
ifeq ($(ATTACHER_TAG),libbpf)
LIBBPF_HEADERS := /usr/include/bpf
KEPLER_OBJ_SRC := $(SRC_ROOT)/bpfassets/libbpf/bpf.o/$(GOARCH)_kepler.bpf.o
LIBBPF_OBJ ?= /usr/lib64/libbpf.a
endif
else
# auto determine
BCC_TAG :=
LIBBPF_TAG :=

ifneq ($(shell command -v ldconfig),)
ifneq ($(shell ldconfig -p|grep bcc),)
BCC_TAG = bcc
endif
endif

ifneq ($(shell command -v dpkg),)
ifneq ($(shell dpkg -l|grep bcc),)
BCC_TAG = bcc
endif
endif

ifneq ($(shell command -v ldconfig),)
ifneq ($(shell ldconfig -p|grep libbpf),)
LIBBPF_TAG = libbpf
endif
endif

ifneq ($(shell command -v dpkg),)
ifneq ($(shell dpkg -l|grep libbpf-dev),)
LIBBPF_TAG = libbpf
endif
endif

LIBBPF_HEADERS := /usr/include/bpf
KEPLER_OBJ_SRC := $(SRC_ROOT)/bpfassets/libbpf/bpf.o/$(GOARCH)_kepler.bpf.o
LIBBPF_OBJ := /usr/lib/$(ARCH)-linux-gnu/libbpf.a

# for libbpf tag, if libbpf.a, kepler.bpf.o exist, clear bcc tag
ifneq ($(LIBBPF_TAG),)
ifneq ($(wildcard $(LIBBPF_OBJ)),)
ifneq ($(wildcard $(KEPLER_OBJ_SRC)),)
BCC_TAG =
endif
endif
endif
# if bcc tag is not clear, clear libbpf tag
ifneq ($(BCC_TAG),)
LIBBPF_TAG =
endif
ATTACHER_TAG := $(BCC_TAG)$(LIBBPF_TAG)
endif
LIBBPF_HEADERS := /usr/include/bpf
KEPLER_OBJ_SRC := $(SRC_ROOT)/bpfassets/libbpf/bpf.o/$(GOARCH)_kepler.bpf.o
LIBBPF_OBJ ?= /usr/lib64/libbpf.a

# if libbpf tag is not empty, update goenv
ifeq ($(ATTACHER_TAG),libbpf)
GOENV = GO111MODULE="" GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=1 CC=clang CGO_CFLAGS="-I $(LIBBPF_HEADERS)" CGO_LDFLAGS="$(LIBBPF_OBJ)"
endif
GOENV = GO111MODULE="" GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=1 CC=clang CGO_CFLAGS="-I $(LIBBPF_HEADERS)" CGO_LDFLAGS="$(LIBBPF_OBJ)"

ifneq ($(ATTACHER_TAG),)
DOCKERFILE := $(SRC_ROOT)/build/Dockerfile.$(ATTACHER_TAG).kepler
IMAGE_BUILD_TAG := $(SOURCE_GIT_TAG)-linux-$(GOARCH)-$(ATTACHER_TAG)
GO_BUILD_TAGS := $(GENERAL_TAGS)'$(ATTACHER_TAG) '$(GOOS)
else
DOCKERFILE := $(SRC_ROOT)/build/Dockerfile
IMAGE_BUILD_TAG := $(SOURCE_GIT_TAG)-linux-$(GOARCH)
GO_BUILD_TAGS := $(GENERAL_TAGS)$(GOOS)
endif
DOCKERFILE := $(SRC_ROOT)/build/Dockerfile
IMAGE_BUILD_TAG := $(SOURCE_GIT_TAG)-linux-$(GOARCH)
GO_BUILD_TAGS := $(GENERAL_TAGS)$(GOOS)

# for testsuite
ENVTEST_ASSETS_DIR=$(SRC_ROOT)/test-bin
Expand Down Expand Up @@ -142,7 +82,7 @@ clean: clean-cross-build
.PHONY: clean

### build container ###
build_containerized: genbpfassets tidy-vendor format
build_containerized: tidy-vendor format
@if [ -z '$(CTR_CMD)' ] ; then echo '!! ERROR: containerized builds require podman||docker CLI, none found $$PATH' >&2 && exit 1; fi
echo BIN_TIMESTAMP==$(BIN_TIMESTAMP)

Expand Down Expand Up @@ -228,15 +168,15 @@ clean_build_local:
copy_build_local:
cp $(CROSS_BUILD_BINDIR)/$(GOOS)_$(GOARCH)/kepler $(CROSS_BUILD_BINDIR)

cross-build-linux-amd64: genbpfassets
cross-build-linux-amd64:
+$(MAKE) _build_local GOOS=linux GOARCH=amd64
.PHONY: cross-build-linux-amd64

cross-build-linux-arm64: genbpfassets
cross-build-linux-arm64:
+$(MAKE) _build_local GOOS=linux GOARCH=arm64
.PHONY: cross-build-linux-arm64

cross-build-linux-s390x: genbpfassets
cross-build-linux-s390x:
+$(MAKE) _build_local GOOS=linux GOARCH=s390x
.PHONY: cross-build-linux-s390x

Expand Down Expand Up @@ -306,11 +246,6 @@ golint:
golangci/golangci-lint \
golangci-lint run --verbose

genbpfassets:
GO111MODULE=off go get -u github.com/go-bindata/go-bindata/...
./hack/bindata.sh
.PHONY: genbpfassets

genlibbpf: kepler.bpf.o


Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# This Dockerfile is used for building the kepler default image: Dockerfile.bcc.kepler
#
FROM quay.io/sustainable_computing_io/kepler_builder:ubi-9-bcc-0.26-go1.18 as builder
FROM quay.io/sustainable_computing_io/kepler_builder:ubi-9-libbpf-1.2.0 as builder

ARG BIN_TIMESTAMP
ARG SOURCE_GIT_TAG
Expand Down
27 changes: 0 additions & 27 deletions build/Dockerfile.bcc.base

This file was deleted.

32 changes: 0 additions & 32 deletions build/Dockerfile.bcc.base.amd64

This file was deleted.

31 changes: 0 additions & 31 deletions build/Dockerfile.bcc.base.arm64

This file was deleted.

32 changes: 0 additions & 32 deletions build/Dockerfile.bcc.base.s390x

This file was deleted.

10 changes: 0 additions & 10 deletions build/Dockerfile.bcc.builder

This file was deleted.

43 changes: 0 additions & 43 deletions build/Dockerfile.bcc.kepler

This file was deleted.

Loading

0 comments on commit b310bbf

Please sign in to comment.