Skip to content

Commit cac7440

Browse files
author
Natalie Arellano
authored
Merge branch 'main' into extensions-phase-2-rc2
2 parents f7f1ab5 + 447ad8a commit cac7440

21 files changed

+1096
-180
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ jobs:
3838
- name: Check links
3939
run: |
4040
make check-links
41-
- name: Check katacoda
42-
run: |
43-
make check-katacoda
4441
- name: Upload public folder
4542
uses: actions/upload-artifact@v3
4643
env:

config.toml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,6 @@ featureKatacoda = false
8181
url = "https://github.com/buildpacks"
8282
weight = 4
8383

84-
[[menu.docs]]
85-
name = "Application Developer Guide"
86-
url = "/docs/app-developer-guide"
87-
weight = 1
88-
89-
[[menu.docs]]
90-
name = "Buildpack Author Guide"
91-
url = "/docs/buildpack-author-guide"
92-
weight = 2
93-
94-
[[menu.docs]]
95-
name = "Platform Operator Guide"
96-
url = "/docs/operator-guide/"
97-
weight = 3
98-
9984
[security]
10085
enableInlineShortcodes = false
10186
[security.exec]

content/docs/buildpack-author-guide/create-buildpack/adding-bill-of-materials.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ Processes:
3838

3939
Apart from the above standard metadata, buildpacks can also populate information about the dependencies they have provided in form of a `Bill-of-Materials`. Let's see how we can use this to populate information about the version of `ruby` that was installed in the output app image.
4040

41-
To add the `ruby` version to the output of `pack download sbom`, we will have to provide a [Software `Bill-of-Materials`](https://en.wikipedia.org/wiki/Software_bill_of_materials) (`SBOM`) containing this information. There are three "standard" ways to report SBOM data. You'll need to choose to use on of [CycloneDX](https://cyclonedx.org/), [SPDX](https://spdx.dev/) or [Syft](https://github.com/anchore/syft) update the `ruby.sbom.<ext>` (where `<ext>` is the extension appropriate for your SBOM standard, one of `cdx.json`, `spdx.json` or `syft.json`) at the end of your `build` script. Discussion of which SBOM format to choose is outside the scope of this tutorial, but we will note that the SBOM format you choose to use is likely to be the output format of any SBOM scanner (eg: [`syft cli`](https://github.com/anchore/syft)) you might choose to use. In this example we will use the CycloneDX json format.
41+
To add the `ruby` version to the output of `pack download sbom`, we will have to provide a [Software `Bill-of-Materials`](https://en.wikipedia.org/wiki/Software_bill_of_materials) (`SBOM`) containing this information. There are three "standard" ways to report SBOM data. You'll need to choose to use one of [CycloneDX](https://cyclonedx.org/), [SPDX](https://spdx.dev/) or [Syft](https://github.com/anchore/syft) update the `ruby.sbom.<ext>` (where `<ext>` is the extension appropriate for your SBOM standard, one of `cdx.json`, `spdx.json` or `syft.json`) at the end of your `build` script. Discussion of which SBOM format to choose is outside the scope of this tutorial, but we will note that the SBOM format you choose to use is likely to be the output format of any SBOM scanner (eg: [`syft cli`](https://github.com/anchore/syft)) you might choose to use. In this example we will use the CycloneDX json format.
4242

4343
First, annotate the `buildpack.toml` to specify that it emits CycloneDX:
4444

4545
<!-- test:file=ruby-buildpack/buildpack.toml -->
4646
```toml
4747
# Buildpack API version
48-
api = "0.7"
48+
api = "0.8"
4949

5050
# Buildpack ID and metadata
5151
[buildpack]
@@ -141,11 +141,7 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
141141
export PATH="$rubylayer"/bin:$PATH
142142
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
143143

144-
# 6. INSTALL BUNDLER
145-
echo "---> Installing bundler"
146-
gem install bundler --no-ri --no-rdoc
147-
148-
# 7. INSTALL GEMS
144+
# 6. INSTALL GEMS
149145
# Compares previous Gemfile.lock checksum to the current Gemfile.lock
150146
bundlerlayer="$layersdir/bundler"
151147
local_bundler_checksum=$((sha256sum Gemfile.lock || echo 'DOES_NOT_EXIST') | cut -d ' ' -f 1)
@@ -170,7 +166,7 @@ EOL
170166
171167
fi
172168
173-
# 8. SET DEFAULT START COMMAND
169+
# 7. SET DEFAULT START COMMAND
174170
cat > "$layersdir/launch.toml" << EOL
175171
# our web process
176172
[[processes]]
@@ -185,7 +181,7 @@ command = "bundle exec ruby worker.rb"
185181
EOL
186182
187183
# ========== ADDED ===========
188-
# 9. ADD A SBOM
184+
# 8. ADD A SBOM
189185
rubybom="${layersdir}/ruby.sbom.cdx.json"
190186
cat >> ${rubybom} << EOL
191187
{
@@ -237,7 +233,7 @@ The SBOM information is now downloaded to the local file system:
237233
cat layers/sbom/launch/examples_ruby/ruby/sbom.cdx.json | jq -M
238234
```
239235
240-
You should find that the included `ruby` version is `2.5.0` as expected.
236+
You should find that the included `ruby` version is `3.1.0` as expected.
241237
242238
<!-- test:assert=contains;ignore-lines=... -->
243239
```text
@@ -249,7 +245,7 @@ You should find that the included `ruby` version is `2.5.0` as expected.
249245
{
250246
"type": "library",
251247
"name": "ruby",
252-
"version": "2.5.0"
248+
"version": "3.1.0"
253249
},
254250
...
255251
]

content/docs/buildpack-author-guide/create-buildpack/build-app.md

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Next, we'll download the Ruby runtime and install it into the layer directory. A
4040
<!-- file=ruby-buildpack/bin/build data-target=append -->
4141
```bash
4242
echo "---> Downloading and extracting Ruby"
43-
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.1.tgz
43+
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.3.tgz
4444
wget -q -O - "$ruby_url" | tar -xzf - -C "$rubylayer"
4545
```
4646

@@ -67,9 +67,6 @@ Now we can install Bundler, a dependency manager for Ruby, and run the `bundle i
6767

6868
<!-- file=ruby-buildpack/bin/build data-target=append -->
6969
```bash
70-
echo "---> Installing bundler"
71-
gem install bundler --no-ri --no-rdoc
72-
7370
echo "---> Installing gems"
7471
bundle install
7572
```
@@ -97,7 +94,7 @@ mkdir -p "$rubylayer"
9794

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

103100
# 4. MAKE RUBY AVAILABLE DURING LAUNCH
@@ -107,11 +104,7 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
107104
export PATH="$rubylayer"/bin:$PATH
108105
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
109106

110-
# 6. INSTALL BUNDLER
111-
echo "---> Installing bundler"
112-
gem install bundler --no-ri --no-rdoc
113-
114-
# 7. INSTALL GEMS
107+
# 6. INSTALL GEMS
115108
echo "---> Installing gems"
116109
bundle install
117110
```
@@ -133,8 +126,6 @@ You will see the following output:
133126
===> BUILDING
134127
---> Ruby Buildpack
135128
---> Downloading and extracting Ruby
136-
---> Installing bundler
137-
...
138129
---> Installing gems
139130
...
140131
===> EXPORTING

content/docs/buildpack-author-guide/create-buildpack/building-blocks-cnb.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Example:
1717
<!-- test:exec -->
1818
```bash
1919
pack buildpack new examples/ruby \
20-
--api 0.7 \
20+
--api 0.8 \
2121
--path ruby-buildpack \
2222
--version 0.0.1 \
2323
--stacks io.buildpacks.samples.stacks.bionic
@@ -41,7 +41,7 @@ You will have `ruby-buildpack/buildpack.toml`<!--+"{{open}}"+--> in your buildpa
4141
<!-- test:file=ruby-buildpack/buildpack.toml -->
4242
```toml
4343
# Buildpack API version
44-
api = "0.7"
44+
api = "0.8"
4545

4646
# Buildpack ID and metadata
4747
[buildpack]

content/docs/buildpack-author-guide/create-buildpack/caching.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mkdir -p "$rubylayer"
4545

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

5151
# 4. MAKE RUBY AVAILABLE DURING LAUNCH
@@ -55,19 +55,15 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
5555
export PATH="$rubylayer"/bin:$PATH
5656
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
5757

58-
# 6. INSTALL BUNDLER
59-
echo "---> Installing bundler"
60-
gem install bundler --no-ri --no-rdoc
61-
6258
# ======= MODIFIED =======
63-
# 7. INSTALL GEMS
59+
# 6. INSTALL GEMS
6460
echo "---> Installing gems"
6561
bundlerlayer="$layersdir/bundler"
6662
mkdir -p "$bundlerlayer"
6763
echo -e '[types]\ncache = true\nlaunch = true' > "$layersdir/bundler.toml"
6864
bundle config set --local path "$bundlerlayer" && bundle install && bundle binstubs --all --path "$bundlerlayer/bin"
6965

70-
# 8. SET DEFAULT START COMMAND
66+
# 7. SET DEFAULT START COMMAND
7167
cat > "$layersdir/launch.toml" << EOL
7268
# our web process
7369
[[processes]]
@@ -196,7 +192,7 @@ mkdir -p "$rubylayer"
196192
197193
# 3. DOWNLOAD RUBY
198194
echo "---> Downloading and extracting Ruby"
199-
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.5.1.tgz
195+
ruby_url=https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-3.1.3.tgz
200196
wget -q -O - "$ruby_url" | tar -xzf - -C "$rubylayer"
201197
202198
# 4. MAKE RUBY AVAILABLE DURING LAUNCH
@@ -206,12 +202,8 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
206202
export PATH="$rubylayer"/bin:$PATH
207203
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
208204
209-
# 6. INSTALL BUNDLER
210-
echo "---> Installing bundler"
211-
gem install bundler --no-ri --no-rdoc
212-
213205
# ======= MODIFIED =======
214-
# 7. INSTALL GEMS
206+
# 6. INSTALL GEMS
215207
# Compares previous Gemfile.lock checksum to the current Gemfile.lock
216208
bundlerlayer="$layersdir/bundler"
217209
local_bundler_checksum=$((sha256sum Gemfile.lock || echo 'DOES_NOT_EXIST') | cut -d ' ' -f 1)
@@ -236,7 +228,7 @@ EOL
236228
237229
fi
238230
239-
# 8. SET DEFAULT START COMMAND
231+
# 7. SET DEFAULT START COMMAND
240232
cat > "$layersdir/launch.toml" << EOL
241233
# our web process
242234
[[processes]]
@@ -266,8 +258,6 @@ it will download the gems:
266258
===> BUILDING
267259
---> Ruby Buildpack
268260
---> Downloading and extracting Ruby
269-
---> Installing bundler
270-
...
271261
---> Installing gems
272262
```
273263
@@ -286,8 +276,6 @@ you will see the new caching logic at work during the `BUILDING` phase:
286276
===> BUILDING
287277
---> Ruby Buildpack
288278
---> Downloading and extracting Ruby
289-
---> Installing bundler
290-
...
291279
---> Reusing gems
292280
```
293281

content/docs/buildpack-author-guide/create-buildpack/make-app-runnable.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ mkdir -p "$rubylayer"
4040

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

4646
# 4. MAKE RUBY AVAILABLE DURING LAUNCH
@@ -50,16 +50,12 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
5050
export PATH="$rubylayer"/bin:$PATH
5151
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
5252

53-
# 6. INSTALL BUNDLER
54-
echo "---> Installing bundler"
55-
gem install bundler --no-ri --no-rdoc
56-
57-
# 7. INSTALL GEMS
53+
# 6. INSTALL GEMS
5854
echo "---> Installing gems"
5955
bundle install
6056

6157
# ========== ADDED ===========
62-
# 8. SET DEFAULT START COMMAND
58+
# 7. SET DEFAULT START COMMAND
6359
cat > "$layersdir/launch.toml" << EOL
6460
[[processes]]
6561
type = "web"

content/docs/buildpack-author-guide/create-buildpack/make-buildpack-configurable.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fi
2424

2525
# ======= ADDED =======
2626
plan=$2
27-
version=2.5.1
27+
version=3.1.3
2828

2929
if [[ -f .ruby-version ]]; then
3030
version=$(cat .ruby-version | tr -d '[:space:]')
@@ -69,11 +69,7 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
6969
export PATH="$rubylayer"/bin:$PATH
7070
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
7171

72-
# 6. INSTALL BUNDLER
73-
echo "---> Installing bundler"
74-
gem install bundler --no-ri --no-rdoc
75-
76-
# 7. INSTALL GEMS
72+
# 6. INSTALL GEMS
7773
# Compares previous Gemfile.lock checksum to the current Gemfile.lock
7874
bundlerlayer="$layersdir/bundler"
7975
local_bundler_checksum=$((sha256sum Gemfile.lock || echo 'DOES_NOT_EXIST') | cut -d ' ' -f 1)
@@ -98,7 +94,7 @@ EOL
9894
9995
fi
10096
101-
# 8. SET DEFAULT START COMMAND
97+
# 7. SET DEFAULT START COMMAND
10298
cat > "$layersdir/launch.toml" << EOL
10399
# our web process
104100
[[processes]]
@@ -117,7 +113,7 @@ Finally, create a file `ruby-sample-app/.ruby-version` with the following conten
117113
118114
<!-- test:file=ruby-sample-app/.ruby-version -->
119115
```
120-
2.5.0
116+
3.1.0
121117
```
122118
123119
Now when you run:
@@ -134,7 +130,7 @@ You will notice that version of Ruby specified in the app's `.ruby-version` file
134130
```text
135131
===> BUILDING
136132
---> Ruby Buildpack
137-
---> Downloading and extracting Ruby 2.5.0
133+
---> Downloading and extracting Ruby 3.1.0
138134
```
139135
140136
Next, let's see how buildpacks can store information about the dependencies provided in the output app image for introspection.

content/docs/buildpack-author-guide/create-buildpack/specify-multiple-process-types.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ mkdir -p "$rubylayer"
5757

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

6363
# 4. MAKE RUBY AVAILABLE DURING LAUNCH
@@ -67,16 +67,12 @@ echo -e '[types]\nlaunch = true' > "$layersdir/ruby.toml"
6767
export PATH="$rubylayer"/bin:$PATH
6868
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"$rubylayer/lib"
6969

70-
# 6. INSTALL BUNDLER
71-
echo "---> Installing bundler"
72-
gem install bundler --no-ri --no-rdoc
73-
74-
# 7. INSTALL GEMS
70+
# 6. INSTALL GEMS
7571
echo "---> Installing gems"
7672
bundle install
7773

7874
# ========== MODIFIED ===========
79-
# 8. SET DEFAULT START COMMAND
75+
# 7. SET DEFAULT START COMMAND
8076
cat > "$layersdir/launch.toml" << EOL
8177
# our web process
8278
[[processes]]

content/docs/buildpack-author-guide/publishing-with-github-actions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ jobs:
3434
- ubuntu-latest
3535
steps:
3636
- id: checkout
37-
uses: actions/checkout@v2
37+
uses: actions/checkout@v3
3838
- if: ${{ github.event_name != 'pull_request' || ! github.event.pull_request.head.repo.fork }}
3939
uses: docker/login-action@v1
4040
with:
4141
registry: docker.io
4242
username: ${{ secrets.DOCKER_HUB_USER }}
4343
password: ${{ secrets.DOCKER_HUB_PASS }}
4444
- id: setup-pack
45-
uses: buildpacks/github-actions/setup-pack@v4.4.0
45+
uses: buildpacks/github-actions/setup-pack@v4.9.0
4646
- id: package
4747
run: |
4848
#!/usr/bin/env bash
@@ -59,7 +59,7 @@ jobs:
5959
env:
6060
REPO: docker.io/${{ secrets.DOCKER_HUB_USER }}
6161
- id: register
62-
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:4.4.0
62+
uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:4.9.0
6363
with:
6464
token: ${{ secrets.PUBLIC_REPO_TOKEN }}
6565
id: ${{ steps.package.outputs.bp_id }}

0 commit comments

Comments
 (0)