Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/jjbustamante/issue-1286
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbustamante authored Nov 8, 2023
2 parents 074967a + b12c9b3 commit 879e1da
Show file tree
Hide file tree
Showing 114 changed files with 1,421 additions and 227 deletions.
12 changes: 8 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
interval: "weekly"
groups:
# Group all minor/patch go dependencies into a single PR.
go-dependencies:
update-types:
- "minor"
- "patch"
labels:
- "dependencies"
- "go"
Expand All @@ -15,8 +20,7 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
interval: "weekly"
labels:
- "dependencies"
- "github_actions"
Expand Down
38 changes: 21 additions & 17 deletions .github/workflows/delivery-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ on:
default: false

env:
BUILDER: "paketobuildpacks/builder-jammy-tiny"
IMG_NAME: 'pack'
USERNAME: 'buildpacksio'

jobs:
deliver-docker:
strategy:
matrix:
config: [tiny, base]
include:
- config: tiny
base_image: gcr.io/distroless/static
suffix:
- config: base
base_image: ubuntu:jammy
suffix: -base
runs-on: ubuntu-latest
steps:
- name: Determine version
Expand All @@ -42,35 +51,30 @@ jobs:
uses: actions/checkout@v4
with:
ref: v${{ steps.version.outputs.result }}
# This has to come after the first checkout, so it isn't clobbered
- name: Checkout delivery configuration
uses: actions/checkout@v4
with:
path: ./head
- name: Setup Working Dir
shell: bash
run: |
rm project.toml || true
cp head/.github/workflows/delivery/docker/project.toml project.toml
- name: Determine App Name
run: 'echo "IMG_NAME=${{ env.USERNAME }}/${{ env.IMG_NAME }}" >> $GITHUB_ENV'
- name: Login to Dockerhub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: buildpacks/github-actions/setup-tools@v5.4.0
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: buildpacks/github-actions/setup-tools@v5.5.0
- name: Buildx Build/Publish
run: |
docker buildx build . \
--tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} \
--tag ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }}${{ matrix.suffix }} \
--platform linux/amd64,linux/arm64 \
--build-arg pack_version=${{ steps.version.outputs.result }} \
--build-arg base_image=${{ matrix.base_image }} \
--provenance=false \
--push
- name: Tag Image as Base
if: ${{ (github.event.release != '' || github.event.inputs.tag_latest) && matrix.config == 'base' }}
run: |
crane copy ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} ${{ env.IMG_NAME }}:base
- name: Tag Image as Latest
if: ${{ github.event.release != '' || github.event.inputs.tag_latest }}
if: ${{ (github.event.release != '' || github.event.inputs.tag_latest) && matrix.config != 'base' }}
run: |
crane copy ${{ env.IMG_NAME }}:${{ steps.version.outputs.result }} ${{ env.IMG_NAME }}:latest
7 changes: 0 additions & 7 deletions .github/workflows/delivery/docker/project.toml

This file was deleted.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
ARG base_image=gcr.io/distroless/static

FROM golang:1.20 as builder
ARG pack_version
ENV PACK_VERSION=$pack_version
WORKDIR /app
COPY . .
RUN make build

FROM scratch
FROM ${base_image}
COPY --from=builder /app/out/pack /usr/local/bin/pack
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /tmp /tmp
ENTRYPOINT [ "/usr/local/bin/pack" ]
35 changes: 15 additions & 20 deletions acceptance/acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ func testAcceptance(
var (
pack, createBuilderPack *invoke.PackInvoker
buildpackManager buildpacks.BuildModuleManager
bpDir = buildModulesDir(lifecycle.EarliestBuildpackAPIVersion())
bpDir = buildModulesDir()
assert = h.NewAssertionManager(t)
)

Expand All @@ -649,7 +649,6 @@ func testAcceptance(
buildpackManager = buildpacks.NewBuildModuleManager(
t,
assert,
buildpacks.WithBuildpackAPIVersion(lifecycle.EarliestBuildpackAPIVersion()),
)
})

Expand Down Expand Up @@ -795,23 +794,19 @@ func testAcceptance(
})

it("creates builder", func() {
// Linux containers (including Linux containers on Windows)
extSimpleLayersDiffID := "sha256:b9e4a0ddfb650c7aa71d1e6aceea1665365e409b3078bfdc1e51c2b07ab2b423"
extReadEnvDiffID := "sha256:4490d78f2b056cdb99ad9cd3892f3c0617c5a485fb300dd90c572ce375ee45b2"
bpSimpleLayersDiffID := "sha256:285ff6683c99e5ae19805f6a62168fb40dca64d813c53b782604c9652d745c70"
bpReadEnvDiffID := "sha256:dd1e0efcbf3f08b014ef6eff9cfe7a9eac1cf20bd9b6a71a946f0a74575aa56f"
if imageManager.HostOS() == "windows" { // Windows containers on Windows
extSimpleLayersDiffID = "sha256:a063cf949b9c267133e451ac8cd95b4e77571bb7c629dd817461dca769170810"
extReadEnvDiffID = "sha256:ae9520eef7d84f69da6adf2597266660ce3fa5fd8ddac716cbfbecb67ded50e5"
bpSimpleLayersDiffID = "sha256:ccd1234cc5685e8a412b70c5f9a8e7b584b8e4f2a20c987ec242c9055de3e45e"
bpReadEnvDiffID = "sha256:8b22a7742ffdfbdd978787c6937456b68afb27c3585a3903048be7434d251e3f"
if imageManager.HostOS() != "windows" {
// Linux containers (including Linux containers on Windows)
extSimpleLayersDiffID := "sha256:d24758b8b75b13292746fe7a06666f28a9499da31826a60afe6ee6b8cba29b73"
extReadEnvDiffID := "sha256:4490d78f2b056cdb99ad9cd3892f3c0617c5a485fb300dd90c572ce375ee45b2"
bpSimpleLayersDiffID := "sha256:ade9da86859fa4ea50a513757f9b242bf1038667abf92dad3d018974a17f0ea7"
bpReadEnvDiffID := "sha256:db0797077ba8deff7054ab5578133b8f0206b6393de34b5bfd795cf50f6afdbd"
// extensions
assertImage.HasLabelWithData(builderName, "io.buildpacks.extension.layers", `{"read/env":{"read-env-version":{"api":"0.9","layerDiffID":"`+extReadEnvDiffID+`","name":"Read Env Extension"}},"simple/layers":{"simple-layers-version":{"api":"0.7","layerDiffID":"`+extSimpleLayersDiffID+`","name":"Simple Layers Extension"}}}`)
assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order-extensions", `[{"group":[{"id":"read/env","version":"read-env-version"},{"id":"simple/layers","version":"simple-layers-version"}]}]`)
// buildpacks
assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.layers", `{"read/env":{"read-env-version":{"api":"0.7","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpReadEnvDiffID+`","name":"Read Env Buildpack"}},"simple/layers":{"simple-layers-version":{"api":"0.7","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpSimpleLayersDiffID+`","name":"Simple Layers Buildpack"}}}`)
assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order", `[{"group":[{"id":"read/env","version":"read-env-version","optional":true},{"id":"simple/layers","version":"simple-layers-version","optional":true}]}]`)
}
// extensions
assertImage.HasLabelWithData(builderName, "io.buildpacks.extension.layers", `{"read/env":{"read-env-version":{"api":"0.9","layerDiffID":"`+extReadEnvDiffID+`","name":"Read Env Extension"}},"simple/layers":{"simple-layers-version":{"api":"0.2","layerDiffID":"`+extSimpleLayersDiffID+`","name":"Simple Layers Extension"}}}`)
assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order-extensions", `[{"group":[{"id":"read/env","version":"read-env-version"},{"id":"simple/layers","version":"simple-layers-version"}]}]`)
// buildpacks
assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.layers", `{"read/env":{"read-env-version":{"api":"0.2","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpReadEnvDiffID+`","name":"Read Env Buildpack"}},"simple/layers":{"simple-layers-version":{"api":"0.2","stacks":[{"id":"pack.test.stack"}],"layerDiffID":"`+bpSimpleLayersDiffID+`","name":"Simple Layers Buildpack"}}}`)
assertImage.HasLabelWithData(builderName, "io.buildpacks.buildpack.order", `[{"group":[{"id":"read/env","version":"read-env-version","optional":true},{"id":"simple/layers","version":"simple-layers-version","optional":true}]}]`)
})

when("build", func() {
Expand Down Expand Up @@ -2898,8 +2893,8 @@ include = [ "*.jar", "media/mountain.jpg", "/media/person.png", ]
})
}

func buildModulesDir(bpAPIVersion string) string {
return filepath.Join("testdata", "mock_buildpacks", bpAPIVersion)
func buildModulesDir() string {
return filepath.Join("testdata", "mock_buildpacks")
}

func createComplexBuilder(t *testing.T,
Expand Down
2 changes: 1 addition & 1 deletion acceptance/assertions/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ func (o OutputAssertionManager) IncludesPrefixedGoogleBuilder() {
}

var herokuBuilders = []string{
"heroku/builder:20",
"heroku/builder:22",
"heroku/buildpacks:20",
}

func (o OutputAssertionManager) IncludesHerokuBuilders() {
Expand Down
10 changes: 1 addition & 9 deletions acceptance/buildpacks/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"path/filepath"
"testing"

"github.com/buildpacks/pack/internal/builder"

"github.com/buildpacks/pack/testhelpers"
)

Expand All @@ -20,17 +18,11 @@ type BuildModuleManager struct {

type BuildModuleManagerModifier func(b *BuildModuleManager)

func WithBuildpackAPIVersion(apiVersion string) func(b *BuildModuleManager) {
return func(b *BuildModuleManager) {
b.sourceDir = filepath.Join("testdata", "mock_buildpacks", apiVersion)
}
}

func NewBuildModuleManager(t *testing.T, assert testhelpers.AssertionManager, modifiers ...BuildModuleManagerModifier) BuildModuleManager {
m := BuildModuleManager{
testObject: t,
assert: assert,
sourceDir: filepath.Join("testdata", "mock_buildpacks", builder.DefaultBuildpackAPIVersion),
sourceDir: filepath.Join("testdata", "mock_buildpacks"),
}

for _, mod := range modifiers {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "descriptor/bp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "internet/bp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "local/meta-bp-dep"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "local/meta-bp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "simple/nested-level-1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "simple/nested-level-2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "noop.buildpack"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "noop.buildpack"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "local/bp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "other/stack/bp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ if [[ -f "$platform_dir/env/ENV1_CONTENTS" ]]; then
contents=$(cat "$platform_dir/env/ENV1_CONTENTS")
echo "$contents" > "$launch_dir/env1-launch-layer/env1-launch-dep"
ln -snf "$launch_dir/env1-launch-layer" env1-launch-deps
echo "launch = true" > "$launch_dir/env1-launch-layer.toml"
echo "[types]" > "$launch_dir/env1-launch-layer.toml"
echo "launch = true" >> "$launch_dir/env1-launch-layer.toml"
fi

## makes a launch layer
Expand All @@ -26,7 +27,8 @@ if [[ -f "$platform_dir/env/ENV2_CONTENTS" ]]; then
contents=$(cat "$platform_dir/env/ENV2_CONTENTS")
echo "$contents" > "$launch_dir/env2-launch-layer/env2-launch-dep"
ln -snf "$launch_dir/env2-launch-layer" env2-launch-deps
echo "launch = true" > "$launch_dir/env2-launch-layer.toml"
echo "[types]" > "$launch_dir/env2-launch-layer.toml"
echo "launch = true" >> "$launch_dir/env2-launch-layer.toml"
fi

echo "---> Done"
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ if exist %platform_dir%\env\ENV1_CONTENTS (
set /p contents=<%platform_dir%\env\ENV1_CONTENTS
echo !contents!> %launch_dir%\env1-launch-layer\env1-launch-dep
mklink /j env1-launch-deps %launch_dir%\env1-launch-layer
echo launch = true> %launch_dir%\env1-launch-layer.toml
echo [types] > %launch_dir%\env1-launch-layer.toml
echo launch = true >> %launch_dir%\env1-launch-layer.toml
)

:: makes a launch layer
Expand All @@ -21,7 +22,8 @@ if exist %platform_dir%\env\ENV2_CONTENTS (
set /p contents=<%platform_dir%\env\ENV2_CONTENTS
echo !contents!> %launch_dir%\env2-launch-layer\env2-launch-dep
mklink /j env2-launch-deps %launch_dir%\env2-launch-layer
echo launch = true> %launch_dir%\env2-launch-layer.toml
echo [types] > %launch_dir%\env2-launch-layer.toml
echo launch = true >> %launch_dir%\env2-launch-layer.toml
)

echo --- Done
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "read/env"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "volume/bp"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.2"
api = "0.7"

[buildpack]
id = "rw-volume/bp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,17 @@ echo "Color: Styled"
mkdir "$launch_dir/launch-layer"
echo "Launch Dep Contents" > "$launch_dir/launch-layer/launch-dep"
ln -snf "$launch_dir/launch-layer" launch-deps
echo "launch = true" > "$launch_dir/launch-layer.toml"
echo "[types]" > "$launch_dir/launch-layer.toml"
echo "launch = true" >> "$launch_dir/launch-layer.toml"

## makes a cached launch layer
if [[ ! -f "$launch_dir/cached-launch-layer.toml" ]]; then
echo "making cached launch layer"
mkdir "$launch_dir/cached-launch-layer"
echo "Cached Dep Contents" > "$launch_dir/cached-launch-layer/cached-dep"
ln -snf "$launch_dir/cached-launch-layer" cached-deps
echo "launch = true" > "$launch_dir/cached-launch-layer.toml"
echo "[types]" > "$launch_dir/cached-launch-layer.toml"
echo "launch = true" >> "$launch_dir/cached-launch-layer.toml"
echo "cache = true" >> "$launch_dir/cached-launch-layer.toml"
else
echo "reusing cached launch layer"
Expand All @@ -38,6 +40,7 @@ cat <<EOF > "$launch_dir/launch.toml"
type = "web"
command = "./run"
args = ["8080"]
default = true
[[processes]]
type = "hello"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ echo making launch layer %launch_dir%\launch-layer
mkdir %launch_dir%\launch-layer
echo Launch Dep Contents > "%launch_dir%\launch-layer\launch-dep
mklink /j launch-deps %launch_dir%\launch-layer
echo launch = true > %launch_dir%\launch-layer.toml
echo [types] > %launch_dir%\launch-layer.toml
echo launch = true >> %launch_dir%\launch-layer.toml

:: makes a cached launch layer
if not exist %launch_dir%\cached-launch-layer.toml (
echo making cached launch layer %launch_dir%\cached-launch-layer
mkdir %launch_dir%\cached-launch-layer
echo Cached Dep Contents > %launch_dir%\cached-launch-layer\cached-dep
mklink /j cached-deps %launch_dir%\cached-launch-layer
echo launch = true > %launch_dir%\cached-launch-layer.toml
echo [types] > %launch_dir%\cached-launch-layer.toml
echo launch = true >> %launch_dir%\cached-launch-layer.toml
echo cache = true >> %launch_dir%\cached-launch-layer.toml
) else (
echo reusing cached launch layer %launch_dir%\cached-launch-layer
Expand All @@ -29,6 +31,7 @@ echo [[processes]]
echo type = "web"
echo command = '.\run'
echo args = ["8080"]
echo default = true
echo.
echo [[processes]]
echo type = "hello"
Expand Down
Loading

0 comments on commit 879e1da

Please sign in to comment.