Compare commits

..

2 Commits

Author SHA1 Message Date
bot-githubaction 8a24b30373 [bot] Update dist directory 2026-06-26 22:02:33 +00:00
Daz DeBoer bc54cf57d1 Support repo-registration as a second enablement path for project-entry caching
Configuration-cache store/restore is now enabled when EITHER a valid Develocity
JWT OR per-repo registration (a GitHub App installation that accepted the T&C) is
present. The gate itself lives in the vendored gradle-actions-caching library
(refreshed to 0.9.1); this repo wires up the reporting and notice.

- ProjectCacheStatus: 'trial-not-licensed' -> 'not-registered'.
- caching-report: render the 'not-registered' line with a /register link, and add
  renderProjectCacheNotice() for a prominent core.notice.
- setup-gradle: emit the notice from complete() only when withheld via the
  registration path; quiet when enabled by either path.
- Refresh vendored gradle-actions-caching to 0.9.1.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-26 16:01:43 -06:00
18 changed files with 517 additions and 460 deletions
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=bbaeb2fef8710818cf0e261201dab964c572f92b942812df0c3620d62a529a01
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.0-bin.zip
distributionSha256Sum=bafc141b619ad6350fd975fc903156dd5c151998cc8b058e8c1044ab5f7b031f
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500
@@ -20,7 +20,7 @@
##############################################################################
#
# gradlew start up script for POSIX generated by Gradle.
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
@@ -29,7 +29,7 @@
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh gradlew
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
@@ -19,7 +19,7 @@
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem gradlew startup script for Windows
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@@ -72,7 +72,7 @@ echo location of your Java installation. 1>&2
@rem Execute gradlew
@rem Execute Gradle
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+118 -118
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+92 -92
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+129 -129
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -32,9 +32,9 @@ export type CacheCleanupStatus =
export type ProjectCacheStatus =
| 'not-enabled' // the hidden opt-in env var was not set (rendered as nothing)
| 'trial-expired' // past the hard trial expiry
| 'trial-not-licensed' // Develocity trial token missing or invalid
| 'not-registered' // neither entitlement path satisfied (no Develocity trial token, repo not registered)
| 'no-encryption-key' // Cannot store due to missing encryption key
| 'enabled' // Trial in effect: will attempt to save project state
| 'enabled' // Entitled: will attempt to save project state
export interface CacheEntryReport {
entryName: string
+18 -1
View File
@@ -2,6 +2,7 @@ import {CacheCleanupStatus, CacheEntryReport, CacheReport, CacheStatus, ProjectC
const DOCS = 'https://github.com/gradle/actions/blob/main/docs/setup-gradle.md'
const DISTRIBUTION = 'https://github.com/gradle/actions/blob/main/DISTRIBUTION.md'
const REGISTER = 'https://gradle-actions-caching-registration.vercel.app/register'
/**
* Identifies the caching provider in use, so the report can attribute the cache
@@ -31,7 +32,7 @@ const CLEANUP_COPY: Record<CacheCleanupStatus, string> = {
const PROJECT_CACHE_COPY: Record<ProjectCacheStatus, string> = {
'not-enabled': ``,
'trial-expired': `Project state (build-logic and configuration cache) was not cached - the Develocity caching trial has expired.`,
'trial-not-licensed': `Project state (build-logic and configuration cache) was not cached - a develocity-access-key and develocity-server-url is required.`,
'not-registered': `Project state (build-logic and configuration cache) was not cached - this repository is not registered for advanced caching. [Register this repository](${REGISTER}), or provide a \`develocity-access-key\` and \`develocity-server-url\`.`,
'no-encryption-key': `Project state (build-logic and configuration cache) was not cached - a [cache-encryption-key](${DOCS}#cache-encryption-key) is required.`,
enabled: `Caching of project state (build-logic and configuration cache) was enabled.`
}
@@ -82,6 +83,22 @@ function renderProjectCacheLine(projectCache?: ProjectCacheStatus): string | und
return projectCache ? PROJECT_CACHE_COPY[projectCache] : undefined
}
/**
* A plain-text log notice (no markdown) surfaced when advanced caching was withheld because the
* repository is not registered. Returns `undefined` for every other status, so callers stay quiet
* when the feature is enabled, disabled, or simply not opted in.
*/
export function renderProjectCacheNotice(projectCache?: ProjectCacheStatus): string | undefined {
if (projectCache !== 'not-registered') {
return undefined
}
return (
'Advanced caching (build-logic and configuration cache) was not enabled: this repository ' +
`is not registered. Register it at ${REGISTER}, or provide a develocity-access-key and ` +
'develocity-server-url.'
)
}
function renderProviderNote(providerNote?: ProviderNote): string | undefined {
if (!providerNote) {
return undefined
+9
View File
@@ -9,6 +9,7 @@ import {setupToken} from './develocity/short-lived-token'
import {loadBuildResults, markBuildResultsProcessed} from './build-results'
import {getCacheService, getProviderNote} from './cache-service-loader'
import {renderProjectCacheNotice} from './caching-report'
import {CacheOptions} from './cache-service'
import {
DevelocityConfig,
@@ -85,6 +86,14 @@ export async function complete(
buildResults,
cacheOptionsFrom(cacheConfig, develocityServerUrl, cacheToken)
)
// Surface a prominent notice (with the /register link) only when advanced caching was withheld
// because the repo is not registered; stay quiet when enabled by either path.
const registrationNotice = renderProjectCacheNotice(cacheReport.projectCache)
if (registrationNotice) {
core.notice(registrationNotice)
}
await jobSummary.generateJobSummary(buildResults, cacheReport, getProviderNote(cacheConfig), summaryConfig)
markBuildResultsProcessed()
+32 -1
View File
@@ -1,7 +1,7 @@
import {describe, expect, it} from '@jest/globals'
import {CacheReport} from '../../src/cache-service'
import {renderCachingReport} from '../../src/caching-report'
import {renderCachingReport, renderProjectCacheNotice} from '../../src/caching-report'
const ENHANCED = {kind: 'enhanced'} as const
const BASIC = {kind: 'basic'} as const
@@ -114,6 +114,20 @@ describe('renderCachingReport', () => {
expect(md).not.toContain('Project state')
})
it('renders the not-registered status with a /register link inside the details', () => {
const report: CacheReport = {
status: 'enabled',
cleanup: 'enabled',
projectCache: 'not-registered',
entries: [entry()]
}
const md = renderCachingReport(report, ENHANCED)
const detailsBody = md.slice(md.indexOf('</summary>'))
expect(detailsBody).toContain('not registered for advanced caching')
expect(detailsBody).toContain('/register')
})
it('renders a compact disabled report with no note and no details', () => {
const report: CacheReport = {status: 'disabled', entries: []}
const md = renderCachingReport(report, undefined)
@@ -143,3 +157,20 @@ describe('renderCachingReport', () => {
expect(md).not.toContain('<details>')
})
})
describe('renderProjectCacheNotice', () => {
it('returns a notice with the /register link for the not-registered status', () => {
const notice = renderProjectCacheNotice('not-registered')
expect(notice).toBeDefined()
expect(notice).toContain('not registered')
expect(notice).toContain('/register')
})
it('is silent for every other status', () => {
expect(renderProjectCacheNotice('enabled')).toBeUndefined()
expect(renderProjectCacheNotice('not-enabled')).toBeUndefined()
expect(renderProjectCacheNotice('trial-expired')).toBeUndefined()
expect(renderProjectCacheNotice('no-encryption-key')).toBeUndefined()
expect(renderProjectCacheNotice(undefined)).toBeUndefined()
})
})
+3 -3
View File
@@ -56,12 +56,12 @@ export declare type CacheStatus = 'enabled' | 'read-only' | 'write-only' | 'disa
/**
* Status of project-entry caching (build-logic artifacts + configuration-cache data) for a run.
* The first three are set on restore (always ungated); the rest are set on save and reflect the
* two-tier gate (opt-in + Develocity trial, then encryption key + Gradle version). Still beta.
* Set as the gate is evaluated: opt-in, then trial expiry, then entitlement (Develocity trial
* license OR repo registration), then encryption key. Still beta.
*
* @public
*/
declare type ProjectCacheStatus = 'not-enabled' | 'trial-expired' | 'trial-not-licensed' | 'no-encryption-key' | 'enabled';
declare type ProjectCacheStatus = 'not-enabled' | 'trial-expired' | 'not-registered' | 'no-encryption-key' | 'enabled';
/** @public */
export declare function restore(gradleUserHome: string, cacheOptions: CacheOptions): Promise<void>;
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "gradle-actions-caching",
"version": "0.9.0",
"version": "0.9.1",
"type": "module",
"main": "./index.js",
"types": "./index.d.ts",