You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The version-transform logic correctly mutates from the upstream version to the versions we want, but we then need to mutate back from the APK version to the upstream naming schema, to checkout the appropriate tag. Due to the absence of the -0 on the upstream versioning in the "first release" case, there isn't a single regex match/replace that can do the job. ^(\d+\.\d+\.\d+)$ -> $1-envoy handles the first version case, and ^(.+)-r(\d+)$ -> $1-envoy-$2 handles the subsequent versions case. This maps simply enough into melange configuration:
However, this configuration doesn't work: melange applies var-transforms in order, overwriting any previous values, meaning that this configuration will only handle the 1.1.0-r1 case. If the stanzas were reversed, the configuration would only handle the 1.0.0 case.
Ideally, it would be possible to specify that a transform should be applied if and only if its match regex actually matches the from input. If there was, e.g., a must-match: true option we could apply here, then only the actually applicable stanza's output would be used for mangled-package-version, solving the problem.
The text was updated successfully, but these errors were encountered:
(As it happens, I did manage to craft a single ugly regex which handles this case halfway through writing this issue (^([0-9]+.[0-9]+.[0-9]+)((-)r(\d+))?$ -> $1-envoy$3$4) but (a) this may not always be possible, and (b) this regex is inscrutable, the multi-stanza version is much more maintainable.)
OddBloke
added a commit
to wolfi-dev/os
that referenced
this issue
Feb 4, 2025
melange will always write to the `to` of `var-transforms`, even if the
`from` value did not `match` and so has not been mutated. This means
that the last `var-transform` with a given `to` will always determine
the value of that variable. In this case, that meant that our
`var-transforms` would only ever handle one of the two upstream
versioning cases.
This commit collapses the two stanzas into a single (ugly) regex which
should handle both cases, and I've filed
chainguard-dev/melange#1774 to request making
the multi-stanza version possible.
OddBloke
added a commit
to wolfi-dev/os
that referenced
this issue
Mar 6, 2025
This avoids tripping up a few tools which assume we'll only have a
single `-rN` suffix indicating the wolfi epoch.
This does mean that
chainguard-dev/melange#1774 now does affect
this package, but that's unavoidable for now.
opa-envoy
uses a versioning scheme of<upstream version>-envoy<local revision>
but<local revision>
is omitted for the first release. So, for example, the last two versions currently are1.1.0-envoy-1
and1.0.0-envoy
. These aren't valid APK versions (per https://github.com/wolfi-dev/wolfictl/blob/b168a068d4ea555968116a7577964310adf8ec33/pkg/versions/validate.go#L8-L23) so we need to mutate these to strings that are: respectively,1.1.0-r1
(that's not an epoch!) and1.0.0
.The
version-transform
logic correctly mutates from the upstream version to the versions we want, but we then need to mutate back from the APK version to the upstream naming schema, to checkout the appropriate tag. Due to the absence of the-0
on the upstream versioning in the "first release" case, there isn't a single regex match/replace that can do the job.^(\d+\.\d+\.\d+)$
->$1-envoy
handles the first version case, and^(.+)-r(\d+)$
->$1-envoy-$2
handles the subsequent versions case. This maps simply enough into melange configuration:However, this configuration doesn't work: melange applies
var-transforms
in order, overwriting any previous values, meaning that this configuration will only handle the1.1.0-r1
case. If the stanzas were reversed, the configuration would only handle the1.0.0
case.Ideally, it would be possible to specify that a transform should be applied if and only if its match regex actually matches the
from
input. If there was, e.g., amust-match: true
option we could apply here, then only the actually applicable stanza's output would be used formangled-package-version
, solving the problem.The text was updated successfully, but these errors were encountered: