Skip to content

Commit e18ea1b

Browse files
authored
Air gap mode and alternative URLs for repository addresses (#730)
Signed-off-by: Dan Webb <[email protected]>
1 parent 67063e8 commit e18ea1b

File tree

7 files changed

+21
-10
lines changed

7 files changed

+21
-10
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ This file is used to list changes made in each version of the Java cookbook.
44

55
## Unreleased
66

7-
Standardise files with files in sous-chefs/repo-management
8-
9-
- Update the recommended Ruby VSCode extensions
7+
- Add `repository_uri` property to `temurin_package_install` and `openjdk_pkg_install` resources to support installation from alternative/internal mirrors ([#728](https://github.com/sous-chefs/java/issues/728))
8+
- Clarify documentation for `url` property in `openjdk_source_install` resource to note it can be used for internal mirrors
9+
- Standardise files with files in sous-chefs/repo-management
10+
Update the recommended Ruby VSCode extensions
1011
- Fix missing skip_alternatives property in openjdk_pkg_install
1112

1213
## 13.1.0 - *2025-07-14*

documentation/resources/openjdk_pkg_install.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Introduced: v8.1.0
2525
| alternatives_priority | Integer | `1062` | Alternatives priority to set for this Java |
2626
| reset_alternatives | Boolean | `true` | Whether to reset alternatives before setting |
2727
| skip_alternatives | Boolean | `false` | Skip alternatives installation completely |
28+
| repository_uri | String | `nil` | URI for the repository mirror to use instead of default repository URLs |
2829

2930
## Examples
3031

documentation/resources/temurin_package_install.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Introduced: v12.0.0
2424
| `reset_alternatives` | Boolean | true | Whether to reset alternatives before setting |
2525
| `default` | Boolean | true | Whether to set this as the default Java |
2626
| `skip_alternatives` | Boolean | false | Skip alternatives installation completely |
27+
| `repository_uri` | String | `nil` | URI for the repository mirror to use instead of default repository URLs |
28+
| air_gap | Boolean | false | Whether to install in air-gap mode |
2729

2830
## Platform Support
2931

@@ -63,7 +65,7 @@ temurin_package_install '11' do
6365
end
6466
```
6567

66-
## Platform Support
68+
## Supported Platforms
6769

6870
This resource supports the following platforms:
6971

@@ -76,8 +78,9 @@ This resource supports the following platforms:
7678

7779
Each platform will have the appropriate Adoptium repository configured automatically.
7880

79-
## Notes
81+
## Additional Information
8082

8183
- This resource uses the Adoptium API to validate available releases.
8284
- The resource will warn if a requested version is not available as an LTS release.
8385
- For most use cases, you can simply specify the major version number.
86+
- Air-gap mode disables version checking via the Adoptium API and instead uses the version specified in the `pkg_version` property.

resources/openjdk_pkg_install.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@
2222
default: 1062,
2323
description: 'Alternatives priority to set for this Java'
2424

25+
property :repository_uri, String,
26+
description: 'URI for the repository mirror (e.g., "https://custom-mirror.example.com/openjdk/ubuntu")'
27+
2528
use 'partial/_common'
2629
use 'partial/_linux'
2730
use 'partial/_openjdk'
2831

2932
action :install do
3033
if platform?('ubuntu')
3134
apt_repository 'openjdk-r-ppa' do
32-
uri 'ppa:openjdk-r'
35+
uri new_resource.repository_uri || 'ppa:openjdk-r'
3336
end
3437
end
3538

resources/openjdk_source_install.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
property :url, String,
1111
default: lazy { default_openjdk_url(version, variant) },
12-
description: 'The URL to download from'
12+
description: 'The URL to download from. Can be an internal mirror URL (e.g., "https://internal-mirror.example.com/java/openjdk/").'
1313

1414
property :checksum, String,
1515
regex: /^[0-9a-f]{32}$|^[a-zA-Z0-9]{40,64}$/,

resources/temurin_package_install.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,15 @@ def default_temurin_pkg_name(version)
2727
default: lazy { default_bin_cmds(version) },
2828
description: 'A list of bin_cmds based on the version'
2929

30+
property :repository_uri, String,
31+
description: 'URI for the repository mirror (e.g., "https://custom-mirror.example.com/artifactory/deb")'
32+
3033
use 'partial/_common'
3134
use 'partial/_linux'
3235

3336
action :install do
3437
apt_repository 'adoptium' do
35-
uri 'https://packages.adoptium.net/artifactory/deb'
38+
uri new_resource.repository_uri || 'https://packages.adoptium.net/artifactory/deb'
3639
components ['main']
3740
distribution lazy { node['lsb']['codename'] || node['debian']['distribution_codename'] }
3841
# TODO: https://github.com/chef/chef/pull/15043
@@ -45,7 +48,7 @@ def default_temurin_pkg_name(version)
4548

4649
yum_repository 'adoptium' do
4750
description 'Eclipse Adoptium'
48-
baseurl value_for_platform(
51+
baseurl new_resource.repository_uri || value_for_platform(
4952
'amazon' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/amazonlinux/2/$basearch' },
5053
'centos' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/centos/$releasever/$basearch' },
5154
'fedora' => { 'default' => 'https://packages.adoptium.net/artifactory/rpm/fedora/$releasever/$basearch' },
@@ -63,7 +66,7 @@ def default_temurin_pkg_name(version)
6366

6467
zypper_repository 'adoptium' do
6568
description 'Eclipse Adoptium'
66-
baseurl 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch'
69+
baseurl new_resource.repository_uri || 'https://packages.adoptium.net/artifactory/rpm/opensuse/$releasever/$basearch'
6770
gpgcheck true
6871
gpgkey 'https://packages.adoptium.net/artifactory/api/gpg/key/public'
6972
action :create

test/integration/temurin_mirror/inspec.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)