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

feat(gh-actions/build-debian): Support running a workflow script at build-source phase #54

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

3v1n0
Copy link
Contributor

@3v1n0 3v1n0 commented Dec 14, 2024

When building some packages we may need to prepare the build environment before preparing the source package, for example in some cases we may need to enable git access (to compute the package version or similar) or we may need to install tools that are used during debian source building that are not provided in the archive (such as rust crates, hello cargo-vendor-filterer!!).

So instead of polluting this generic action with package-specific requirements, let's just make it support running a script that can do more advanced configurations in the docker instance that is used only during the source-preparation phase.

Not covering the migration yet (since I'd like to provide some more tools for it), but I think that we should drop the specific-git code from this action too, and move it where it's relevant (in the ubuntu-pro-for-wsl repo as action input script instead).

This is required in order to be able to do a cargo install --root=/usr cargo-vendor-filterer to build the source package of rust programs as required by authd in ubuntu/authd#130

UDENG-2343

@3v1n0 3v1n0 requested a review from didrocks as a code owner December 14, 2024 12:05
@adombeck
Copy link
Contributor

Alternatively to specifying a new input, we could also always check if a script /usr/bin/pre-build-hook (or something like that) exists and execute it if it does.

@3v1n0 3v1n0 force-pushed the source-prepare-command branch from 59756ff to 9e60940 Compare December 17, 2024 17:57
@3v1n0
Copy link
Contributor Author

3v1n0 commented Dec 17, 2024

Alternatively to specifying a new input, we could also always check if a script /usr/bin/pre-build-hook (or something like that) exists and execute it if it does.

The problem of that is that it would imply saving something in a place (the docker instance) that the workflow has no access to, so that's something we can't do easily. Indeed we could allow the input to be a file instead that can be copied there though.

But I feel this syntax still allows to keep everything in the same place (the calling workflow file) easily. Indeed we could support injecting another file in future though.

@3v1n0 3v1n0 force-pushed the source-prepare-command branch from 62cee8a to d270ac2 Compare December 17, 2024 21:01
@adombeck
Copy link
Contributor

adombeck commented Dec 18, 2024

The problem of that is that it would imply saving something in a place (the docker instance) that the workflow has no access to, so that's something we can't do easily.

Ah, so you intend to provide the script via the git repo, not via the Docker image? Then we could also check ${{ github.workspace }}/bin/pre-build-hook or something.

But I feel this syntax still allows to keep everything in the same place (the calling workflow file) easily. Indeed we could support injecting another file in future though.

Works for me.

@3v1n0
Copy link
Contributor Author

3v1n0 commented Dec 18, 2024

Ah, so you intend to provide the script via the git repo, not via the Docker image? Then we could also check ${{ github.workspace }}/bin/pre-build-hook

yeah... Ideally such path should be provided, but with this way it's still possible to just launch it manually with one line, since the workspace is always already mounted... So I'd keep this way still.

If something more complex is needed, we can reiterate :)

…ource phase

When building some packages we may need to prepare the build environment
before preparing the source package, for examples in some cases we may
need to enable git access (to compute the package version or similar) or
we may need to install tools that are used during debian source building
that are not provided in the archive (such as rust crates, hello
cargo-vendor-filterer!!).

So instead of polluting this generic action with package-specific
requirements, let's just make it support running a script that can
do more advanced configurations in the docker instance that is used
only during the source-preparation phase.
…is defined

It's the only reason why we need it so far, so if a project really
requires it, it should add it to the extra source build dependencies
@3v1n0 3v1n0 force-pushed the source-prepare-command branch from d270ac2 to 2632841 Compare December 18, 2024 17:22
@3v1n0
Copy link
Contributor Author

3v1n0 commented Dec 18, 2024

This has been tested working in the only customer (so far) so let's merge it. :)

@3v1n0 3v1n0 merged commit d671aa3 into canonical:main Dec 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants