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

Properly support build-snaps with differing versions for independent parts. #656

Open
aznashwan opened this issue Jul 29, 2024 · 0 comments

Comments

@aznashwan
Copy link
Contributor

What needs to get done

Make rockcraft automatically detect when parts need different versions of the same build-snaps and either snap refresh said snaps between the parts, or at the very least give the user a clear warning it's not going to work as expected.

Why it needs to get done

Having two separate parts needing differing versions of the same build-snaps during the build stage is very reasonable.

The canonical/trivy-adapter ROCK for example builds both trivy and a separate trivy-adapter-photon binary with different Go versions.

You can reproduce the issue using this sample file:

# cat rockcraft.yaml 
name: go-snap-parts-version-test
summary: Test image to showcase snap parts issue.
description: Test image to showcase snap parts issue.

version: v1.0.0
license: Apache-2.0

base: [email protected]
build-base: [email protected]
platforms:
  amd64:
  # arm64:

services:
  sleep:
    command: sleep inf
    override: replace
    startup: enabled

parts:

  go118:
    plugin: go
    build-snaps:
      - go/1.18/stable
    source: https://github.com/canonical/rockcraft
    source-type: git
    source-tag: 1.5.3
    source-depth: 1

    override-build: |
      go version

  go121:
    plugin: go
    build-snaps:
      - go/1.21/stable
    source: https://github.com/canonical/rockcraft
    source-type: git
    source-tag: 1.5.3
    source-depth: 1

    override-build: |
      go version

Running rockcraft pack yields the following:

$ rockcraft pack --verbose --debug
Starting rockcraft, version 1.5.3                                                                                                                                                
[...]
Building go118                                                                                                                                                                   
:: + go version                                                                                                                                                                  
:: go version go1.18.10 linux/amd64                                                                                                                                              
Building go121                                                                                                                                                                   
:: + go version                                                                                                                                                                  
:: go version go1.18.10 linux/amd64                                                                                                                                              
[...] 

The only current solution available is manually snap refresh-ing the packages in override-build, which is not ideal...

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

No branches or pull requests

1 participant