Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/actions/setup-go-4
Browse files Browse the repository at this point in the history
  • Loading branch information
AidanDelaney committed Jul 12, 2023
2 parents d5830c9 + 8709636 commit 19b63de
Show file tree
Hide file tree
Showing 55 changed files with 340 additions and 155 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install Dependencies
run: sudo apt-get install make curl jq
- name: Install pack
uses: buildpacks/github-actions/setup-pack@v5.0.1
uses: buildpacks/github-actions/setup-pack@v5.2.0
with:
pack-version: '0.28.0'
- name: Test
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ build: $(HUGO_BIN) pack-version pack-docs-update
.PHONY: test
test: install-pack-cli check-pack-cli-version install-ugo
@echo "> Testing..."
ugo run -r -p ./content/docs/
ugo run -v -r -p ./content/docs/

.PHONY: htmltest-install
htmltest-install:
Expand Down
6 changes: 3 additions & 3 deletions content/docs/app-developer-guide/build-an-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pack builder suggest
```
<!--+- "{{execute}}"+-->

For this guide we're actually going to use a sample builder, `cnbs/sample-builder:bionic`, which is not listed
For this guide we're actually going to use a sample builder, `cnbs/sample-builder:jammy`, which is not listed
as a suggested builder for good reason. It's a sample.

### 2. Build your app
Expand All @@ -47,12 +47,12 @@ ls samples || git clone https://github.com/buildpacks/samples

2. Build the app
```
pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic
pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:jammy
```
<!--+- "{{execute}}"+-->

> **TIP:** If you don't want to keep specifying a builder every time you build, you can set it as your default
> builder by running `pack config default-builder <BUILDER>` for example `pack config default-builder cnbs/sample-builder:bionic`
> builder by running `pack config default-builder <BUILDER>` for example `pack config default-builder cnbs/sample-builder:jammy`
<!--+- "{{execute}}"+-->
### 3. Run it
Expand Down
4 changes: 2 additions & 2 deletions content/docs/app-developer-guide/build-an-arm-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ docker run --rm \
--volume ~/workspace/platform:/platform \
--mount type=bind,source=~/workspace/order.toml,target=/cnb/order.toml \
--env CNB_PLATFORM_API=0.7 \
ubuntu:bionic \
/cnb/lifecycle/creator -log-level debug -daemon -run-image ubuntu:bionic hello-arm64
ubuntu:jammy \
/cnb/lifecycle/creator -log-level debug -daemon -run-image ubuntu:jammy hello-arm64
```

### 4. Run it
Expand Down
2 changes: 1 addition & 1 deletion content/docs/app-developer-guide/building-on-podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ git clone https://github.com/buildpacks/samples
![](https://i.imgur.com/0mmV6K7.png)

```shell=bash
pack build sample-app -p samples/apps/ruby-bundler/ -B cnbs/sample-builder:bionic
pack build sample-app -p samples/apps/ruby-bundler/ -B cnbs/sample-builder:jammy
```

Where:
Expand Down
6 changes: 3 additions & 3 deletions content/docs/app-developer-guide/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export FOO=BAR
pack build sample-app \
--env "HELLO=WORLD" \
--env "FOO" \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--buildpack samples/buildpacks/hello-world/ \
--buildpack samples/apps/bash-script/bash-script-buildpack/ \
--path samples/apps/bash-script/
Expand Down Expand Up @@ -76,7 +76,7 @@ echo -en "HELLO=WORLD\nFOO" > ./envfile
```
pack build sample-app \
--env-file ./envfile \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--buildpack samples/buildpacks/hello-world/ \
--buildpack samples/apps/bash-script/bash-script-buildpack/ \
--path samples/apps/bash-script/
Expand Down Expand Up @@ -122,7 +122,7 @@ EOL
2. Build the app
```
pack build sample-app \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--buildpack samples/buildpacks/hello-world/ \
--buildpack samples/apps/bash-script/bash-script-buildpack/ \
--path samples/apps/bash-script/
Expand Down
2 changes: 1 addition & 1 deletion content/docs/app-developer-guide/mounting-volumes.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Now, we can mount this volume during `pack build`:
```bash
ls -al
pack build volume-example \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--buildpack samples/buildpacks/hello-world \
--path samples/apps/bash-script \
--volume test-volume:/platform/volume:ro
Expand Down
13 changes: 7 additions & 6 deletions content/docs/app-developer-guide/specify-buildpacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,25 @@ pack build sample-java-maven-app \

## Using a Project Descriptor

The [`project.toml`][project-toml] format allows for Buildpack URIs to be specified in the `[[build.buildpacks]]` table with the `uri` key.
The [`project.toml`][project-toml] format allows for Buildpack URIs to be specified in the `[[io.buildpacks.group]]` table with the `uri` key.

##### Example:

```toml
[project]
[_]
schema-version = "0.3"
id = "sample-java-maven-app"
name = "Sample Java App"
version = "1.0.0"

[[build.buildpacks]]
[[io.buildpacks.group]]
uri = "samples/java-maven"

[[build.buildpacks]]
[[io.buildpacks.group]]
uri = "samples/buildpacks/hello-processes/"

[[build.buildpacks]]
uri = "docker://cnbs/sample-package:hello-univers"
[[io.buildpacks.group]]
uri = "docker://cnbs/sample-package:hello-universe"
```

## URI Examples
Expand Down
8 changes: 4 additions & 4 deletions content/docs/app-developer-guide/using-cache-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ For the following examples we will use:
> **NOTE:** If we wish to publish to an external registry like `Dockerhub` we will first need to authenticate with `docker` to allow us to push images. We can do this via `docker login`

Next we trust the `cnbs/sample-builder:bionic` builder in order to allow access to docker credentials when publishing.
Next we trust the `cnbs/sample-builder:jammy` builder in order to allow access to docker credentials when publishing.

```
pack config trusted-builders add cnbs/sample-builder:bionic
pack config trusted-builders add cnbs/sample-builder:jammy
```
<!--+- "{{execute}}"+-->

Expand All @@ -42,7 +42,7 @@ To build the `localhost:5000/buildpack-examples/cache-image-example` application

```
pack build localhost:5000/buildpack-examples/cache-image-example \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--buildpack samples/java-maven \
--path samples/apps/java-maven \
--cache-image localhost:5000/buildpack-examples/maven-cache-image:latest \
Expand Down Expand Up @@ -76,7 +76,7 @@ builds may also update the specified `cache-image`.
The following command will restore data for the `samples/java-maven:maven_m2` layer from the cache image.
```
pack build localhost:5000/buildpack-examples/second-cache-image-example \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--buildpack samples/java-maven \
--path samples/apps/java-maven \
--cache-image localhost:5000/buildpack-examples/maven-cache-image:latest \
Expand Down
6 changes: 3 additions & 3 deletions content/docs/app-developer-guide/using-http-proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ We show how to solve both of these constraints.
You may need the `pack` command-line tool to download buildpacks and images via your proxy. Building an application with an incorrectly configured proxy results in errors such as the following:

```console
$ pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic
ERROR: failed to build: failed to fetch builder image 'index.docker.io/cnbs/sample-builder:bionic'
$ pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:jammy
ERROR: failed to build: failed to fetch builder image 'index.docker.io/cnbs/sample-builder:jammy'
: Error response from daemon: Get "https//registry-1.docker.io/v2/": context deadline exceeded
```

Expand All @@ -37,7 +37,7 @@ Buildpacks may also need to be aware of your http and https proxies at build tim
```console
export http_proxy=http://user:pass@my-proxy.example.com:3128
export https_proxy=https://my-proxy.example.com:3129
pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:bionic
pack build sample-app --path samples/apps/java-maven --builder cnbs/sample-builder:jammy
```

## Making your Application Proxy Aware
Expand Down
15 changes: 8 additions & 7 deletions content/docs/app-developer-guide/using-inline-buildpacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ summary="Learn how to create an ephemeral buildpack to customize your build."

You can supplement your app's build process with custom scripts by creating an _inline buildpack_. An inline buildpack is an ephemeral buildpack that's defined in your [project descriptor][project-toml] (i.e. `project.toml`). You can include a script to run as part of the build without setting up all the files and directories that are required for a complete buildpack.

Inline buildpacks are defined as an entry in the `[[build.buildpacks]]` table of the project descriptor by including an `inline` script in the `[build.buildpacks.script]` table.
Inline buildpacks are defined as an entry in the `[[io.buildpacks.group]]` table of the project descriptor by including an `inline` script in the `[io.buildpacks.group.script]` table.

For example, you may want to run a Rake task against a Ruby app after the Ruby buildpack builds your app.

```toml
[project]
[_]
schema-version = "0.2"
id = "io.buildpacks.my-app"

[[build.buildpacks]]
[[io.buildpacks.group]]
id = "example/ruby"
version = "1.0"

[[build.buildpacks]]
[[io.buildpacks.group]]
id = "me/rake-tasks"

[build.buildpacks.script]
[io.buildpacks.group.script]
api = "0.6"
inline = "rake package"
```
Expand All @@ -33,10 +34,10 @@ In this example, the `me/rake-tasks` inline buildpack is configured to run after
Inline buildpacks aren't constrained to a single command, however. You can define complex scripts as [heredocs](https://toml.io/en/v1.0.0#string) in your project descriptor. For example, this snippet of a descriptor will source a shell script contained in the app repo, use it to modify the app directory (and thus the files that go into the final image), and create slices for the app:

```toml
[[build.buildpacks]]
[[io.buildpacks.group]]
id = "me/cleanup"

[build.buildpacks.script]
[io.buildpacks.group.script]
api = "0.9"
inline = """
set -e
Expand Down
22 changes: 11 additions & 11 deletions content/docs/app-developer-guide/using-project-descriptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ Note the `include` and `exclude` sections in the below `project.toml` file use `
file at the root of the application. For more on `gitignore` matching see [these docs](https://linuxize.com/post/gitignore-ignoring-files-in-git/#literal-file-names).

```toml
[project]
[_]
id = "io.buildpacks.bash-script"
name = "Bash Script"
version = "1.0.0"

[build]
[io.buildpacks]
exclude = [
"/README.md",
"bash-script-buildpack"
]

include = []

[[build.buildpacks]]
[[io.buildpacks.group]]
uri = "bash-script-buildpack/"
```

To use a `project.toml` file, simply:
```shell script
# build the app
pack build sample-app \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--path samples/apps/bash-script/

# run the app
Expand All @@ -50,7 +50,7 @@ docker run sample-app
If the descriptor is named `project.toml`, it will be read by `pack` automatically. Otherwise, you can run:
```shell script
pack build sample-app \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--path samples/apps/bash-script/ \
--descriptor samples/apps/bash-script/<project-descriptor-file.toml>
```
Expand All @@ -67,24 +67,24 @@ understand the environment), we would want to add it to our `project.toml`.
Below is an expanded `project.toml`, with an additional buildpack and environment variable included.

```toml
[project]
[_]
id = "io.buildpacks.bash-script"
name = "Bash Script"
version = "1.0.0"

[build]
[io.buildpacks]
exclude = [
"README.md",
"bash-script-buildpack"
]
[[build.buildpacks]]
[[io.buildpacks.group]]
uri = "../../buildpacks/hello-world/"


[[build.buildpacks]]
[[io.buildpacks.group]]
uri = "bash-script-buildpack/"

[[build.env]]
[[io.buildpacks.build.env]]
name='HELLO'
value='WORLD'
```
Expand All @@ -93,7 +93,7 @@ Paste the above `toml` as `new-project.toml` in the `samples/apps/bash-script/`
```shell script
# build the app
pack build sample-app \
--builder cnbs/sample-builder:bionic \
--builder cnbs/sample-builder:jammy \
--path samples/apps/bash-script/ \
--descriptor samples/apps/bash-script/new-project.toml

Expand Down
2 changes: 1 addition & 1 deletion content/docs/app-journey.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ cd samples/apps/java-maven

3. Build the app using [`pack`][pack-docs]
```
pack build myapp --builder cnbs/sample-builder:bionic
pack build myapp --builder cnbs/sample-builder:jammy
```
<!--+- "{{execute}}"+-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ You should see the following:
<!-- test:assert=contains -->
```text
Run Images:
cnbs/sample-stack-run:bionic
cnbs/sample-stack-run:jammy
Buildpacks:
ID VERSION HOMEPAGE
Expand Down Expand Up @@ -55,7 +55,7 @@ api = "0.8"

# Stacks that the buildpack will work with
[[stacks]]
id = "io.buildpacks.samples.stacks.bionic"
id = "io.buildpacks.samples.stacks.jammy"
```

Then, in our buildpack implementation we will generate the necessary SBOM metadata:
Expand Down Expand Up @@ -131,7 +131,7 @@ mkdir -p "$rubylayer"
# 3. DOWNLOAD RUBY
ruby_version=$(cat "$plan" | yj -t | jq -r '.entries[] | select(.name == "ruby") | .metadata.version')
echo "---> Downloading and extracting Ruby $ruby_version"
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-$ruby_version.tgz
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-$ruby_version.tgz
wget -q -O - "$ruby_url" | tar -xzf - -C "$rubylayer"

# 4. MAKE RUBY AVAILABLE DURING LAUNCH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Next, we'll download the Ruby runtime and install it into the layer directory. A
<!-- file=ruby-buildpack/bin/build data-target=append -->
```bash
echo "---> Downloading and extracting Ruby"
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.3.tgz
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-3.1.3.tgz
wget -q -O - "$ruby_url" | tar -xzf - -C "$rubylayer"
```

Expand Down Expand Up @@ -94,7 +94,7 @@ mkdir -p "$rubylayer"

# 3. DOWNLOAD RUBY
echo "---> Downloading and extracting Ruby"
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.3.tgz
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-22/ruby-3.1.3.tgz
wget -q -O - "$ruby_url" | tar -xzf - -C "$rubylayer"

# 4. MAKE RUBY AVAILABLE DURING LAUNCH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pack buildpack new examples/ruby \
--api 0.8 \
--path ruby-buildpack \
--version 0.0.1 \
--stacks io.buildpacks.samples.stacks.bionic
--stacks io.buildpacks.samples.stacks.jammy
```
<!--+- "{{execute}}"+-->
This command will create `ruby-buildpack` directory which contains `buildpack.toml`, `bin/build`, `bin/detect` files.
Expand Down Expand Up @@ -50,7 +50,7 @@ api = "0.8"

# Stacks that the buildpack will work with
[[stacks]]
id = "io.buildpacks.samples.stacks.bionic"
id = "io.buildpacks.samples.stacks.jammy"

```

Expand Down Expand Up @@ -92,15 +92,15 @@ Set your default [builder][builder] by running the following:

<!-- test:exec -->
```bash
pack config default-builder cnbs/sample-builder:bionic
pack config default-builder cnbs/sample-builder:jammy
```
<!--+- "{{execute}}"+-->

Tell pack to trust our default builder:

<!-- test:exec -->
```bash
pack config trusted-builders add cnbs/sample-builder:bionic
pack config trusted-builders add cnbs/sample-builder:jammy
```
<!--+- "{{execute}}"+-->

Expand Down
Loading

0 comments on commit 19b63de

Please sign in to comment.