forked from buildpacks/pack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack.go
30 lines (23 loc) · 838 Bytes
/
pack.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package pack
import (
"context"
"github.com/pkg/errors"
"github.com/buildpacks/pack/internal/buildpackage"
"github.com/buildpacks/pack/internal/dist"
"github.com/buildpacks/pack/internal/style"
)
var (
// Version is the version of `pack`. It is injected at compile time.
Version = "0.0.0"
)
func extractPackagedBuildpacks(ctx context.Context, pkgImageRef string, fetcher ImageFetcher, publish, noPull bool) (mainBP dist.Buildpack, depBPs []dist.Buildpack, err error) {
pkgImage, err := fetcher.Fetch(ctx, pkgImageRef, !publish, !noPull)
if err != nil {
return nil, nil, errors.Wrapf(err, "fetching image")
}
mainBP, depBPs, err = buildpackage.ExtractBuildpacks(pkgImage)
if err != nil {
return nil, nil, errors.Wrapf(err, "extracting buildpacks from %s", style.Symbol(pkgImageRef))
}
return mainBP, depBPs, nil
}