Skip to content

Conversation

@imjasonh
Copy link
Member

This demonstrates a rust/cargo-build pipeline that shares come very common workflows we have for Rust builds in the codebase.

To make it easier to review and iterate, the pipeline is defined in Wolfi, but it should probably go in Melange itself like go/build etc. If this looks good we can move it to Melange, wait for a digest bump, and remove it from pipelines/.

Copy link
Member

@joshrwolf joshrwolf Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a rust expert, but should we split this into cargo/fetch and cargo/build (with --offline or --locked) as the default?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I would like to split it, so that we can fetch in a prepare phase, and build in a later phase. This allows us to make the build process more hermetic in the future.

- runs: |
cargo build --release -vv

if [ "${{inputs.subpackage}}" == "true" ]; then
Copy link
Contributor

@kaniini kaniini Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should have a pipeline node which defines a value. Something like:

pipeline:
  - set:
      target: ${{targets.destdir}}
  - if: ${{inputs.subpackage}} == 'true'
    set:
      target: ${{targets.subpkgdir}}
  - runs: |
       mkdir -p ${{vars.target}}
       mv target/release/${{inputs.target}} ${{vars.target}}

But I also wonder if it would be helpful to have a context-specific ${{targets.foo}} which evaluates to the correct location based on package vs. subpackage. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and implemented this in chainguard-dev/melange#622.

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.

3 participants