buildpacks / roadmap

Issue tracker
https://buildpacks.io
Apache License 2.0
0 stars 0 forks source link

`pack rebase` - swaps out the base stack of a built image #2

Closed ssisil closed 5 years ago

ssisil commented 6 years ago

Scenario : rebase on local docker daemon GIVEN I have an app image in my local docker daemon that has an outdated run image WHEN I run pack rebase <image-name:tag> THEN an updated run image is pulled into the local docker daemon if it is not already available AND the is rebased to point to the new run image AND the following message will be displayed to the user

Successfully replaced <image-name:tag> with <new image sha>

Scenario : rebase on remote registry GIVEN I have an app image on a registry that has an outdated run image WHEN I run pack rebase <image-name:tag> --publish THEN the is rebased to point to the new run image on the registry AND the following message will be displayed to the user

Successfully replaced <image-name:tag> with <new image sha>
dgodd commented 6 years ago

@ekcasey @ssisil I see two ways to get the base image name

  1. Read "runImage/name" from io.buildpacks.lifecycle.metadata
  2. Read "io.buildpacks.stacks.bionic" and find base image from "~/.pack/config.toml"

Any theories as to which is better?

sclevine commented 6 years ago

Option (2), and we shouldn't store the run image name/location in the image metadata (just the SHA).

dgodd commented 6 years ago

I'm good with option 2.

Re: shouldn't store it there, we currently do, why shouldn't we?

Example

[app]
  name = ""
  sha = "sha256:549b64a47e507576f67e13625dde8c552d0d0aa43e0e4766d0040031cbd03ded"

[[buildpacks]]
  key = "io.buildpacks.samples.nodejs"
  name = ""
  [buildpacks.layers]
    [buildpacks.layers.node_modules]
      sha = "sha256:8bd7ab35f2499b861fd2228ee74eff14751a210c37c4047bb8caba44c51af1c7"
      [buildpacks.layers.node_modules.data]
        lock_checksum = "e0f260f3d5fe88a1c22ff465bc963448"
    [buildpacks.layers.nodejs]
      sha = "sha256:d18c9e593e034d2b5881385ca170e8cc30ffff32545296c018edbb60233b34a3"
      [buildpacks.layers.nodejs.data]
        version = "v10.11.0"

[config]
  sha = "sha256:e7e45900b0357bcfc1d71da71b6b50b92dc03c316230da483c65def1663424a5"

[runimage]
  name = "packs/run"
  sha = "sha256:2ace261ebe9f5936ea72b6290019cda476db6a0b3a4d5d64039c61b45e46091f"
sclevine commented 6 years ago

The name encodes the location of the run image that was last used to rebase or rebuild the image. That info doesn't seem useful, and could be confusing (because rebase and rebuild both ignore it). I don't have a super strong opinion about it though.

(Unrelated point: runimage should probably be run-image to match the convention we're using for TOML files.)

sclevine commented 6 years ago

If you pull run-image out into a label, use io.buildpacks.stack.digest

ssisil commented 5 years ago

Nontice an issue in README

Should berebase <image-name:tag>

ssisil:lifecycle ssisil$ pack-macos rebase -h
Usage:
  pack rebase <stack-name> [flags]

Flags:
  -h, --help      help for rebase
      --no-pull   don't pull images before use
      --publish   publish to registry
ssisil commented 5 years ago

Also running into issue when trying to rebase a remote image. Local flow works

ssisil:bin ssisil$ pack-macos rebase ssisil/acceptance --publish
2018/10/15 14:02:55 Reading image ssisil/acceptance
2018/10/15 14:02:56 Reading new base image ssisil/run:acceptance
2018/10/15 14:02:56 mounted blob: sha256:afde35469481d2bc446d649a7a3d099147bbf7696b66333e76a411686b617ea1
2018/10/15 14:02:56 mounted blob: sha256:9d866f8bde2a0d607a6d17edc0fbd5e00b58306efc2b0a57e0ba72f269e7c6be
2018/10/15 14:02:56 mounted blob: sha256:fa3f2f277e67c5cbbf1dac21dc27111a60d3cd2ef494d94aa1515d3319f2a245
2018/10/15 14:02:56 existing blob: sha256:6c3beb568c9fb198f112b25f3d3427182e05ee3d0d09a832007c50b878d02396
2018/10/15 14:02:56 existing blob: sha256:035ea52388475dcf68bfc447f9086a07d241c27e570522c4bf5c69e9ca82065f
2018/10/15 14:02:56 mounted blob: sha256:6d41fdcf5359d82d6eccb31cf14d3bd01f7872ed287ae11bd2c65ae6e87d2a99
2018/10/15 14:02:56 mounted blob: sha256:eacb7c62553cb803be68f890cbbda0e49b9b9338240dcc06981fdcb976ca4b85
2018/10/15 14:02:56 mounted blob: sha256:124c757242f88002a858c23fc79f8262f9587fa30fd92507e586ad074afb42b6
2018/10/15 14:02:56 mounted blob: sha256:b064e77a2079190c032695cb145e838c3456b76da25eb76081ce71d9cf4c77a8
2018/10/15 14:02:56 mounted blob: sha256:78f7b20a9c57ef2d001dd447f6dcd658cbfcc66a3677df35d91d159778d53b4c
2018/10/15 14:02:56 mounted blob: sha256:db29411803a2374b39965dc3630970adb9fb14ccedd5b7351c450cf7e1df3d6b
2018/10/15 14:02:56 mounted blob: sha256:398d32b153e84fe343f0c5b07d65e89b05551aae6cb8b3a03bb2b662976eb3b8
2018/10/15 14:02:56 mounted blob: sha256:8cde369ffda820e0792540227a466d2b9caee9a10705de51978dce52e914702f
Error: unknown blob sha256:833500533dd32bc0843c863aba96ed86e20f6c8f57140c984cfccc1eb69cbb12
ekcasey commented 5 years ago

@ssisil why <image-name:tag> instead of <image-name>. <image-name> would be consistent with the current pack build --help output

./pack build --help
Usage:
  pack build <image-name> [flags]
ssisil commented 5 years ago

@ekcasey - <image-name> is fine

dgodd commented 5 years ago

To summarise the current bug @ekcasey . Scott says that local rebase works , but remote rebase had error Error: unknown blob sha256:833500533dd32bc0843c863aba96ed86e20f6c8f57140c984cfccc1eb69cbb12

ekcasey commented 5 years ago

@ssisil Fixed. You can test it out with pack-329-*