Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

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

Closed
ssisil opened this issue Oct 4, 2018 · 11 comments
Closed

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

ssisil opened this issue Oct 4, 2018 · 11 comments
Assignees

Comments

@ssisil
Copy link

ssisil commented Oct 4, 2018

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 image-name:tag 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 image-name:tag 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>
@ssisil ssisil created this issue from a note in Planning Board (Backlog) Oct 4, 2018
@dgodd dgodd moved this from Backlog to In Progress in Planning Board Oct 4, 2018
@dgodd dgodd self-assigned this Oct 4, 2018
@dgodd
Copy link

dgodd commented Oct 4, 2018

@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
Copy link
Member

sclevine commented Oct 4, 2018

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

@dgodd
Copy link

dgodd commented Oct 4, 2018

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
Copy link
Member

sclevine commented Oct 5, 2018

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
Copy link
Member

sclevine commented Oct 5, 2018

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

dgodd added a commit to buildpacks/pack that referenced this issue Oct 10, 2018
buildpacks/roadmap#2

Signed-off-by: Dave Goddard <dave@goddard.id.au>
dgodd added a commit to buildpacks/pack that referenced this issue Oct 11, 2018
buildpacks/roadmap#2

Signed-off-by: Jacques Chester <jchester@pivotal.io>
@dgodd dgodd moved this from In Progress to Done in Planning Board Oct 12, 2018
@ssisil
Copy link
Author

ssisil commented Oct 15, 2018

Nontice an issue in README

Should be rebase <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
Copy link
Author

ssisil commented Oct 15, 2018

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

@ssisil ssisil moved this from Done to In Progress in Planning Board Oct 15, 2018
dgodd added a commit to buildpacks/pack that referenced this issue Oct 15, 2018
@ekcasey
Copy link
Member

ekcasey commented Oct 15, 2018

@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
Copy link
Author

ssisil commented Oct 15, 2018

@ekcasey - <image-name> is fine

dgodd added a commit to buildpacks/pack that referenced this issue Oct 15, 2018
@dgodd
Copy link

dgodd commented Oct 16, 2018

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

ekcasey added a commit to buildpacks/pack that referenced this issue Oct 16, 2018
* use mutate.Config() to properly update config for remote image

[buildpacks/roadmap#2]
@ekcasey
Copy link
Member

ekcasey commented Oct 16, 2018

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants