Skip to content

Commit fd0d121

Browse files
authored
Chainguard Repository for Java (#3316)
[ ] Check if this is a typo or other quick fix and ignore the rest :) ## Type of change Update existing docs for Chainguard Repository support for Java libraries ### What should this PR do? Add content about Java to Chainguard Repository content: - Move general fallback/policy content into the Libraries overview and link to it from other pages - Update the chainguard-repository/overview page to include Java - Mention Chainguard Repository in the Java overview and in Build Config - Reframe the Java Global Config page to say Chainguard Repository is the recommended config ### Why are we making this change? Product update to support Chainguard Repository for Java ### What are the acceptance criteria? Java should be mentioned in content about Chainguard Repository, content should be clear and accurate ### How should this PR be tested? Review the deploy preview to ensure that content appears as expected --------- Signed-off-by: s-stumbo <sally.stumbo@chainguard.dev> Signed-off-by: s-stumbo <100295939+s-stumbo@users.noreply.github.com>
1 parent 54a2c44 commit fd0d121

10 files changed

Lines changed: 220 additions & 174 deletions

File tree

content/chainguard/chainguard-repository/overview.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ As of this writing, the Chainguard Repository contains the following artifact ty
2121
| Artifact type | Description |
2222
| ----- | ----- |
2323
| [Chainguard Libraries for JavaScript](/chainguard/libraries/javascript/overview/) | Open source language dependencies rebuilt from source for JavaScript (npm). |
24+
| [Chainguard Libraries for Java](/chainguard/libraries/java/overview/) | Open source language dependencies rebuilt from source for Java (Maven). |
2425

2526
## Endpoints
2627

2728
Each artifact type is accessible via its own endpoint:
2829

2930
| Artifact type | Endpoint |
3031
| ----- | ----- |
31-
| Libraries for JavaScript | `libraries.cgr.dev/javascript` |
32+
| Libraries for [JavaScript](/chainguard/libraries/javascript/overview/) | `https://libraries.cgr.dev/javascript/` |
33+
| Libraries for [Java](/chainguard/libraries/java/overview/) | `https://libraries.cgr.dev/java/` |
3234

3335
See each artifact type's documentation for authentication and configuration details.
3436

@@ -74,5 +76,6 @@ Access the Console at [console.chainguard.dev](https://console.chainguard.dev).
7476

7577
## Learn more
7678

77-
* [Chainguard Repository for JavaScript Libraries](/chainguard/libraries/chainguard-repository/)
79+
* [Chainguard Libraries for JavaScript](/chainguard/libraries/javascript/overview/)
80+
* [Chainguard Libraries for Java](/chainguard/libraries/java/overview/)
7881

content/chainguard/libraries/access.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ system. This guide explains how to access (download) Chainguard library artifact
2424

2525
- Ensure you have access to Chainguard Libraries.
2626
- If you are not a Chainguard user yet, a new Chainguard account must be
27-
created and configured for access to Chainguard Libraries.
28-
- If you are already a Chainguard user, the Chainguard account owner in your
29-
organization can grant access to Chainguard Libraries.
27+
created and you must [add an entitlement to Chainguard Libraries](/chainguard/libraries/access/#manage-library-entitlements).
3028
- Confirm the name of your organization so you can use it with the `--parent`
3129
parameter to specify your organization when running commands with `chainctl`.
3230

content/chainguard/libraries/browse.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ The list includes the following columns:
5050

5151
At the bottom of the page, see a total count of available libraries.
5252

53-
As a part of Chainguard Repository, [upstream fallback and policy controls](/chainguard/libraries/javascript/overview/#upstream-fallback-policy-and-controls) are available for Chainguard Libraries for JavaScript. When fallback is configured for your organization, you will see all packages including those built by Chainguard and those that are mirrored from upstream npm. For a given package, you can see whether it is being served from Chainguard's rebuilt artifacts or proxied from upstream npm.
53+
As a part of Chainguard Repository, [upstream fallback and policy controls](/chainguard/libraries/overview/#upstream-fallback-and-controls) are available for Chainguard Libraries and can be enabled via `chainctl` commands. For JavaScript, you can also enable upstream fallback in the Chainguard Console.
54+
55+
When fallback is configured for your organization, you will see all JavaScript packages -- including those built by Chainguard and those that are mirrored from upstream npm -- in the Console. For a given package, you can see whether it is being served from Chainguard's rebuilt artifacts or proxied from upstream npm. For Java and Python, you cannot currently view upstream vs. Chainguard-built packages via the Chainguard Console.
5456

5557
<a id="search"></a>
5658

content/chainguard/libraries/java/build-configuration.md

Lines changed: 44 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ other engineers running relevant application builds. They must also be performed
3535
on any build server such as Jenkins, TeamCity, GitHub or other infrastructure
3636
that builds the applications or otherwise downloads and uses relevant libraries.
3737

38+
The `https://libraries.cgr.dev/java/` endpoint is also the [Chainguard Repository](/chainguard/chainguard-repository/overview/) endpoint for Java. By default, it serves only Chainguard-built artifacts. When [upstream fallback](/chainguard/libraries/overview/#upstream-fallback-and-controls) is enabled for your organization, the same endpoint can also serve requested versions from Maven Central under Chainguard security controls.
39+
3840
## Library access approaches
3941

4042
### Repo manager
@@ -284,25 +286,27 @@ Java.
284286
#### Configure direct access
285287

286288
If you are not using a repository manager at your organization, you can
287-
configure access to the Chainguard Libraries for Java repository directly.
288-
Ensure that the Chainguard repository is located above the necessary override
289-
for the built-in `central` repository and any other repositories. If you are participating in the beta for CVE remediation, include the `https://libraries.cgr.dev/java-remediated/` repository first.
289+
configure access to the Chainguard Libraries for Java repository directly. If [upstream fallback](/chainguard/libraries/overview/#upstream-fallback-and-controls) is enabled for your organization, the `https://libraries.cgr.dev/java/` repository can serve both Chainguard-built artifacts and eligible upstream Maven Central artifacts through the same endpoint. If upstream fallback is not enabled, continue to configure Maven Central or your Maven Central proxy after the Chainguard repository, as shown in the following example.
290+
291+
If you are participating in the beta for CVE remediation, include the `https://libraries.cgr.dev/java-remediated/` repository first.
292+
293+
If you are using direct access with the Chainguard Repository and you want Chainguard policy controls to apply consistently, configure Chainguard as a global Maven mirror. Without a global mirror, Maven can fall back to its built-in Maven Central definition when Chainguard reports a dependency as unavailable, bypassing the policy and malware scanning controls provided by Chainguard.
290294

291295
The following `~/.m2/settings.xml` configures direct access with Chainguard's remediated Java repository as
292-
the primary repository, falling back to the standard Chainguard Libraries repository when a remediated version is not available, and then to Maven Central as a fallback for transitive
293-
dependencies not available from Chainguard. It uses placeholder values
294-
`CG_PULLTOKEN_USERNAME` and `CG_PULLTOKEN_PASSWORD` or [environment
296+
the primary repository, falling back to the standard Chainguard Libraries repository when a remediated version is not available. If a library is not yet built by Chainguard and you have enabled upstream fallback, then upstream packages will be subject to malware scanning and any cooldown policies you have configured. This settings file uses [environment
295297
variables](/chainguard/libraries/access/#env) for the pull token detailed in
296-
[Chainguard Libraries access](/chainguard/libraries/access/):
298+
[Chainguard Libraries access](/chainguard/libraries/access/).
297299

298300
```xml
299301
<settings>
300302
<activeProfiles>
301-
<activeProfile>no-repo-manager</activeProfile>
303+
<activeProfile>chainguard</activeProfile>
302304
</activeProfiles>
305+
303306
<profiles>
304307
<profile>
305-
<id>no-repo-manager</id>
308+
<id>chainguard</id>
309+
306310
<repositories>
307311
<repository>
308312
<id>chainguard-remediated</id>
@@ -311,7 +315,7 @@ variables](/chainguard/libraries/access/#env) for the pull token detailed in
311315
<snapshots><enabled>false</enabled></snapshots>
312316
</repository>
313317
<repository>
314-
<id>chainguard</id>
318+
<id>chainguard-java</id>
315319
<url>https://libraries.cgr.dev/java/</url>
316320
<releases>
317321
<enabled>true</enabled>
@@ -322,39 +326,45 @@ variables](/chainguard/libraries/access/#env) for the pull token detailed in
322326
</repository>
323327
<repository>
324328
<id>central</id>
325-
<url>https://repo1.maven.org/maven2/</url>
326-
<releases>
327-
<enabled>true</enabled>
328-
</releases>
329-
<snapshots>
330-
<enabled>false</enabled>
331-
</snapshots>
329+
<url>invalid</url>
330+
<releases><enabled>true</enabled></releases>
331+
<snapshots><enabled>false</enabled></snapshots>
332332
</repository>
333333
</repositories>
334+
334335
<pluginRepositories>
335336
<pluginRepository>
336-
<id>chainguard</id>
337+
<id>chainguard-java-remediated</id>
338+
<url>https://libraries.cgr.dev/java-remediated/</url>
339+
<releases><enabled>true</enabled></releases>
340+
<snapshots><enabled>false</enabled></snapshots>
341+
</pluginRepository>
342+
<pluginRepository>
343+
<id>chainguard-java</id>
337344
<url>https://libraries.cgr.dev/java/</url>
338-
<releases>
339-
<enabled>true</enabled>
340-
</releases>
341-
<snapshots>
342-
<enabled>false</enabled>
343-
</snapshots>
345+
<releases><enabled>true</enabled></releases>
346+
<snapshots><enabled>false</enabled></snapshots>
344347
</pluginRepository>
345348
<pluginRepository>
346349
<id>central</id>
347-
<url>https://repo1.maven.org/maven2/</url>
348-
<releases>
349-
<enabled>true</enabled>
350-
</releases>
351-
<snapshots>
352-
<enabled>false</enabled>
353-
</snapshots>
350+
<url>invalid</url>
351+
<releases><enabled>true</enabled></releases>
352+
<snapshots><enabled>false</enabled></snapshots>
354353
</pluginRepository>
354+
355355
</pluginRepositories>
356356
</profile>
357357
</profiles>
358+
359+
<mirrors>
360+
<mirror>
361+
<id>chainguard</id>
362+
<name>Chainguard Mirror</name>
363+
<url>https://libraries.cgr.dev/java/</url>
364+
<mirrorOf>*</mirrorOf>
365+
</mirror>
366+
</mirrors>
367+
358368
<servers>
359369
<server>
360370
<id>chainguard-remediated</id>
@@ -364,7 +374,7 @@ variables](/chainguard/libraries/access/#env) for the pull token detailed in
364374
<!-- <username>YOUR_IDENTITY_ID</username> -->
365375
<!-- <password>YOUR_TOKEN</password> -->
366376
</server>
367-
<id>chainguard</id>
377+
<id>chainguard-java</id>
368378
<!-- Use environment variables -->
369379
<username>${env.CHAINGUARD_JAVA_IDENTITY_ID}</username>
370380
<password>${env.CHAINGUARD_JAVA_TOKEN}</password>
@@ -380,6 +390,8 @@ is configured. Alternatively you can add the `repositories` and
380390
`pluginRepositories` to individual project `pom.xml` files. Authentication
381391
details must remain within the settings file.
382392

393+
If your `settings.xml` is using credentials set as environment variables, ensure the variables are exported.
394+
383395
### Minimal example project
384396

385397
Use the following steps to create a minimal example project for Maven with Chainguard Libraries for Java. For testing purposes, you can use direct access and environment variables as

content/chainguard/libraries/java/global-configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,3 +445,4 @@ Use the URL of the repository group, such as
445445
configuration](/chainguard/libraries/java/build-configuration/) and build a
446446
first test project. In a working setup the `java-chainguard` proxy repository contains
447447
all libraries retrieved from Chainguard.
448+

0 commit comments

Comments
 (0)