StefanScherer / rebase-docker-image

Rebase a dockerized Windows app to a newer Windows Docker base image.
https://stefanscherer.github.io/poc-build-images-for-1709-without-1709/
MIT License
10 stars 2 forks source link

Rebase 0.4.1 MANIFEST_UNKNOWN #9

Closed stevensbkang closed 5 years ago

stevensbkang commented 5 years ago

Hi @StefanScherer, hope things are well with you :)

As of this morning, our Portainer CI Windows image build started failing, and reliased that new version of rebase was released. Would you be able to take a quick look at it please?

Please let me know if you need more details.

Thanks a lot!

pr2909-windows-amd64: digest: sha256:300a2012e81cbcfb49c32b433dc0bf06dd1c8f08b8579bb61c5ec54893b2968d size: 1983
Retrieving information about source image portainerci/portainer:pr2909-windows-amd64
Retrieving information about source base image registry-1.docker.io/microsoft/nanoserver:1709
Error: Error: MANIFEST_UNKNOWN
    at Request.request [as _callback] (C:\npm\prefix\node_modules\rebase-docker-image\index.js:407:25)
    at Request.self.callback (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:185:22)
    at Request.emit (events.js:193:13)
    at Request.<anonymous> (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:193:13)
    at IncomingMessage.<anonymous> (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:281:20)
    at IncomingMessage.emit (events.js:198:15)
    at endReadableNT (_stream_readable.js:1139:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
Retrieving information about source image portainerci/portainer:pr2909-windows-amd64
Retrieving information about source base image registry-1.docker.io/microsoft/nanoserver:1803
Error: Error: MANIFEST_UNKNOWN
    at Request.request [as _callback] (C:\npm\prefix\node_modules\rebase-docker-image\index.js:407:25)
    at Request.self.callback (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:185:22)
    at Request.emit (events.js:193:13)
    at Request.<anonymous> (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:1161:10)
    at Request.emit (events.js:193:13)
    at IncomingMessage.<anonymous> (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:1083:12)
    at Object.onceWrapper (events.js:281:20)
    at IncomingMessage.emit (events.js:198:15)
    at endReadableNT (_stream_readable.js:1139:12)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
Retrieving information about source image portainerci/portainer:pr2909-windows-amd64
Retrieving information about source base image mcr.microsoft.com/windows/nanoserver:1809_amd64
Retrieving information about target base image undefined/windows/nanoserver:1809_amd64
Rebasing image
Error: Error: Base layer digest mismatch.
    at rebaseBaseImages (C:\npm\prefix\node_modules\rebase-docker-image\index.js:524:21)
    at C:\npm\prefix\node_modules\rebase-docker-image\node_modules\async\dist\async.js:3880:24
    at replenish (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\async\dist\async.js:1011:17)
    at iterateeCallback (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\async\dist\async.js:995:17)
    at C:\npm\prefix\node_modules\rebase-docker-image\node_modules\async\dist\async.js:969:16
    at C:\npm\prefix\node_modules\rebase-docker-image\node_modules\async\dist\async.js:3885:13
    at Request.request [as _callback] (C:\npm\prefix\node_modules\rebase-docker-image\index.js:477:7)
    at Request.self.callback (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:185:22)
    at Request.emit (events.js:193:13)
    at Request.<anonymous> (C:\npm\prefix\node_modules\rebase-docker-image\node_modules\request\request.js:1161:10)
Retrieving information about source image portainerci/portainer:pr2909-windows-amd64
Retrieving information about source base image mcr.microsoft.com/windows/nanoserver:1903
Error: Error: MANIFEST_UNKNOWN
StefanScherer commented 5 years ago

Sorry to hear that. Well, test coverage is zero 😢 So, thanks for the feedback. Can you share the command line that caused this problem so I can dig into it?

As a workaround, pin the version and install it like this

npm install -g rebase-docker-image@0.4.0
stevensbkang commented 5 years ago

Feel free to ping me when a new version is released, more than happy to test it out!

This is our .ps1 script that we use for our CI process:

Set-Location -Path "$($env:BUILD_SOURCESDIRECTORY)"

Set-Item -Path env:DOCKER_USER -Value (Get-ChildItem env:SECRET_CONTAINER_USERNAME).Value
Set-Item -Path env:DOCKER_PASS -Value (Get-ChildItem env:SECRET_CONTAINER_PASSWORD).Value

npm install -g rebase-docker-image

if ($ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER) {
  $container_image_tag = "pr$($ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)-windows-amd64"
  $container_image_tag_1709 = "pr$($ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)-windows1709-amd64"
  $container_image_tag_1803 = "pr$($ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)-windows1803-amd64"
  $container_image_tag_1809 = "pr$($ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)-windows1809-amd64"
  $container_image_tag_1903 = "pr$($ENV:SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)-windows1903-amd64"
} else {
  $container_image_tag = "$($ENV:BUILD_SOURCEBRANCHNAME)-windows-amd64"
  $container_image_tag_1709 = "$($ENV:BUILD_SOURCEBRANCHNAME)-windows1709-amd64"
  $container_image_tag_1803 = "$($ENV:BUILD_SOURCEBRANCHNAME)-windows1803-amd64"
  $container_image_tag_1809 = "$($ENV:BUILD_SOURCEBRANCHNAME)-windows1809-amd64"
  $container_image_tag_1903 = "$($ENV:BUILD_SOURCEBRANCHNAME)-windows1903-amd64"
}

docker build -t "portainerci/portainer:$($container_image_tag)" -f "$($env:BUILD_SOURCESDIRECTORY)\build\windows2016\nanoserver\Dockerfile" .
docker push "portainerci/portainer:$($container_image_tag)"

rebase-docker-image "portainerci/portainer:$($container_image_tag)" -t "portainerci/portainer:$($container_image_tag_1709)" -b microsoft/nanoserver:1709
rebase-docker-image "portainerci/portainer:$($container_image_tag)" -t "portainerci/portainer:$($container_image_tag_1803)" -b microsoft/nanoserver:1803
rebase-docker-image "portainerci/portainer:$($container_image_tag)" -t "portainerci/portainer:$($container_image_tag_1809)" -b mcr.microsoft.com/windows/nanoserver:1809
rebase-docker-image "portainerci/portainer:$($container_image_tag)" -t "portainerci/portainer:$($container_image_tag_1903)" -b mcr.microsoft.com/windows/nanoserver:1903

As a workaround, I just forced rebase version to be 0.4.0 :)

StefanScherer commented 5 years ago

Hi @ssbkang It's fixed in 0.4.2, but I can recommend to use the -s parameter and specify the base image that you use in the build\windows2016\nanoserver\Dockerfile. Without -s the tool guesses the base image and uses just the os.version (eg. 10.0.14393.2551) as tag name for the source base image.

BTW: You should be able to use mcr.microsoft.com/windows/nanoserver everywhere as all tags, even the old 2016 and 1709 are available on MCR.

Fixed with 0d57aa0615b53048613aa01c87013397a2eed6b5

deviantony commented 5 years ago

Thanks a lot for the fix @StefanScherer :-)

stevensbkang commented 5 years ago

@StefanScherer we've just finalised our CI and all fixed, including 1903 support - thanks a lot for your help!