Skip to content

Commit

Permalink
Merge pull request #1833 from buildpacks-community/remove-lifecycle-w…
Browse files Browse the repository at this point in the history
…indows

Do not attempt to download lifecycle binary for Windows
  • Loading branch information
tomkennedy513 authored Feb 26, 2025
2 parents d16eaf7 + a4274c2 commit f5c8a87
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions hack/lifecycle/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"net/http"
"os"
"path"
"reflect"
"regexp"
"time"

Expand Down Expand Up @@ -61,7 +60,7 @@ func main() {

}

func lifecycleImage(linuxUrl, windowsUrl string) (v1.Image, error) {
func lifecycleImage(linuxUrl, _ string) (v1.Image, error) {
image, err := random.Image(0, 0)
if err != nil {
return nil, err
Expand All @@ -71,13 +70,6 @@ func lifecycleImage(linuxUrl, windowsUrl string) (v1.Image, error) {
if err != nil {
return nil, err
}
windowsDescriptor, err := lifecycleDescriptor(windowsUrl)
if err != nil {
return nil, err
}
if !reflect.DeepEqual(linuxDescriptor, windowsDescriptor) {
return nil, errors.New("linux and windows lifecycle descriptors do not match. Check urls.")
}

linuxLayer, err := lifecycleLayer(linuxUrl, "linux")
if err != nil {
Expand All @@ -93,7 +85,7 @@ func lifecycleImage(linuxUrl, windowsUrl string) (v1.Image, error) {
return nil, err
}

windowsLayer, err := lifecycleLayer(windowsUrl, "windows")
windowsLayer, err := lifecycleLayer("", "windows")
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -169,11 +161,17 @@ func lifecycleLayer(url, os string) (v1.Layer, error) {

var regex = regexp.MustCompile(`^[^/]+/([^/]+)$`)

lr, err := lifecycleReader(url)
if err != nil {
return nil, err
var lr io.ReadCloser
if os == "windows" {
lr = io.NopCloser(bytes.NewReader([]byte{}))
} else {
lr, err = lifecycleReader(url)
if err != nil {
return nil, err
}
}
defer lr.Close()

tr := tar.NewReader(lr)
for {
header, err := tr.Next()
Expand Down

0 comments on commit f5c8a87

Please sign in to comment.