Skip to content

Commit

Permalink
Use correct tag for ghaction builds
Browse files Browse the repository at this point in the history
  • Loading branch information
jotak committed Dec 10, 2024
1 parent 2a861f8 commit 368c077
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/push_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ jobs:
- name: get short sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: build and push bytecode image
run: make build-and-push-bc-image
run: |
IMAGE_NOO_BC=quay.io/netobserv/ebpf-bytecode:${{ env.WF_VERSION }} make build-and-push-bc-image
IMAGE_NOO_BC=quay.io/netobserv/ebpf-bytecode:${{ env.short_sha }} OCI_BUILD_OPTS="--label quay.expires-after=2w" make build-and-push-bc-image
- name: build and push manifest with images
run: |
MULTIARCH_TARGETS="${{ env.WF_MULTIARCH_TARGETS }}" IMAGE_ORG=${{ env.WF_ORG }} VERSION=${{ env.WF_VERSION }} CLEAN_BUILD=1 make images
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/push_image_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
registry: quay.io
- name: get short sha
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: build and push bytecode image
run: IMAGE_NOO_BC=quay.io/netobserv/ebpf-bytecode:${{ env.short_sha }} OCI_BUILD_OPTS="--label quay.expires-after=2w" make build-and-push-bc-image
- name: build and push manifest with images
run: OCI_BUILD_OPTS="--label quay.expires-after=2w" IMAGE_ORG=${{ env.WF_ORG }} IMAGE=${{ env.WF_REGISTRY }}/${{ env.WF_IMAGE }}:${{ env.short_sha }} CLEAN_BUILD=1 make images
- uses: actions/github-script@v6
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ compile: ## Compile ebpf agent project
GOARCH=${GOARCH} GOOS=$(GOOS) go build -mod vendor -a -o bin/netobserv-ebpf-agent cmd/netobserv-ebpf-agent.go

.PHONY: build-and-push-bc-image
build-and-push-bc-image: docker-generate ## Build and push bytecode image
IMAGE_NOO_BC=${IMAGE_NOO_BC} ./hack/build-bytecode-images-multi.sh
build-and-push-bc-image: ## Build and push bytecode image
IMAGE_NOO_BC=${IMAGE_NOO_BC} OCI_BIN=${OCI_BIN} OCI_BUILD_OPTS="${OCI_BUILD_OPTS}" ./hack/build-bytecode-images-multi.sh

.PHONY: test
test: ## Test code using go test
Expand Down
46 changes: 32 additions & 14 deletions hack/build-bytecode-images-multi.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash

# Set default value for IMAGE_NOO_BC tag if not already set
IMAGE_NOO_BC=${IMAGE_NOO_BC:-quay.io/netobserv/ebpf-bytecode}
IMAGE_NOO_BC=${IMAGE_NOO_BC:-quay.io/${USER}/ebpf-bytecode}
OCI_BIN=${OCI_BIN:-docker}

# PROGRAMS is a list of <program name>:<program type> tuples
PROGRAMS='{
Expand Down Expand Up @@ -29,17 +30,34 @@ MAPS='{
"filter_map":"lpm_trie"
}'

docker buildx create --use
docker buildx inspect --bootstrap
if [[ ${OCI_BIN} == "docker" ]]; then
docker buildx create --use
docker buildx inspect --bootstrap

DOCKER_BUILDKIT=1 docker buildx build \
--platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le \
--build-arg PROGRAMS="$PROGRAMS" \
--build-arg MAPS="$MAPS" \
--build-arg BC_AMD64_EL=bpf_x86_bpfel.o \
--build-arg BC_ARM64_EL=bpf_arm64_bpfel.o \
--build-arg BC_S390X_EB=bpf_s390_bpfeb.o \
--build-arg BC_PPC64LE_EL=bpf_powerpc_bpfel.o \
-f ./Containerfile.bytecode.multi.arch \
--push \
./pkg/ebpf -t $IMAGE_NOO_BC
docker buildx build \
--platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le \
--build-arg PROGRAMS="$PROGRAMS" \
--build-arg MAPS="$MAPS" \
--build-arg BC_AMD64_EL=bpf_x86_bpfel.o \
--build-arg BC_ARM64_EL=bpf_arm64_bpfel.o \
--build-arg BC_S390X_EB=bpf_s390_bpfeb.o \
--build-arg BC_PPC64LE_EL=bpf_powerpc_bpfel.o \
${OCI_BUILD_OPTS}
-f ./Containerfile.bytecode.multi.arch \
--push \
./pkg/ebpf -t $IMAGE_NOO_BC
else
${OCI_BIN} buildx build \
--platform linux/amd64,linux/arm64,linux/s390x,linux/ppc64le \
--build-arg PROGRAMS="$PROGRAMS" \
--build-arg MAPS="$MAPS" \
--build-arg BC_AMD64_EL=bpf_x86_bpfel.o \
--build-arg BC_ARM64_EL=bpf_arm64_bpfel.o \
--build-arg BC_S390X_EB=bpf_s390_bpfeb.o \
--build-arg BC_PPC64LE_EL=bpf_powerpc_bpfel.o \
${OCI_BUILD_OPTS}
-f ./Containerfile.bytecode.multi.arch \
./pkg/ebpf -t $IMAGE_NOO_BC

${OCI_BIN} push $IMAGE_NOO_BC
fi

0 comments on commit 368c077

Please sign in to comment.