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

T6961: package-build: Fix kea build race condition #865

Open
wants to merge 1 commit into
base: current
Choose a base branch
from

Conversation

MattKobayashi
Copy link
Contributor

@MattKobayashi MattKobayashi commented Dec 19, 2024

Change Summary

Fix a race condition in the kea package build process.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

https://vyos.dev/T6961

Component(s) name

package-build (kea)

Proposed changes

Because the package.toml file for the kea package doesn't specify a build command, it defaults to running dpkg-buildpackage -uc -us -tc -F against the cloned git repo. This is a problem because, by default, dpkg-buildpackage runs tasks in parallel (the limit is defined as auto, but seems to be based off the number of processors the system has), and there's a component being compiled in kea that other make tasks rely on, but ends up sometimes not being built in time for the dependent task to run successfully.

This PR adds a build command to kea's package.toml that specifies the additional argument -j 1 to the original dpkg-buildpackage command, which reverts dpkg-buildpackage's behaviour to serial execution of tasks.

How to test

(using the modified `package.toml`)
git clone https://github.com/vyos/vyos-build
cd vyos-build/scripts/package-build/kea
./build.py

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

Copy link

github-actions bot commented Dec 19, 2024

👍
No issues in PR Title / Commit Title

@sever-sever
Copy link
Member

The logic is

  1. it tries to check if build_cmd exists; if not command, it tries to build source + binary
  2. If sources fail, it tries to build binaries only

https://github.com/vyos/vyos-build/blob/c1f9fc6a6d387648e91a74a72b3488c42a6b897a/scripts/package-build/build.py#L117C1-L126C65

The similar logic as for Jenkins

sh 'dpkg-buildpackage -uc -us -tc -F'
} catch (e) {
print "Source packages build failed, ignoring - building binaries only"
currentBuild.result = 'SUCCESS'
sh 'dpkg-buildpackage -uc -us -tc -b'

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

Successfully merging this pull request may close these issues.

2 participants