Skip to content

Commit a2573b0

Browse files
authored
Merge branch 'main' into MAC-address
2 parents 3b1544c + 8ed450d commit a2573b0

38 files changed

+1179
-390
lines changed

.github/workflows/benchmark.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717
- name: Set up go
18-
uses: actions/setup-go@v4
18+
uses: actions/setup-go@v5
1919
with:
20-
go-version: "1.20"
20+
go-version: "1.21"
2121
- name: Set up go env
2222
run: |
2323
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV

.github/workflows/build.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ jobs:
7272
}
7373
shell: powershell
7474
- name: Set up go
75-
uses: actions/setup-go@v4
75+
uses: actions/setup-go@v5
7676
with:
77-
go-version: "1.20"
77+
go-version: "1.21"
7878
check-latest: true
7979
- name: Set up go env for Unix
8080
if: runner.os != 'Windows'
@@ -156,7 +156,7 @@ jobs:
156156
env:
157157
PACK_BUILD: ${{ github.run_number }}
158158
shell: powershell
159-
- uses: actions/upload-artifact@v3
159+
- uses: actions/upload-artifact@v4
160160
if: matrix.config != 'windows-lcow'
161161
with:
162162
name: pack-${{ matrix.os }}
@@ -181,17 +181,17 @@ jobs:
181181
steps:
182182
- uses: actions/checkout@v4
183183
- name: Set up go
184-
uses: actions/setup-go@v4
184+
uses: actions/setup-go@v5
185185
with:
186-
go-version: "1.20"
186+
go-version: "1.21"
187187
check-latest: true
188188
- name: Build
189189
run: |
190190
[[ $GITHUB_REF =~ ^refs\/heads\/release/(.*)$ ]] && version=${BASH_REMATCH[1]} || version=0.0.0
191191
env PACK_VERSION=${version} GOARCH=${{ matrix.goarch }} GOOS=${{ matrix.goos }} make build
192192
env:
193193
PACK_BUILD: ${{ github.run_number }}
194-
- uses: actions/upload-artifact@v3
194+
- uses: actions/upload-artifact@v4
195195
with:
196196
name: pack-${{ matrix.name }}
197197
path: out/${{ env.PACK_BIN }}
@@ -220,7 +220,7 @@ jobs:
220220
221221
echo "PACK_MILESTONE=${milestone}" >> $GITHUB_ENV
222222
- name: Download artifacts
223-
uses: actions/download-artifact@v3
223+
uses: actions/download-artifact@v4
224224
- name: Package artifacts - macos
225225
run: |
226226
chmod +x pack-macos/pack

.github/workflows/check-latest-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14-
- uses: actions/setup-go@v4
14+
- uses: actions/setup-go@v5
1515
with:
1616
go-version-file: 'go.mod'
1717
- name: Read go versions
@@ -25,7 +25,7 @@ jobs:
2525
2626
LATEST_GO_VERSION=$(go version | cut -d ' ' -f 3)
2727
28-
LATEST_RELEASE_VERSION=$(gh release list -L 1 | cut -d $'\t' -f 1 | cut -d ' ' -f 2)
28+
LATEST_RELEASE_VERSION=$(gh release list --exclude-drafts --exclude-pre-releases -L 1 | cut -d $'\t' -f 1 | cut -d ' ' -f 2)
2929
3030
wget https://github.com/$GITHUB_REPOSITORY/releases/download/$LATEST_RELEASE_VERSION/pack-$LATEST_RELEASE_VERSION-linux.tgz -O out.tgz
3131
tar xzf out.tgz

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434

3535
# Initializes the CodeQL tools for scanning.
3636
- name: Initialize CodeQL
37-
uses: github/codeql-action/init@v2
37+
uses: github/codeql-action/init@v3
3838
with:
3939
languages: ${{ matrix.language }}
4040
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -45,7 +45,7 @@ jobs:
4545
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4646
# If this step fails, then you should remove it and run the build manually (see below)
4747
- name: Autobuild
48-
uses: github/codeql-action/autobuild@v2
48+
uses: github/codeql-action/autobuild@v3
4949

5050
# ℹ️ Command-line programs to run using the OS shell.
5151
# 📚 https://git.io/JvXDl
@@ -59,4 +59,4 @@ jobs:
5959
# make release
6060

6161
- name: Perform CodeQL Analysis
62-
uses: github/codeql-action/analyze@v2
62+
uses: github/codeql-action/analyze@v3

.github/workflows/compatibility.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444
steps:
4545
- uses: actions/checkout@v4
4646
- name: Set up go
47-
uses: actions/setup-go@v4
47+
uses: actions/setup-go@v5
4848
with:
49-
go-version: "1.20"
49+
go-version: "1.21"
5050
check-latest: true
5151
- name: Set up go env
5252
run: |

.github/workflows/delivery-docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
password: ${{ secrets.DOCKER_PASSWORD }}
6161
- uses: docker/setup-qemu-action@v3
6262
- uses: docker/setup-buildx-action@v3
63-
- uses: buildpacks/github-actions/[email protected].1
63+
- uses: buildpacks/github-actions/[email protected].2
6464
- name: Buildx Build/Publish
6565
run: |
6666
docker buildx build . \

.github/workflows/delivery-release-dispatch.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
repo: ['buildpacks/docs', 'buildpacks/samples', 'buildpacks/pack-orb', 'buildpacks/github-actions']
1414
steps:
1515
- name: Repository Dispatch
16-
uses: peter-evans/repository-dispatch@v2
16+
uses: peter-evans/repository-dispatch@v3
1717
with:
1818
token: ${{ secrets.PLATFORM_GITHUB_TOKEN }}
1919
event-type: pack-release

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ install-golangci-lint:
164164

165165
## mod-tidy: Tidy Go modules
166166
mod-tidy:
167-
$(GOCMD) mod tidy -compat=1.20
168-
cd tools && $(GOCMD) mod tidy -compat=1.20
167+
$(GOCMD) mod tidy -compat=1.21
168+
cd tools && $(GOCMD) mod tidy -compat=1.21
169169

170170
## tidy: Tidy modules and format the code
171171
tidy: mod-tidy format

acceptance/acceptance_test.go

Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,6 +2929,56 @@ include = [ "*.jar", "media/mountain.jpg", "/media/person.png", ]
29292929
})
29302930
})
29312931
})
2932+
2933+
when("builder create", func() {
2934+
when("--flatten=<buildpacks>", func() {
2935+
it("should flatten together all specified buildpacks", func() {
2936+
h.SkipIf(t, !createBuilderPack.SupportsFeature(invoke.FlattenBuilderCreationV2), "pack version <= 0.33.0 fails with this test")
2937+
h.SkipIf(t, imageManager.HostOS() == "windows", "These tests are not yet compatible with Windows-based containers")
2938+
2939+
// create a task, handled by a 'task manager' which executes our pack commands during tests.
2940+
// looks like this is used to de-dup tasks
2941+
key := taskKey(
2942+
"create-complex-flattened-builder",
2943+
append(
2944+
[]string{runImageMirror, createBuilderPackConfig.Path(), lifecycle.Identifier()},
2945+
createBuilderPackConfig.FixturePaths()...,
2946+
)...,
2947+
)
2948+
2949+
builderName, err := suiteManager.RunTaskOnceString(key, func() (string, error) {
2950+
return createFlattenBuilder(t,
2951+
assert,
2952+
buildpackManager,
2953+
lifecycle,
2954+
createBuilderPack,
2955+
runImageMirror)
2956+
})
2957+
assert.Nil(err)
2958+
2959+
// register task to be run to 'clean up' a task
2960+
suiteManager.RegisterCleanUp("clean-"+key, func() error {
2961+
imageManager.CleanupImages(builderName)
2962+
return nil
2963+
})
2964+
2965+
assertImage.ExistsLocally(builderName)
2966+
2967+
// 3 layers for runtime OS
2968+
// 1 layer setting cnb, platform, layers folders
2969+
// 1 layer for lifecycle binaries
2970+
// 1 layer for order.toml
2971+
// 1 layer for run.toml
2972+
// 1 layer for stack.toml
2973+
// 1 layer status file changed
2974+
// Base Layers = 9
2975+
2976+
// 1 layer for 3 flattened builpacks
2977+
// 3 layers for single buildpacks not flattened
2978+
assertImage.HasLengthLayers(builderName, 13)
2979+
})
2980+
})
2981+
})
29322982
})
29332983
}
29342984

@@ -3315,6 +3365,157 @@ func createStackImage(dockerCli client.CommonAPIClient, repoName string, dir str
33153365
}))
33163366
}
33173367

3368+
func createFlattenBuilder(
3369+
t *testing.T,
3370+
assert h.AssertionManager,
3371+
buildpackManager buildpacks.BuildModuleManager,
3372+
lifecycle config.LifecycleAsset,
3373+
pack *invoke.PackInvoker,
3374+
runImageMirror string,
3375+
) (string, error) {
3376+
t.Helper()
3377+
t.Log("creating flattened builder image...")
3378+
3379+
// CREATE TEMP WORKING DIR
3380+
tmpDir, err := os.MkdirTemp("", "create-complex-test-flattened-builder")
3381+
if err != nil {
3382+
return "", err
3383+
}
3384+
defer os.RemoveAll(tmpDir)
3385+
3386+
// ARCHIVE BUILDPACKS
3387+
builderBuildpacks := []buildpacks.TestBuildModule{
3388+
buildpacks.BpNoop,
3389+
buildpacks.BpNoop2,
3390+
buildpacks.BpOtherStack,
3391+
buildpacks.BpReadEnv,
3392+
}
3393+
3394+
templateMapping := map[string]interface{}{
3395+
"run_image_mirror": runImageMirror,
3396+
}
3397+
3398+
packageImageName := registryConfig.RepoName("nested-level-1-buildpack-" + h.RandString(8))
3399+
nestedLevelTwoBuildpackName := registryConfig.RepoName("nested-level-2-buildpack-" + h.RandString(8))
3400+
simpleLayersBuildpackName := registryConfig.RepoName("simple-layers-buildpack-" + h.RandString(8))
3401+
simpleLayersBuildpackDifferentShaName := registryConfig.RepoName("simple-layers-buildpack-different-name-" + h.RandString(8))
3402+
3403+
templateMapping["package_id"] = "simple/nested-level-1"
3404+
templateMapping["package_image_name"] = packageImageName
3405+
templateMapping["nested_level_1_buildpack"] = packageImageName
3406+
templateMapping["nested_level_2_buildpack"] = nestedLevelTwoBuildpackName
3407+
templateMapping["simple_layers_buildpack"] = simpleLayersBuildpackName
3408+
templateMapping["simple_layers_buildpack_different_sha"] = simpleLayersBuildpackDifferentShaName
3409+
3410+
fixtureManager := pack.FixtureManager()
3411+
3412+
nestedLevelOneConfigFile, err := os.CreateTemp(tmpDir, "nested-level-1-package.toml")
3413+
assert.Nil(err)
3414+
fixtureManager.TemplateFixtureToFile(
3415+
"nested-level-1-buildpack_package.toml",
3416+
nestedLevelOneConfigFile,
3417+
templateMapping,
3418+
)
3419+
err = nestedLevelOneConfigFile.Close()
3420+
assert.Nil(err)
3421+
3422+
nestedLevelTwoConfigFile, err := os.CreateTemp(tmpDir, "nested-level-2-package.toml")
3423+
assert.Nil(err)
3424+
fixtureManager.TemplateFixtureToFile(
3425+
"nested-level-2-buildpack_package.toml",
3426+
nestedLevelTwoConfigFile,
3427+
templateMapping,
3428+
)
3429+
3430+
err = nestedLevelTwoConfigFile.Close()
3431+
assert.Nil(err)
3432+
3433+
packageImageBuildpack := buildpacks.NewPackageImage(
3434+
t,
3435+
pack,
3436+
packageImageName,
3437+
nestedLevelOneConfigFile.Name(),
3438+
buildpacks.WithRequiredBuildpacks(
3439+
buildpacks.BpNestedLevelOne,
3440+
buildpacks.NewPackageImage(
3441+
t,
3442+
pack,
3443+
nestedLevelTwoBuildpackName,
3444+
nestedLevelTwoConfigFile.Name(),
3445+
buildpacks.WithRequiredBuildpacks(
3446+
buildpacks.BpNestedLevelTwo,
3447+
buildpacks.NewPackageImage(
3448+
t,
3449+
pack,
3450+
simpleLayersBuildpackName,
3451+
fixtureManager.FixtureLocation("simple-layers-buildpack_package.toml"),
3452+
buildpacks.WithRequiredBuildpacks(buildpacks.BpSimpleLayers),
3453+
),
3454+
),
3455+
),
3456+
),
3457+
)
3458+
3459+
simpleLayersDifferentShaBuildpack := buildpacks.NewPackageImage(
3460+
t,
3461+
pack,
3462+
simpleLayersBuildpackDifferentShaName,
3463+
fixtureManager.FixtureLocation("simple-layers-buildpack-different-sha_package.toml"),
3464+
buildpacks.WithRequiredBuildpacks(buildpacks.BpSimpleLayersDifferentSha),
3465+
)
3466+
3467+
defer imageManager.CleanupImages(packageImageName, nestedLevelTwoBuildpackName, simpleLayersBuildpackName, simpleLayersBuildpackDifferentShaName)
3468+
3469+
builderBuildpacks = append(
3470+
builderBuildpacks,
3471+
packageImageBuildpack,
3472+
simpleLayersDifferentShaBuildpack,
3473+
)
3474+
3475+
buildpackManager.PrepareBuildModules(tmpDir, builderBuildpacks...)
3476+
3477+
// ADD lifecycle
3478+
if lifecycle.HasLocation() {
3479+
lifecycleURI := lifecycle.EscapedPath()
3480+
t.Logf("adding lifecycle path '%s' to builder config", lifecycleURI)
3481+
templateMapping["lifecycle_uri"] = lifecycleURI
3482+
} else {
3483+
lifecycleVersion := lifecycle.Version()
3484+
t.Logf("adding lifecycle version '%s' to builder config", lifecycleVersion)
3485+
templateMapping["lifecycle_version"] = lifecycleVersion
3486+
}
3487+
3488+
// RENDER builder.toml
3489+
builderConfigFile, err := os.CreateTemp(tmpDir, "nested_builder.toml")
3490+
if err != nil {
3491+
return "", err
3492+
}
3493+
3494+
pack.FixtureManager().TemplateFixtureToFile("nested_builder.toml", builderConfigFile, templateMapping)
3495+
3496+
err = builderConfigFile.Close()
3497+
if err != nil {
3498+
return "", err
3499+
}
3500+
3501+
// NAME BUILDER
3502+
bldr := registryConfig.RepoName("test/flatten-builder-" + h.RandString(10))
3503+
3504+
// CREATE BUILDER
3505+
output := pack.RunSuccessfully(
3506+
"builder", "create", bldr,
3507+
"-c", builderConfigFile.Name(),
3508+
"--no-color",
3509+
"--verbose",
3510+
"--flatten", "read/env@read-env-version,[email protected],[email protected]",
3511+
)
3512+
3513+
assert.Contains(output, fmt.Sprintf("Successfully created builder image '%s'", bldr))
3514+
assert.Succeeds(h.PushImage(dockerCli, bldr, registryConfig))
3515+
3516+
return bldr, nil
3517+
}
3518+
33183519
// taskKey creates a key from the prefix and all arguments to be unique
33193520
func taskKey(prefix string, args ...string) string {
33203521
hash := sha256.New()

acceptance/assertions/output.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ func (o OutputAssertionManager) IncludesPrefixedGoogleBuilder() {
182182
}
183183

184184
var herokuBuilders = []string{
185-
"heroku/builder:20",
186185
"heroku/builder:22",
187186
}
188187

0 commit comments

Comments
 (0)