`source-commit` never completes, fills up entire disk space
Metadata
Current evaluation
Fixed by merged PR #1378 (commit ae26318e), which makes source-commit pulls use a shallow direct fetch when possible, avoiding runaway disk usage.
Resolution: closed resolved
Reason: Merged PR #1378 resolved the issue in commit ae26318e by initializing the repository and directly fetching the requested commit with shallow history where supported, retaining a deep-fetch fallback.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
I'm not sure why rockcraft [exhausts all disk space](https://github.com/canonical/grafana-rock/actions/runs/18349585148) while trying to pull from git.
In my `rockcraft.yaml` I have two parts, `grafana` and `grafana-ui`, and the pull step for `grafana-ui` never completes, filling up all disk space.
From the logs, the command rockcraft uses is
```
Executing: /snap/rockcraft/3591/libexec/rockcraft/craft.git clone --recursive --depth 1 https://github.com/grafana/grafana.git
```
```yaml
parts:
grafana:
plugin: go
source: https://github.com/grafana/grafana.git
source-commit: 8469ec46776ea6ea5db3e67e970d6735733f78e9
source-depth: 1
grafana-ui:
after: [grafana]
plugin: nil
source-type: git
source: https://github.com/grafana/grafana.git
source-commit: 8469ec46776ea6ea5db3e67e970d6735733f78e9
# source-depth: 1 # with or without this line, I still run out of disk space
```
It pulled the first part (`grafana`) fine.
It is during the second pull (`grafana-ui`) that disk usage never stops to climb.
Project storage seems ok,
```
$ lxc --project=rockcraft storage list
+---------+--------+------------------------------------------------+-------------+---------+---------+
| NAME | DRIVER | SOURCE | DESCRIPTION | USED BY | STATE |
+---------+--------+------------------------------------------------+-------------+---------+---------+
| default | dir | /var/snap/lxd/common/lxd/storage-pools/default | | 12 | CREATED |
+---------+--------+------------------------------------------------+-------------+---------+---------+
$ lxc --project=rockcraft storage show default --resources
space:
used: 38780776448
total: 41953755136
inodes:
used: 646404
total: 2621440
```
Seems like it's an issue with `source-commit`, because when I change to
```diff
- source-commit: 8469ec46776ea6ea5db3e67e970d6735733f78e9
+ source-branch: "v9.5.x"
```
it pulls both parts in 5 sec just fine.
### To Reproduce
Try to `rockcraft pack` [this](https://github.com/canonical/grafana-rock/blob/234e39d1d7f0f7ceb1812922f9806fa596b8ad45/9.5.21/rockcraft.yaml) (cf. [source-branch](https://github.com/canonical/grafana-rock/commit/47ebe82948189810a8c053c41b7ad38e6451ac1d)).
### part yaml
```shell
name: grafana
summary: Grafana in a ROCK.
description: "The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more."
version: "9.5.21"
base: ubuntu@22.04
license: AGPL-3.0
services:
grafana:
command: /bin/grafana-server --config /etc/grafana/grafana-config.ini
override: replace
startup: enabled
platforms:
amd64:
parts:
grafana:
plugin: go
source: https://github.com/grafana/grafana.git
# source-tag: v9.5.21
# Version 9.5.21 was tagged on Jul 25, 2024:
# https://github.com/grafana/grafana/releases/tag/v9.5.21
# But a CVE fix was merged on Aug 14 2024:
# https://github.com/grafana/grafana/pull/91927
source-commit: 8469ec46776ea6ea5db3e67e970d6735733f78e9
source-depth: 1
build-snaps:
- go/1.21/stable
override-build: |
set -x
make build-go
find bin -type f -executable | while read f; do install -D -m 755 $f ${CRAFT_PART_INSTALL}/usr/$(echo $f | sed -e 's%linux-amd64/%%'); done
cp -rpv conf ${CRAFT_PART_INSTALL}/conf
mkdir -p ${CRAFT_PART_INSTALL}/etc/grafana
touch ${CRAFT_PART_INSTALL}/etc/grafana/grafana-config.ini
stage:
- bin/*
- usr/bin/grafana*
- conf/
- etc/grafana
grafana-ui:
after: [grafana]
plugin: nil
source-type: git
source: https://github.com/grafana/grafana.git
# source-tag: v9.5.21
# Version 9.5.21 was tagged on Jul 25, 2024:
# https://github.com/grafana/grafana/releases/tag/v9.5.21
# But a CVE fix was merged on Aug 14 2024:
# https://github.com/grafana/grafana/pull/91927
source-commit: 8469ec46776ea6ea5db3e67e970d6735733f78e9
build-snaps:
- node/18/stable
build-environment:
- NODE_OPTIONS: "--max-old-space-size=8192"
override-build: |
# We have to limit node's max memory usage otherwise we'll run
# into OOM issues even with a 10GB RAM VM.
npm install --location=global --prefix $CRAFT_PART_BUILD yarn
[[ -v http_proxy ]] && yarn config set httpProxy ${http_proxy}
[[ -v https_proxy ]] && yarn config set httpsProxy ${https_proxy}
yarn config
YARN_ENABLE_PROGRESS_BARS=false yarn install --immutable
echo "Building frontend"
make build-js
mkdir -p ${CRAFT_PART_INSTALL}/{public,tools}
cp -rpv public/* ${CRAFT_PART_INSTALL}/public/
stage:
- public/
- tools/
ca-certs:
plugin: nil
overlay-packages:
- ca-certificates
deb-security-manifest:
plugin: nil
after:
- grafana
- grafana-ui
- ca-certs
override-prime: |
set -x
mkdir -p $CRAFT_PRIME/usr/share/rocks/
(echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query --admindir=$CRAFT_PRIME/var/lib/dpkg/ -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > $CRAFT_PRIME/usr/share/rocks/dpkg.query
```
### Relevant log output
```shell
no space left on disk (or something along those lines)
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #1378 (commit ae26318e), which makes source-commit pulls use a shallow direct fetch when possible, avoiding runaway disk usage. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by canonical/craft-parts#1378, commit ae26318e, which uses shallow cloning for source-commit when possible. | |
| stealth/space-bunny-alpha | — | closed stale | Triaged as a Rockcraft git-source bug: its depth-limited initial clone was followed by an unbounded fetch of source-commit. The proposed fix was a single commit-targeted fetch from an initialized repository. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after identifying that source-commit caused unbounded disk usage via a two-step clone and fetch. Resolution involves switching to a single fetch with depth limits after initializing the repo. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after identifying source-commit caused unbounded disk usage from an unbounded fetch step. Resolved by replacing the two-step clone with a single depth-limited fetch after initializing a blank repo and setting the remote. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after root cause analysis identified a two-step clone and unbounded fetch exhausting disk space. Proposed fix uses git init, sets the origin remote, and executes a single depth-limited fetch to the target commit. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Root cause identified: source-commit triggers unbounded git fetches, exhausting disk space. Maintainer proposed a single fetch with depth limits. Issue closed pending fix implementation. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/craft-parts#1378
(confidence 100%)
Merged resolving PR; commit ae26318e added shallow fetching for source-commit.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1378 fix: shallow clone with source-commit if possible | craft-parts | merged | Merged PR #1378 as ae26318e: Git pulls now prefer a shallow fetch for source-commit when possible, with deep-fetch fallback, fixing #1360. |