Skip to content

Add PLATFORMS var for offline bundling #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@ Caching https://github.com/SAP/SapMachine/releases/download/sapmachine-11.0.10/s
Creating build/java-buildpack-offline-cfd6b17.zip
```

Different platforms can be selected using the `PLATFORMS` arguments. Supported values of `PLATFORMS` are **bionic** for cflinuxfs3 and **jammy** for cflinuxfs4. The default value is **bionic**.

```bash
$ bundle exec rake clean package OFFLINE=true ADD_TO_CACHE=sap_machine_jre PLATFORMS=jammy,bionic
...
Caching https://java-buildpack.cloudfoundry.org/google-stackdriver-debugger/jammy/x86_64/index.yml
Caching https://java-buildpack.cloudfoundry.org/google-stackdriver-debugger/bionic/x86_64/index.yml
...
Creating build/java-buildpack-offline-v*.**.zip
```

### Package Versioning
Keeping track of different versions of the buildpack can be difficult. To help with this, the rake `package` task puts a version discriminator in the name of the created package file. The default value for this discriminator is the current Git hash (e.g. `cfd6b17`). To change the version when creating a package, use the `VERSION=<VERSION>` argument:

Expand Down
9 changes: 8 additions & 1 deletion rakelib/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ def self.version

BUILDPACK_VERSION = JavaBuildpack::BuildpackVersion.new(false).freeze

PLATFORMS = %w[bionic jammy].freeze
PLATFORMS = %w[]
platform_var = ENV.fetch('PLATFORMS', 'bionic')
if platform_var != 'bionic'
platform_var = platform_var.split(',')
(PLATFORMS << platform_var).flatten!.uniq!
else
PLATFORMS << platform_var
end

STAGING_DIR = "#{BUILD_DIR}/staging".freeze

Expand Down