docker / app

Make your Docker Compose applications reusable, and share them on Docker Hub
Apache License 2.0
1.57k stars 176 forks source link

Relocation the right way #765

Closed eunomie closed 4 years ago

eunomie commented 4 years ago

- What I did

Copy the relocation map in a dedicated file and apply it at runtime in the invocation image instead of modifying the service definition in the Installation object.

See https://github.com/cnabio/cnab-spec/blob/master/103-bundle-runtime.md#image-relocation

- How I did it

The relocation map is now stored under /cnab/app/relocation-mapping.json when we run commands. Then the cnab-run binary will read it, apply it on top of the service image definition.

Note: the /cnab/app/image-map.json is not read anymore, all data already exist in /cnab/bundle.json

- How to verify it

Without this version

When you run a pulled App, read the installation file (under ~/.docker/app/installation/.../appname.json). The image definition should contains relocated images (everything like registry/repo:tag@sha256...)

With this version

When you run a pulled App (must be build using this version to have the right cnab-run binary) and look at the installation file, the service images must not be the relocated ones but the one in the bundle.json. But if you inspect the App Image, you should see the relocated images.

- Description for the changelog

codecov[bot] commented 4 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@e890e66). Click here to learn what that means. The diff coverage is 58.33%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #765   +/-   ##
=========================================
  Coverage          ?   69.68%           
=========================================
  Files             ?       64           
  Lines             ?     3612           
  Branches          ?        0           
=========================================
  Hits              ?     2517           
  Misses            ?      766           
  Partials          ?      329
Impacted Files Coverage Δ
internal/store/installation.go 78.12% <ø> (ø)
internal/commands/image/inspect.go 65.3% <0%> (ø)
internal/commands/image/render.go 69.49% <0%> (ø)
internal/commands/inspect.go 21.66% <0%> (ø)
internal/commands/remove.go 52.94% <0%> (ø)
internal/commands/run.go 63.73% <100%> (ø)
internal/commands/update.go 58.92% <100%> (ø)
internal/relocated/bundle.go 54.54% <36.36%> (ø)
internal/cnab/driver.go 77.5% <78.94%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e890e66...39c87cb. Read the comment docs.