This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 7df8ba0c8 build(deps): bump libgit2 1.3 → 1.5.0 and git2go v33 → v34
(#9028)
7df8ba0c8 is described below
commit 7df8ba0c8bd720f2479bcf19e527efb369e10a94
Author: Dirk <[email protected]>
AuthorDate: Tue Aug 11 09:21:16 2026 +0200
build(deps): bump libgit2 1.3 → 1.5.0 and git2go v33 → v34 (#9028)
* build(deps): libgit2 1.3→1.5 / git2go v33→v34
Bump git2go binding to v34.0.0 (highest importable module; the v35.0.0 tag
has a broken go.mod module path) paired with libgit2 1.5.0 across install
sites. git2go Go API is unchanged between v33 and v34, so no gitextractor code
changes are needed.
Signed-off-by: DoDiODev <[email protected]>
* ci: fix lake-builder image build (golang:1.26-bullseye does not exist)
The libgit2 cross-build stage was based on `golang:1.26-bullseye`, a tag
that
was never published (Go dropped bullseye variants), so the image build
failed
with "docker.io/library/golang:1.26-bullseye: not found". The stage does not
use Go at all, so it is now plain `debian:bullseye` with
wget/ca-certificates
added explicitly.
* ci: disable libgit2 test build in lake-builder image
The libgit2 cross-build failed at the cmake step with "Could not find a
python
interpreter, which is needed to build the tests". The upstream golang base
image happened to ship python; the plain debian:bullseye base does not, and
we
never build the libgit2 tests anyway. Pass -DBUILD_TESTS=OFF.
* ci: bootstrap libgit2 1.5 in Go workflows
Signed-off-by: DoDiODev <[email protected]>
---------
Signed-off-by: DoDiODev <[email protected]>
---
.devcontainer/Dockerfile | 2 +-
.github/workflows/golangci-lint.yml | 2 +
.github/workflows/test-e2e.yml | 4 +
.github/workflows/test.yml | 2 +
backend/Dockerfile | 4 +-
backend/Dockerfile.local | 4 +-
backend/go.mod | 2 +-
backend/go.sum | 17 +++-
backend/plugins/gitextractor/README.md | 2 +-
backend/plugins/gitextractor/models/diffline.go | 2 +-
.../plugins/gitextractor/parser/repo_libgit2.go | 2 +-
backend/scripts/install-libgit2.sh | 90 ++++++++++++++++++++++
devops/docker/lake-builder/Dockerfile | 14 ++--
13 files changed, 130 insertions(+), 17 deletions(-)
diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 5909efd37..7f5fbdca6 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -21,4 +21,4 @@ ENV
DEVLAKE_PLUGINS=argocd,bamboo,bitbucket,circleci,customize,dora,gitextractor
RUN apt-get update -y
RUN apt-get install pkg-config python3-dev default-libmysqlclient-dev
build-essential libpq-dev cmake -y
-RUN git clone -b v1.3.0 https://github.com/libgit2/libgit2.git && cd libgit2
&& mkdir build && cd build && cmake .. && make && make install
+RUN git clone -b v1.5.0 https://github.com/libgit2/libgit2.git && cd libgit2
&& mkdir build && cd build && cmake .. && make && make install
diff --git a/.github/workflows/golangci-lint.yml
b/.github/workflows/golangci-lint.yml
index 98d6deebd..cc68c18ca 100644
--- a/.github/workflows/golangci-lint.yml
+++ b/.github/workflows/golangci-lint.yml
@@ -30,6 +30,8 @@ jobs:
container: mericodev/lake-builder:latest
steps:
- uses: actions/checkout@v6
+ - name: Install libgit2 1.5 for git2go v34
+ run: backend/scripts/install-libgit2.sh
- name: Cache golangci-lint
id: cache-golangci-lint
uses: actions/cache@v5
diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml
index a37635165..c42b77530 100644
--- a/.github/workflows/test-e2e.yml
+++ b/.github/workflows/test-e2e.yml
@@ -50,6 +50,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6
- run: git config --global --add safe.directory $(pwd)
+ - name: Install libgit2 1.5 for git2go v34
+ run: backend/scripts/install-libgit2.sh
- name: Build Python
run: |
cd backend
@@ -90,6 +92,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v6
- run: git config --global --add safe.directory $(pwd)
+ - name: Install libgit2 1.5 for git2go v34
+ run: backend/scripts/install-libgit2.sh
- name: Build Python
run: |
cd backend
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 967d5ab7d..485ae5c72 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -47,6 +47,8 @@ jobs:
uses: actions/checkout@v6
- name: Set git config
run: git config --global --add safe.directory $(pwd)
+ - name: Install libgit2 1.5 for git2go v34
+ run: backend/scripts/install-libgit2.sh
- name: Build Python
run: |
cd backend
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 87e9adaef..3a30664cc 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -63,8 +63,8 @@ COPY --from=debian-arm64 /lib/aarch64-linux-gnu
/rootfs-arm64/lib/aarch64-linux-
RUN for arch in aarch64 x86_64 ; do \
mkdir -p /tmp/build/${arch} && cd /tmp/build/${arch} && \
- wget
https://github.com/libgit2/libgit2/archive/refs/tags/v1.3.0.tar.gz -O - | tar
-xz && \
- cd libgit2-1.3.0 && \
+ wget
https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz -O - | tar
-xz && \
+ cd libgit2-1.5.0 && \
mkdir build && cd build && \
if [ "$arch" = "aarch64" ] ; then \
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
diff --git a/backend/Dockerfile.local b/backend/Dockerfile.local
index 2fadbcec9..5dcfcaa71 100644
--- a/backend/Dockerfile.local
+++ b/backend/Dockerfile.local
@@ -40,8 +40,8 @@ RUN apt-get update && apt-get install -y \
# Install libgit2 for native platform only
RUN mkdir -p /tmp/build && cd /tmp/build && \
- wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.3.0.tar.gz -O
- | tar -xz && \
- cd libgit2-1.3.0 && \
+ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz -O
- | tar -xz && \
+ cd libgit2-1.5.0 && \
mkdir build && cd build && \
cmake .. -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=/usr/local && \
make -j$(nproc) install && \
diff --git a/backend/go.mod b/backend/go.mod
index dd212b463..2db88572d 100644
--- a/backend/go.mod
+++ b/backend/go.mod
@@ -14,7 +14,7 @@ require (
github.com/google/uuid v1.3.0
github.com/jackc/pgx/v5 v5.6.0 // indirect
github.com/lib/pq v1.10.2
- github.com/libgit2/git2go/v33 v33.0.6
+ github.com/libgit2/git2go/v34 v34.0.0
github.com/magiconair/properties v1.8.5
github.com/mitchellh/mapstructure v1.5.0
github.com/panjf2000/ants/v2 v2.4.6
diff --git a/backend/go.sum b/backend/go.sum
index 765636622..963625ce8 100644
--- a/backend/go.sum
+++ b/backend/go.sum
@@ -53,11 +53,13 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod
h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578
h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod
h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be
h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
+github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod
h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/antihax/optional v1.0.0/go.mod
h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod
h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod
h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod
h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
+github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod
h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/aws/aws-sdk-go v1.55.6
h1:cSg4pvZ3m8dgYcgqB97MrcdjUmZ1BeMYKUxMMB89IPk=
github.com/aws/aws-sdk-go v1.55.6/go.mod
h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/bgentry/speakeasy v0.1.0/go.mod
h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
@@ -106,6 +108,7 @@ github.com/davecgh/go-spew v1.1.1/go.mod
h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/denisenkom/go-mssqldb v0.9.0
h1:RSohk2RsiZqLZ0zCjtfn3S4Gp4exhpBWHyQ7D0yGjAk=
github.com/denisenkom/go-mssqldb v0.9.0/go.mod
h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a
h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU=
+github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod
h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM=
github.com/emirpasic/gods v1.18.1
h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
github.com/emirpasic/gods v1.18.1/go.mod
h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod
h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -117,6 +120,7 @@ github.com/envoyproxy/go-control-plane
v0.9.9-0.20210217033140-668b12f5399d/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod
h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fatih/color v1.7.0/go.mod
h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/frankban/quicktest v1.14.4
h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
+github.com/frankban/quicktest v1.14.4/go.mod
h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.4.9
h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod
h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gabriel-vasile/mimetype v1.4.3
h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
@@ -125,11 +129,13 @@ github.com/getsentry/sentry-go v0.18.0
h1:MtBW5H9QgdcJabtZcuJG80BMOwaBpkRDZkxRkN
github.com/getsentry/sentry-go v0.18.0/go.mod
h1:Kgon4Mby+FJ7ZWHFUAZgVaIa8sxHtnRJRLTXZr51aKQ=
github.com/ghodss/yaml v1.0.0/go.mod
h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/gzip v0.0.6
h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
+github.com/gin-contrib/gzip v0.0.6/go.mod
h1:QOJlmV2xmayAjkNS2Y8NQsMneuRShOU/kjovCXNuzzk=
github.com/gin-contrib/sse v0.1.0
h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod
h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod
h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/gliderlabs/ssh v0.3.7
h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE=
+github.com/gliderlabs/ssh v0.3.7/go.mod
h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8=
github.com/go-errors/errors v1.4.2
h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA=
github.com/go-errors/errors v1.4.2/go.mod
h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376
h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@@ -137,6 +143,7 @@ github.com/go-git/gcfg
v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS
github.com/go-git/go-billy/v5 v5.5.0
h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU=
github.com/go-git/go-billy/v5 v5.5.0/go.mod
h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399
h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
+github.com/go-git/go-git-fixtures/v4
v4.3.2-0.20231010084843-55a94097c399/go.mod
h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.12.0
h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys=
github.com/go-git/go-git/v5 v5.12.0/go.mod
h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod
h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
@@ -155,6 +162,7 @@ github.com/go-openapi/swag v0.19.5/go.mod
h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh
github.com/go-openapi/swag v0.19.15
h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.19.15/go.mod
h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-playground/assert/v2 v2.2.0
h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
+github.com/go-playground/assert/v2 v2.2.0/go.mod
h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.14.1
h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod
h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1
h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
@@ -225,6 +233,7 @@ github.com/google/go-cmp v0.5.3/go.mod
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.4/go.mod
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
+github.com/google/go-cmp v0.6.0/go.mod
h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod
h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod
h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod
h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@@ -369,8 +378,8 @@ github.com/lib/pq v1.2.0/go.mod
h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8=
github.com/lib/pq v1.10.2/go.mod
h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
-github.com/libgit2/git2go/v33 v33.0.6
h1:F//bA3/pgSTVq2hLNahhnof9NxyCzFF/c3MB6lb93Qo=
-github.com/libgit2/git2go/v33 v33.0.6/go.mod
h1:KdpqkU+6+++4oHna/MIOgx4GCQ92IPCdpVRMRI80J+4=
+github.com/libgit2/git2go/v34 v34.0.0
h1:UKoUaKLmiCRbOCD3PtUi2hD6hESSXzME/9OUZrGcgu8=
+github.com/libgit2/git2go/v34 v34.0.0/go.mod
h1:blVco2jDAw6YTXkErMMqzHLcAjKkwF0aWIRHBqiJkZ0=
github.com/magiconair/properties v1.8.5
h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaWak/Gls=
github.com/magiconair/properties v1.8.5/go.mod
h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod
h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -414,6 +423,7 @@ github.com/modern-go/reflect2 v1.0.2
h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod
h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod
h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI=
+github.com/onsi/gomega v1.27.10/go.mod
h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M=
github.com/panjf2000/ants/v2 v2.4.6
h1:drmj9mcygn2gawZ155dRbo+NfXEfAssjZNU1qoIb4gQ=
github.com/panjf2000/ants/v2 v2.4.6/go.mod
h1:f6F0NZVFsGCp5A7QW/Zj/m92atWwOkY0OIhFxRNFr4A=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod
h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
@@ -422,6 +432,7 @@ github.com/pelletier/go-toml v1.9.3/go.mod
h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCko
github.com/pelletier/go-toml/v2 v2.0.8
h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
github.com/pelletier/go-toml/v2 v2.0.8/go.mod
h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4=
github.com/pingcap/errors v0.11.4
h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
+github.com/pingcap/errors v0.11.4/go.mod
h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pjbgf/sha1cd v0.3.0/go.mod
h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod
h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
@@ -751,6 +762,7 @@ golang.org/x/term v0.2.0/go.mod
h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU=
+golang.org/x/term v0.23.0/go.mod
h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod
h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod
h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -945,6 +957,7 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod
h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod
h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod
h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
+gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod
h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod
h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
diff --git a/backend/plugins/gitextractor/README.md
b/backend/plugins/gitextractor/README.md
index f14178fcc..9d7067782 100644
--- a/backend/plugins/gitextractor/README.md
+++ b/backend/plugins/gitextractor/README.md
@@ -17,7 +17,7 @@ limitations under the License.
Please see details in the [Apache DevLake
website](https://devlake.apache.org/docs/Plugins/gitextractor)
-Build with local compiled v1.3.2 libgit2
+Build with local compiled v1.5.0 libgit2
```
CGO_LDFLAGS="-L/usr/local/lib -lgit2" CGO_CFLAGS="-I/usr/local/include" go
build ./plugins/gitextractor/... 2>&1 | tail -5
```
\ No newline at end of file
diff --git a/backend/plugins/gitextractor/models/diffline.go
b/backend/plugins/gitextractor/models/diffline.go
index fcc287fe5..5375df294 100644
--- a/backend/plugins/gitextractor/models/diffline.go
+++ b/backend/plugins/gitextractor/models/diffline.go
@@ -17,7 +17,7 @@ limitations under the License.
package models
-import git "github.com/libgit2/git2go/v33"
+import git "github.com/libgit2/git2go/v34"
type DiffLines []git.DiffLine
diff --git a/backend/plugins/gitextractor/parser/repo_libgit2.go
b/backend/plugins/gitextractor/parser/repo_libgit2.go
index 69d82e253..f01890672 100644
--- a/backend/plugins/gitextractor/parser/repo_libgit2.go
+++ b/backend/plugins/gitextractor/parser/repo_libgit2.go
@@ -35,7 +35,7 @@ import (
"github.com/apache/incubator-devlake/core/plugin"
"github.com/apache/incubator-devlake/plugins/gitextractor/models"
- git "github.com/libgit2/git2go/v33"
+ git "github.com/libgit2/git2go/v34"
)
var _ RepoCollector = (*Libgit2RepoCollector)(nil)
diff --git a/backend/scripts/install-libgit2.sh
b/backend/scripts/install-libgit2.sh
new file mode 100755
index 000000000..fa895c004
--- /dev/null
+++ b/backend/scripts/install-libgit2.sh
@@ -0,0 +1,90 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -eu
+
+LIBGIT2_VERSION=1.5.0
+LIBGIT2_SHA256=8de872a0f201b33d9522b817c92e14edb4efad18dae95cf156cf240b2efff93e
+LIBGIT2_URL=https://github.com/libgit2/libgit2/archive/refs/tags/v${LIBGIT2_VERSION}.tar.gz
+
+current_version=$(pkg-config --modversion libgit2 2>/dev/null || true)
+case "$current_version" in
+ 1.5.*)
+ echo "libgit2 $current_version is already installed"
+ exit 0
+ ;;
+esac
+
+if [ "$(id -u)" -ne 0 ]; then
+ echo "install-libgit2.sh must run as root" >&2
+ exit 1
+fi
+
+build_dir=$(mktemp -d)
+trap 'rm -rf "$build_dir"' EXIT HUP INT TERM
+
+export DEBIAN_FRONTEND=noninteractive
+apt-get update
+apt-get install -y --no-install-recommends \
+ ca-certificates \
+ cmake \
+ curl \
+ gcc \
+ libssh2-1-dev \
+ libssl-dev \
+ make \
+ pkg-config \
+ zlib1g-dev
+
+archive="$build_dir/libgit2.tar.gz"
+curl --fail --location --retry 3 "$LIBGIT2_URL" --output "$archive"
+echo "$LIBGIT2_SHA256 $archive" | sha256sum --check --strict
+
+mkdir "$build_dir/source"
+tar -xzf "$archive" -C "$build_dir/source" --strip-components=1
+
+multiarch=$(gcc -print-multiarch)
+libdir=lib
+if [ -n "$multiarch" ]; then
+ libdir="lib/$multiarch"
+fi
+
+cmake \
+ -S "$build_dir/source" \
+ -B "$build_dir/build" \
+ -DBUILD_SHARED_LIBS=ON \
+ -DBUILD_TESTS=OFF \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_LIBDIR="$libdir" \
+ -DCMAKE_INSTALL_PREFIX=/usr
+cmake --build "$build_dir/build" --parallel "$(getconf _NPROCESSORS_ONLN)"
+cmake --install "$build_dir/build"
+ldconfig
+
+export
PKG_CONFIG_PATH="/usr/$libdir/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
+installed_version=$(pkg-config --modversion libgit2)
+if [ "$installed_version" != "$LIBGIT2_VERSION" ]; then
+ echo "expected libgit2 $LIBGIT2_VERSION, found $installed_version" >&2
+ exit 1
+fi
+
+if [ -n "${GITHUB_ENV:-}" ]; then
+ echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> "$GITHUB_ENV"
+fi
+
+rm -rf /var/lib/apt/lists/*
+echo "installed libgit2 $installed_version"
diff --git a/devops/docker/lake-builder/Dockerfile
b/devops/docker/lake-builder/Dockerfile
index be6e31f3d..8675a4cb7 100644
--- a/devops/docker/lake-builder/Dockerfile
+++ b/devops/docker/lake-builder/Dockerfile
@@ -14,15 +14,17 @@
# limitations under the License.
#
-FROM --platform=linux/amd64 debian:bullseye as debian-amd64
+FROM --platform=linux/amd64 debian:bullseye AS debian-amd64
RUN apt-get -y update && apt -y upgrade &&\
apt-get install -y libssh2-1-dev libssl-dev zlib1g-dev
-FROM golang:1.26-bullseye as builder
+# This stage only cross-builds libgit2, it does not need a Go toolchain (and
+# `golang:<version>-bullseye` no longer exists for current Go releases).
+FROM --platform=linux/amd64 debian:bullseye AS builder
# Base dependencies
RUN apt-get -y update && apt -y upgrade &&\
- apt-get install -y gcc binutils libfindbin-libs-perl cmake libssh2-1-dev
libssl-dev zlib1g-dev \
+ apt-get install -y ca-certificates wget gcc binutils libfindbin-libs-perl
cmake libssh2-1-dev libssl-dev zlib1g-dev \
gcc-x86-64-linux-gnu binutils-x86-64-linux-gnu
COPY --from=debian-amd64 /usr/include /rootfs-amd64/usr/include
@@ -32,10 +34,10 @@ COPY --from=debian-amd64 /lib/x86_64-linux-gnu
/rootfs-amd64/lib/x86_64-linux-gn
## Build libs/headers needed for gitextractor plugin
RUN \
mkdir -p /tmp/build/x86_64 && cd /tmp/build/x86_64 && \
- wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.3.2.tar.gz -O
- | tar -xz && \
- cd libgit2-1.3.2 && \
+ wget https://github.com/libgit2/libgit2/archive/refs/tags/v1.5.0.tar.gz -O
- | tar -xz && \
+ cd libgit2-1.5.0 && \
mkdir build && cd build && \
- cmake .. -DCMAKE_C_COMPILER=x86_64-linux-gnu-gcc -DBUILD_SHARED_LIBS=ON
-DCMAKE_SYSROOT=/rootfs-amd64 -DCMAKE_INSTALL_PREFIX=/usr/local/deps/x86_64 &&\
+ cmake .. -DCMAKE_C_COMPILER=x86_64-linux-gnu-gcc -DBUILD_SHARED_LIBS=ON
-DBUILD_TESTS=OFF -DCMAKE_SYSROOT=/rootfs-amd64
-DCMAKE_INSTALL_PREFIX=/usr/local/deps/x86_64 &&\
make -j install &&\
mkdir -p /tmp/deps &&\
cp *libgit2* /tmp/deps/ &&\