← Back to issue list

Go plugin environment validation fails if toolchain downloads a new version

View original Github issue

Metadata

Project
rockcraft
Number
#902
Type
issue
State
open
Author
hk21702
Labels
Created
2025-06-18 16:30:11+00:00
Updated
2025-06-18 16:30:11+00:00
Closed

Current evaluation

Go plugin validation fails when Go downloads a toolchain version differing from the bundled one. The issue remains open with zero comments and no labels, awaiting triage. Workarounds include setting GOTOOLCHAIN=local or running the build twice.

Suggested action: needs triage

Reason: This is a well-structured bug report with clear reproduction steps, but it has zero maintainer interaction, labels, or assignee after over a year. It requires initial assessment to verify current reproducibility, check against newer versions, and prioritize accordingly.

Staleness: 85 Complexity: 45 Confidence: 80 Support Request: 10

Issue body

### Bug Description The Go plugin's validation step will fail if the go toolchain downloads a version different from that of the bundled Go toolchain. This seems to be due to `rockcraft` being unable to correctly parse the output if go is in the middle of pulling a different toolchain version. The workaround I've found is to set `GOTOOLCHAIN: local` (though this does only work if your application will work with gotoolchain set as local) or to run `rockcraft pack` twice, as the correct toolchain will be local in the build environment on the second call. The latter workaround, while fine for development environments, is not all that viable for CI workflows. ### To Reproduce Start with a go project which targets a toolchain version that differs from what would be available locally. For example, in `go.mod`: ``` go 1.24.0 toolchain go1.24.4 ``` Then have a part using the `go` plugin while using a go dependency that doesn't match with the requested toolchain version. For example, the build-snap `go/1.24/stable` (At the time of writing, the snap is still at 1.24.2). ``` web-service: plugin: go source: . source-subdir: cmd/web-service build-snaps: - go/1.24/stable stage: - bin/web-service ``` Run ``` rockcraft clean rockcraft pack ``` ### Environment I'm running within a Multipass Ubuntu 24.04.02 instance rockcraft 1.12.0 This issue also occurs if using the `canonical/craft-actions/rockcraft-pack@main` workflow on an `ubuntu-24.04` GitHub runner. ### rockcraft.yaml ```yaml name: ubuntu-insights-services base: ubuntu@24.04 version: "0.17" # just for humans. Semantic versioning is recommended license: GPL-3.0 summary: Service for ubuntu-insights # 79 char long summary description: | Ubuntu Insights services used for accepting HTTP requests with insights reports from clients, validating them, and inserting them into a database. This service is part of the Ubuntu Insights project, a transparent, user-friendly, open, platform-agnostic, and cross-application solution for reporting hardware information and other collected metrics. # the platforms this rock should be built on and run on. # you can check your architecture with `dpkg --print-architecture` platforms: amd64: services: web-service: override: replace command: web-service startup: disabled ingest-service: override: replace command: ingest-service startup: disabled run-user: _daemon_ # setting a non-root user for the rock parts: web-service: plugin: go source: . source-subdir: cmd/web-service build-snaps: - go/1.24/stable stage: - bin/web-service ingest-service: plugin: go source: . source-subdir: cmd/ingest-service build-snaps: - go/1.24/stable stage: - bin/ingest-service migrations: plugin: dump source: . source-subdir: migrations organize: "*": usr/share/insights/migrations/ stage: - usr/share/insights/migrations/* golang-migrate: plugin: dump source: https://github.com/golang-migrate/migrate/releases/download/v4.18.3/migrate.linux-amd64.deb source-type: deb ``` ### Relevant log output ```shell ## Plugin environment export GOBIN="/root/parts/ingest-service/install/bin" ## User environment 2025-06-18 13:50:12.657 plugin validation command: 'go version' 2025-06-18 13:50:17.291 executed go version with output go: downloading go1.24.4 (linux/amd64) 2025-06-18 13:50:17.291 Environment validation failed for part 'ingest-service': invalid go compiler version 'go: downloading go1.24.4 (linux/amd64)'. 2025-06-18 13:50:17.294 Traceback (most recent call last): 2025-06-18 13:50:17.294 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/services/lifecycle.py", line 305, in run 2025-06-18 13:50:17.294 with self._lcm.action_executor() as aex: 2025-06-18 13:50:17.294 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 306, in __enter__ 2025-06-18 13:50:17.294 self._executor.prologue() 2025-06-18 13:50:17.294 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 91, in prologue 2025-06-18 13:50:17.294 self._verify_plugin_environment() 2025-06-18 13:50:17.294 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_parts/executor/executor.py", line 292, in _verify_plugin_environment 2025-06-18 13:50:17.294 validator.validate_environment(part_dependencies=part.dependencies) 2025-06-18 13:50:17.294 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_parts/plugins/go_plugin.py", line 72, in validate_environment 2025-06-18 13:50:17.295 raise errors.PluginEnvironmentValidationError( 2025-06-18 13:50:17.295 craft_parts.errors.PluginEnvironmentValidationError: Environment validation failed for part 'ingest-service': invalid go compiler version 'go: downloading go1.24.4 (linux/amd64)'. 2025-06-18 13:50:17.403 Emitter: Resuming control of the terminal 2025-06-18 13:50:17.403 Executing in container: lxc --project rockcraft exec local:rockcraft-ubuntu-insights-services-amd64-531901 -- env CRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /tmp/rockcraft.log 2025-06-18 13:50:17.517 Executing on host: lxc --project rockcraft file pull local:rockcraft-ubuntu-insights-services-amd64-531901/tmp/rockcraft.log /home/runner/tmpl4m831j0.tmp-craft/tmpr1sttxbx 2025-06-18 13:50:17.592 Logs retrieved from managed instance: 2025-06-18 13:50:17.593 Executing in container: lxc --project rockcraft exec local:rockcraft-ubuntu-insights-services-amd64-531901 -- env CRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /tmp/rockcraft-pack.yaml 2025-06-18 13:50:17.859 Could not find state file /tmp/rockcraft-pack.yaml in instance. 2025-06-18 13:50:17.859 Executing on host: lxc --project rockcraft config device show local:rockcraft-ubuntu-insights-services-amd64-531901 2025-06-18 13:50:17.928 Executing on host: lxc --project rockcraft config device remove local:rockcraft-ubuntu-insights-services-amd64-531901 disk-/root/project 2025-06-18 13:50:18.140 Executing on host: lxc --project rockcraft stop local:rockcraft-ubuntu-insights-services-amd64-531901 2025-06-18 13:50:22.016 Executing on host: lxc --project rockcraft list local: --format=yaml 2025-06-18 13:50:22.087 Executing on host: lxc --project rockcraft list local: --format=yaml 2025-06-18 13:50:22.162 Failed to run rockcraft in instance 2025-06-18 13:50:22.168 Traceback (most recent call last): 2025-06-18 13:50:22.168 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/services/provider.py", line 448, in run_managed 2025-06-18 13:50:22.168 instance.execute_run( # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType] 2025-06-18 13:50:22.168 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_providers/lxd/lxd_instance.py", line 254, in execute_run 2025-06-18 13:50:22.168 return self.lxc.exec( 2025-06-18 13:50:22.168 ^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_providers/lxd/lxc.py", line 390, in exec 2025-06-18 13:50:22.169 return runner(final_cmd, timeout=timeout, check=check, **kwargs) 2025-06-18 13:50:22.169 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/current/usr/lib/python3.12/subprocess.py", line 571, in run 2025-06-18 13:50:22.169 raise CalledProcessError(retcode, process.args, 2025-06-18 13:50:22.169 subprocess.CalledProcessError: Command '['lxc', '--project', 'rockcraft', 'exec', 'local:rockcraft-ubuntu-insights-services-amd64-531901', '--cwd', '/root/project', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'CRAFT_PLATFORM=amd64', 'CRAFT_VERBOSITY_LEVEL=TRACE', 'rockcraft', 'pack', '--verbosity', 'trace']' returned non-zero exit status 1. 2025-06-18 13:50:22.169 2025-06-18 13:50:22.169 The above exception was the direct cause of the following exception: 2025-06-18 13:50:22.169 Traceback (most recent call last): 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/application.py", line 615, in run 2025-06-18 13:50:22.169 return_code = self._run_inner() 2025-06-18 13:50:22.169 ^^^^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/application.py", line 594, in _run_inner 2025-06-18 13:50:22.169 return_code = dispatcher.run() or os.EX_OK 2025-06-18 13:50:22.169 ^^^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_cli/dispatcher.py", line 528, in run 2025-06-18 13:50:22.169 return self._loaded_command.run(self._parsed_command_args) 2025-06-18 13:50:22.169 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/commands/base.py", line 199, in run 2025-06-18 13:50:22.169 result = self._run(parsed_args, **kwargs) or result 2025-06-18 13:50:22.169 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 475, in _run 2025-06-18 13:50:22.169 return super()._run(parsed_args=parsed_args, step_name=step_name) 2025-06-18 13:50:22.169 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 181, in _run 2025-06-18 13:50:22.169 self._run_manager_for_build_plan(fetch_service_policy) 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/commands/lifecycle.py", line 90, in _run_manager_for_build_plan 2025-06-18 13:50:22.169 provider.run_managed(build, bool(fetch_service_policy)) 2025-06-18 13:50:22.169 File "/snap/rockcraft/3367/lib/python3.12/site-packages/craft_application/services/provider.py", line 455, in run_managed 2025-06-18 13:50:22.169 raise craft_providers.ProviderError( 2025-06-18 13:50:22.169 craft_providers.errors.ProviderError: Failed to run rockcraft in instance 2025-06-18 13:50:22.169 Full execution log: '/home/runner/.local/state/rockcraft/log/rockcraft-20250618-134850.295022.log' ```

Evaluation history

Date Model Scores Action Summary
2026-06-16 08:16:26.432976+00:00 qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 45
Confidence: 80
Support Request: 10
needs triage Go plugin validation fails when Go downloads a toolchain version differing from the bundled one. The issue remains open with zero comments and no labels, awaiting triage. Workarounds include setting GOTOOLCHAIN=local or running the build twice.
2026-06-16 08:14:07.773901+00:00 pending