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

Pin the package version used during tests #1518

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

lyoung-confluent
Copy link
Contributor

Melange allows users to define "test" pipelines which are executed via melange test (or wolfictl test), ex:

package:
  name: apko
  version: 0.19.2
  epoch: 0

test:
  pipeline:
    - runs: |
        apko version || exit 1

Melange will automatically add the package that is being tested (in this case apko) to the package constraints/world where the test environment is run as it's assumed that you're trying to test the package that was just built, ex:

2024/09/23 16:29:04 INFO image configuration:
2024/09/23 16:29:04 INFO   contents:
2024/09/23 16:29:04 INFO     build repositories: []
2024/09/23 16:29:04 INFO     runtime repositories: []
2024/09/23 16:29:04 INFO     keyring:      []
2024/09/23 16:29:04 INFO     packages:     [apko]

However, there is no version of this package specified which means if you were to execute the tests on an older commit, or incorrectly publish a newer version of the package and then revert without withdrawing, the test will use the latest version instead of the version from the config (package.version and package.epoch)

This PR adds a version constraint to ensure that melange test always runs against the version that was built using the matching YAML configuration, ex:

2024/09/23 16:30:09 INFO image configuration:
2024/09/23 16:30:09 INFO   contents:
2024/09/23 16:30:09 INFO     build repositories: []
2024/09/23 16:30:09 INFO     runtime repositories: []
2024/09/23 16:30:09 INFO     keyring:      []
2024/09/23 16:30:09 INFO     packages:     [apko=0.19.2-r0]

@jonjohnsonjr
Copy link
Contributor

Thanks! To fix the broken test, we need to add the package version and epoch ~here:

Configuration: config.Configuration{

@lyoung-confluent
Copy link
Contributor Author

@jonjohnsonjr Sorry for the delay, I've fixed the failing test

@imjasonh imjasonh merged commit 3d4bb7e into chainguard-dev:main Oct 18, 2024
34 of 35 checks passed
smoser added a commit to smoser/melange that referenced this pull request Oct 21, 2024
commit 57e3f4c (via chainguard-dev#1518)
broke test of wolfi python packages where they relied on the test of the
'main' package to install a subpackage that `provides` the main package.

For an example, see:
https://github.com/wolfi-dev/os/blob/cd5e90dc01bc7d5/py3-fastbencode.yaml

The main package is provider-priority 0 and the subpackages
have specific provider-priorities > 0.

With the pkg=version change, we got the main package installed, which
is empty.  Using ~ gets the desired behavior even for historic
packages.
smoser added a commit to smoser/melange that referenced this pull request Oct 21, 2024
commit 57e3f4c (via chainguard-dev#1518)
broke test of wolfi python packages where they relied on the test of the
'main' package to install a subpackage that `provides` the main package.

For an example, see:
https://github.com/wolfi-dev/os/blob/cd5e90dc01bc7d5/py3-fastbencode.yaml

The main package is provider-priority 0 and the subpackages
have specific provider-priorities > 0.

With the pkg=version change, we got the main package installed, which
is empty.  Using ~ gets the desired behavior even for historic
packages.
smoser added a commit to smoser/melange that referenced this pull request Oct 21, 2024
…1579 and chainguard-dev#1518)

1518 was added with good reason, but it changed behavior
that many wolfi tests depended on (see chainguard-dev#1579) for that use case.

Revert both of those changes, restoring behavior to the way it was
last week and thus restoring functional test of may wolfi packages.

Signed-off-by: Scott Moser <smoser@brickies.net>
smoser added a commit to smoser/melange that referenced this pull request Oct 21, 2024
…1579 and chainguard-dev#1518)

PR chainguard-dev#1518 was added with good reason, but it changed behavior
that many wolfi tests depended on (see chainguard-dev#1579) for that use case.

Revert both of those changes, restoring behavior to the way it was
last week and thus restoring functional test of may wolfi packages.

Signed-off-by: Scott Moser <smoser@brickies.net>
xnox added a commit that referenced this pull request Oct 21, 2024
Do not specify versions during 'melange test' (Revert #1579 and #1518)
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.

4 participants