-
-
Notifications
You must be signed in to change notification settings - Fork 18
Fix container-related misconfigurations in release build tasks #201
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`DistTasks.yml` contains the tasks used to produce the release builds of the project for each of the host targets. The builds are produced in Docker containers. A regression was introduced in the `Linux_ARMv6` task at the time the project's Go version was bumped to 1.21.5. This task must use a specific version of Debian in the container, which is defined via the image tag. Previously, Debian 10 was used, and a tag of the Go 1.18.3 image was available for this Debian version. However, the maintainers of the image did not produce a Debian 10 variant of the Go 1.21.5 image, so the use of that tag caused the task to fail: ``` Unable to find image 'docker.elastic.co/beats-dev/golang-crossbuild:1.21.5-armel-debian10' locally docker: Error response from daemon: manifest for docker.elastic.co/beats-dev/golang-crossbuild:1.21.5-armel-debian10 not found: manifest unknown: manifest unknown. See 'docker run --help'. task: Failed to run task "dist:Linux_ARMv6": exit status 125 ``` A Debian 11 variant of the image is available, and this version of Debian is also suitable for release builds. So the solution is to update the image tag referenced in the task to the Debian 11 tag.
...lease build containers `DistTasks.yml` contains the tasks used to produce the release builds of the project for each of the host targets. The builds are produced in Docker containers. A regression was introduced in several of the tasks at the time the project's Go version was bumped to 1.21.5. As a security measure (see CVE-2022-24765), starting from 2.30.3 Git requires the repository folder to be owned by the operating system user's account. Due to it having been checked out outside the container, the repository does not meet this requirement inside the container. An older version of Git was installed in the Go 1.18.3 Docker image, so this was not a problem before the bump, but a newer version is used in the Go 1.21.5 containers, which causes some tasks to fail: ``` error obtaining VCS status: exit status 128 Use -buildvcs=false to disable VCS stamping. Error: failed building for linux/armv6: exit status 1 failed building for linux/armv6: exit status 1 task: Failed to run task "dist:Linux_ARMv6": exit status 1 ``` The solution is to configure Git to allow the use of the repository, despite the "dubious ownership" of its folder. This is done via the `safe.directory` Git configuration variable.
@per1234
per1234
added
topic: infrastructure
Related to project infrastructure
type: imperfection
Perceived defect in any part of project
labels
Nov 12, 2024
alessio-perugini
alessio-perugini
approved these changes
Nov 12, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Please check if the PR fulfills these requirements
before creating one)
Bug fix.
What is the current behavior?
DistTasks.yml
contains the tasks used to produce the release builds of the project for each of the host targets. The builds are produced in Docker containers.Some regressions were introduced in these task at the time the project's Go version was bumped to 1.21.5 (which includes bumping the versions of the images used by the tasks: 1ccd378 / #174).
Linux_ARMv6
task.These regressions would cause the failure of the "Release" workflow run when it is triggered by a new release of the project.
What is the new behavior?
Use Debian 11 in
Linux_ARMv6
release build taskThe
Linux_ARMv6
task must use a specific version of Debian in the container:arduino-language-server/DistTasks.yml
Lines 147 to 174 in 5444eb5
The Debian version is defined via the image tag. Previously, Debian 10 was used, and a tag of the Go 1.18.3 image was available for this Debian version. However, the maintainers of the image did not produce a Debian 10 variant of the Go 1.21.5 image, so the use of that tag caused the task to fail:
https://github.com/per1234/arduino-language-server/actions/runs/11772916519/job/32789011179#step:4:36
A Debian 11 variant of the image is available, and this version of Debian is also suitable for release builds. So the solution is to update the image tag referenced in the task to the Debian 11 tag.
Configure repository for compatibility with modern Git versions in release build containers
As a security measure (see CVE-2022-24765), starting from 2.30.3 Git requires the repository folder to be owned by the operating system user's account. Due to it having been checked out outside the container, the repository does not meet this requirement inside the container. An older version of Git was installed in the Go 1.18.3 Docker image, so this was not a problem before the bump, but a newer version is used in the Go 1.21.5 containers, which causes some tasks to fail (elastic/golang-crossbuild#232):
https://github.com/per1234/arduino-language-server/actions/runs/11772976565/job/32789161736#step:4:148
https://github.com/per1234/arduino-language-server/actions/runs/11773011125/job/32789254088#step:4:146
https://github.com/per1234/arduino-language-server/actions/runs/11773011125/job/32789254192#step:4:161
The solution is to configure Git to allow the use of the repository, despite the "dubious ownership" of its folder. This is done via the
safe.directory
Git configuration variable.This approach is already in use in Arduino CLI's release build tasks: arduino/arduino-cli@5a5ae94 / arduino/arduino-cli#2103
Other information
In order to facilitate the review of this pull request, I performed a demonstration release with the proposed changes in my fork:
https://github.com/per1234/arduino-language-server/actions/runs/11789922878
https://github.com/per1234/arduino-language-server/releases/tag/0.0.0-rc.12