-
Notifications
You must be signed in to change notification settings - Fork 163
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
Updating package via bosh vendor-package --prefix
does not honor prefix on dependent packages
#606
Comments
i never tested this with a package that also had a dependency. |
when we introduced the prefixed vendored package behaviour we overlooked a case that could lead to inconstistent writes of the spec.lock for a prefixed package. The issue was described in #606 The underlying cause was the ordering of `allInterestingPkgs` https://github.com/cloudfoundry/bosh-cli/pull/603/files#diff-420d09437c4bf08b4407d39b5956c6209df3519cde36b121a856085e372d2c92R240-R241 As setup in the added test, we have 3 packages. The top level package `pkg-1` and the two dependencies it pulls in `pkg-2,pkg-3` The ordering of the map `allInterestingPkgs` is inconsistent and the test will fail for every case where pkg-1 isn't the last item in `allInterestingPkgs`. That is because we end up calling writeVendoredPackage on pkg-1, which in turn will iterate over the dependencies. At this point we didn't yet call .Prefix and .Finalize on the objects for `pkg-2` and `pkg-3`. Though this is required so they can return their prefixed name via Name(). This is addressed by duplicating the loop. The first pass will ensure all objects in the dependency tree are prefixed and finalized before the spec.lock is written to disk.
when we introduced the prefixed vendored package behaviour we overlooked a case that could lead to inconstistent writes of the spec.lock for a prefixed package. The issue was described in #606 The underlying cause was the ordering of `allInterestingPkgs` https://github.com/cloudfoundry/bosh-cli/pull/603/files#diff-420d09437c4bf08b4407d39b5956c6209df3519cde36b121a856085e372d2c92R240-R241 As setup in the added test, we have 3 packages. The top level package `pkg-1` and the two dependencies it pulls in `pkg-2,pkg-3` The ordering of the map `allInterestingPkgs` is inconsistent and the test will fail for every case where pkg-1 isn't the last item in `allInterestingPkgs`. That is because we end up calling writeVendoredPackage on pkg-1, which in turn will iterate over the dependencies. At this point we didn't yet call .Prefix and .Finalize on the objects for `pkg-2` and `pkg-3`. Though this is required so they can return their prefixed name via Name(). This is addressed by duplicating the loop. The first pass will ensure all objects in the dependency tree are prefixed and finalized before the spec.lock is written to disk.
Hey @jrussett, can you try v7.1.3 and see if it fixes the problem? |
Hey @jpalermo I just tested this in our CI after confirming our docker image had the new bosh cli. The cli was able to successfully vendor the package with a prefix without clobbering the dependencies! ✅ Thank you all! |
Summary
When you update a package via
bosh vendor-package --prefix
and the desired package has dependent packages, the dependent packages are not updated with a prefix.Note
On the first invocation of
bosh vendor-package
with--prefix
, the desired package and its dependent packages will all be vendored with a prefix. This error only occurs when re-vendoring the package to update it.Steps to Reproduce
For this specific example, we will use the
healthchecker
package, which requires thegolang-1-linux
package to compile the binary. Thehealthchecker
package is intended to be vendored into releases likesilk
,cf-networking
, andgarden-runc
.When vendoring another bosh package with a PREFIX that depends one of the
golang-*-linux
packages, thegolang-*-linux
will be vendored with prefix (e.g.PREFIX-golang-*-linux
).If I run the following
Then I end up with the following packages:
Where
silk-healthchecker/spec.lock
looks something like:Running
bosh vendor-package --prefix
again to update the packageNow, when I want to update the
healthchecker
package, I see that thesilk-golang-1-linux
dependency is renamed, removing the prefix entirely!Expected Results
When I'm updating the
healthchecker
package viabosh vendor-package --prefix
, only thefingerprints
indicating the updated package should change. The names of the dependencies should stay the same:Additional Text Output, Screenshots, contextual information (optional)
Adding
--prefix
tobosh vendor-package
: #603The text was updated successfully, but these errors were encountered: