Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facing issue during "make docker-build" for v0.26.0 #474

Open
samarth96 opened this issue Jan 2, 2023 · 2 comments
Open

Facing issue during "make docker-build" for v0.26.0 #474

samarth96 opened this issue Jan 2, 2023 · 2 comments

Comments

@samarth96
Copy link

samarth96 commented Jan 2, 2023

i did following steps

git clone https://github.com/fluxcd/image-automation-controller -b v0.26.0
export DOCKER_CLI_EXPERIMENTAL=enabled
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --use
make docker-build

I am getting following error

=> [linux/amd64->arm/v7 build 8/9] RUN export PKG_CONFIG_PATH="/usr/local/$(xx-info triple)/lib/pkgconfig" && export CGO_LDFLAGS="$(pkg-config --static --libs --cflags libgit2) -static -fuse-
=> => # Package libgit2 was not found in the pkg-config search path.
=> => # Perhaps you should add the directory containing `libgit2.pc'
=> => # to the PKG_CONFIG_PATH environment variable
=> => # Package 'libgit2', required by 'virtual:world', not found

I tried to add libgit2 and libgit2-dev in Dockerfile
But I get below error

[linux/amd64->arm/v7 build 8/9] RUN export PKG_CONFIG_PATH="/usr/local/$(xx-info triple)/lib/pkgconfig" && export CGO_LDFLAGS="$(pkg-config --static --libs --cflags libgit2) -static -fuse-ld=lld" && xx-go build -ldflags "-s -w" -tags 'netgo,osusergo,static_build' -o /source-controller -trimpath main.go;:
#0 308.1 # github.com/libgit2/git2go/v33
#0 308.1 /go/pkg/mod/github.com/fluxcd/git2go/v33@v33.0.9-flux/Build_system_dynamic.go:12:3: error: "Invalid libgit2 version; this git2go supports libgit2 between v1.3.0 and v1.3.0"
#0 308.1 # error "Invalid libgit2 version; this git2go supports libgit2 between v1.3.0 and v1.3.0"
#0 308.1 ^
#0 308.1 1 error generated.

@pjbgf
Copy link
Member

pjbgf commented Jan 2, 2023

@samarth96 is there any specific reason why you are trying to build the v0.26.0 instead of main? We have recently deprecated the use of libgit2 in the controller, which removes all the complexity around building the project.

If you still need this, you can try recreating your buildx machine, as I suspect that may be the issue. This is what I used to build the docker images: https://github.com/fluxcd/golang-with-libgit2/blob/main/Makefile#L45-L55

@samarth96
Copy link
Author

I am using flux 0.35.0 and it requires v0.26.0 version of. image-automation-controller.

I used the buildx options you suggested above and I am still facing same issue

Here is complete output

[root@***** image-automation-controller]# docker buildx create --name local-builder1 --platform linux/amd64,linux/arm/v7,linux/arm64 --driver-opt network=host --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=1073741274 --driver-opt env.BUILDKIT_STEP_LOG_MAX_SPEED=5000000000000 --buildkitd-flags '--allow-insecure-entitlement security.insecure' --use
local-builder1

[root@***** image-automation-controller]# docker buildx build
--build-arg LIBGIT2_IMG=golang-with-libgit2-only
--build-arg LIBGIT2_TAG=v0.3.0
--platform=linux/amd64,linux/arm64,linux/arm/v7
-t fluxcd/image-automation-controller:latest
.
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
[+] Building 11.0s (53/65)
=> [linux/amd64 xx 1/1] FROM tonistiigi/xx:1.1.2@sha256:a96ba6230d66c27afbd1bed8bd63b0774d021a590735d2fc525319895d3667bb 0.9s
=> => resolve tonistiigi/xx:1.1.2@sha256:a96ba6230d66c27afbd1bed8bd63b0774d021a590735d2fc525319895d3667bb 0.8s
=> [linux/amd64 gostable 1/1] FROM golang:1.19-alpine@sha256:f33331e12ca70192c0dbab2d0a74a52e1dd344221507d88aaea605b0219a212f 0.9s
=> => resolve golang:1.19-alpine@sha256:f33331e12ca70192c0dbab2d0a74a52e1dd344221507d88aaea605b0219a212f 0.8s
=> [linux/arm64 libgit2-libs 1/1] FROM golang-with-libgit2-only:v0.3.0@sha256:05c40119eb3f58b9d0bb43f8c6ba65b3ce24601cf9c4157f31a0793c1dca49d8 0.9s
=> => resolve golang-with-libgit2-only:v0.3.0@sha256:05c40119eb3f58b9d0bb43f8c6ba65b3ce24601cf9c4157f31a0793c1dca49d8 0.8s
=> [linux/arm64 stage-7 1/5] FROM alpine:3.16@sha256:3d426b0bfc361d6e8303f51459f17782b219dece42a1c7fe463b6014b189c86d 0.9s
=> => resolve alpine:3.16@sha256:3d426b0bfc361d6e8303f51459f17782b219dece42a1c7fe463b6014b189c86d 0.8s
=> [linux/amd64 stage-7 1/5] FROM alpine:3.16@sha256:3d426b0bfc361d6e8303f51459f17782b219dece42a1c7fe463b6014b189c86d 0.9s
=> => resolve alpine:3.16@sha256:3d426b0bfc361d6e8303f51459f17782b219dece42a1c7fe463b6014b189c86d 0.7s
=> [linux/amd64 libgit2-libs 1/1] FROM golang-with-libgit2-only:v0.3.0@sha256:05c40119eb3f58b9d0bb43f8c6ba65b3ce24601cf9c4157f31a0793c1dca49d8 0.8s
=> => resolve golang-with-libgit2-only:v0.3.0@sha256:05c40119eb3f58b9d0bb43f8c6ba65b3ce24601cf9c4157f31a0793c1dca49d8 0.6s
=> CACHED [linux/arm/v7 stage-7 2/5] RUN apk --no-cache add ca-certificates && update-ca-certificates 0.0s
=> CACHED [linux/arm/v7 stage-7 3/5] RUN ! -e /etc/nsswitch.conf && echo 'hosts: files dns' > /etc/nsswitch.conf 0.0s
=> CACHED [linux/arm64 stage-7 2/5] RUN apk --no-cache add ca-certificates && update-ca-certificates 0.0s
=> CACHED [linux/arm64 stage-7 3/5] RUN ! -e /etc/nsswitch.conf && echo 'hosts: files dns' > /etc/nsswitch.conf 0.0s
=> CACHED [linux/amd64 build-base 1/2] RUN apk add clang lld pkgconfig 0.0s
=> CACHED [linux/amd64 build-base 2/2] COPY --from=xx / / 0.0s
=> CACHED [linux/amd64 build-go-mod 1/5] WORKDIR /workspace 0.0s
=> CACHED [linux/amd64 build-go-mod 2/5] COPY api/ api/ 0.0s
=> CACHED [linux/amd64 build-go-mod 3/5] COPY go.mod go.mod 0.0s
=> CACHED [linux/amd64 build-go-mod 4/5] COPY go.sum go.sum 0.0s
=> CACHED [linux/amd64 build-go-mod 5/5] RUN export http_proxy=http://www-proxy-hqdc.us.oracle.com:80 && export https_proxy=http://www-proxy-hqdc.us.oracle.com:80 && go mod download 0.0s
=> CACHED [linux/amd64 build 1/9] COPY --from=libgit2-libs /usr/local/ /usr/local/ 0.0s
=> CACHED [linux/amd64 build 2/9] RUN xx-apk add musl-dev gcc clang lld 0.0s
=> CACHED [linux/amd64 build 3/9] WORKDIR /workspace 0.0s
=> CACHED [linux/amd64 build 4/9] COPY main.go main.go 0.0s
=> CACHED [linux/amd64 build 5/9] COPY controllers/ controllers/ 0.0s
=> CACHED [linux/amd64 build 6/9] COPY pkg/ pkg/ 0.0s
=> CACHED [linux/amd64 build 7/9] COPY internal/ internal/ 0.0s
=> [linux/amd64 build 8/9] RUN export LIBRARY_PATH="/usr/local/$(xx-info triple)" && export PKG_CONFIG_PATH="/usr/local/$(xx-info triple)/lib/pkgconfig" && export CGO_LDFLAGS="$(pkg-config --s 9.0s
=> CACHED [linux/amd64->arm/v7 build 1/9] COPY --from=libgit2-libs /usr/local/ /usr/local/ 0.0s
=> CACHED [linux/amd64->arm/v7 build 2/9] RUN xx-apk add musl-dev gcc clang lld 0.0s
=> CACHED [linux/amd64->arm/v7 build 3/9] WORKDIR /workspace 0.0s
=> CACHED [linux/amd64->arm/v7 build 4/9] COPY main.go main.go 0.0s
=> CACHED [linux/amd64->arm/v7 build 5/9] COPY controllers/ controllers/ 0.0s
=> CACHED [linux/amd64->arm/v7 build 6/9] COPY pkg/ pkg/ 0.0s
=> CACHED [linux/amd64->arm/v7 build 7/9] COPY internal/ internal/ 0.0s
=> CACHED [linux/amd64->arm64 build 1/9] COPY --from=libgit2-libs /usr/local/ /usr/local/ 0.0s
=> CACHED [linux/amd64->arm64 build 2/9] RUN xx-apk add musl-dev gcc clang lld 0.0s
=> CACHED [linux/amd64->arm64 build 3/9] WORKDIR /workspace 0.0s
=> CACHED [linux/amd64->arm64 build 4/9] COPY main.go main.go 0.0s
=> CACHED [linux/amd64->arm64 build 5/9] COPY controllers/ controllers/ 0.0s
=> CACHED [linux/amd64->arm64 build 6/9] COPY pkg/ pkg/ 0.0s
=> CACHED [linux/amd64->arm64 build 7/9] COPY internal/ internal/ 0.0s
=> CACHED [linux/amd64 stage-7 2/5] RUN apk --no-cache add ca-certificates && update-ca-certificates 0.0s
=> CACHED [linux/amd64 stage-7 3/5] RUN ! -e /etc/nsswitch.conf && echo 'hosts: files dns' > /etc/nsswitch.conf 0.0s
=> [linux/amd64->arm64 build 8/9] RUN export LIBRARY_PATH="/usr/local/$(xx-info triple)" && export PKG_CONFIG_PATH="/usr/local/$(xx-info triple)/lib/pkgconfig" && export CGO_LDFLAGS="$(pkg-con 9.0s
=> => # Package libgit2 was not found in the pkg-config search path.
=> => # Perhaps you should add the directory containing libgit2.pc' => => # to the PKG_CONFIG_PATH environment variable => => # Package 'libgit2', required by 'virtual:world', not found => [linux/amd64->arm/v7 build 8/9] RUN export LIBRARY_PATH="/usr/local/$(xx-info triple)" && export PKG_CONFIG_PATH="/usr/local/$(xx-info triple)/lib/pkgconfig" && export CGO_LDFLAGS="$(pkg-co 9.0s => => # Package libgit2 was not found in the pkg-config search path. => => # Perhaps you should add the directory containing libgit2.pc'
=> => # to the PKG_CONFIG_PATH environment variable
=> => # Package 'libgit2', required by 'virtual:world', not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants