Commit graph

149 commits

Author SHA1 Message Date
daz
54f7dc55a5
Adapt for new structure of build results 2024-07-18 22:25:58 -06:00
daz
579a013225
Capture config-cache hit in build results 2024-07-18 22:25:58 -06:00
daz
94355bbb2f
Split build-results and build-scan capture into separate files 2024-07-18 22:25:58 -06:00
daz
6d20c16462
Use settingsEvaluated in preference to projectsEvaluated in init-script 2024-07-18 22:25:53 -06:00
daz
72dde7ef1e
Move action entry-point sources 2024-07-18 11:09:54 -06:00
daz
27dea2df09
Allow better control over cache-cleanup
Adds new 'cache-cleanup' parameter with 3 settings: 'never', 'on-success' and 'always'.
This gives users more control over whether cache cleanup should occur.

Fixes #71
2024-07-17 20:36:33 -06:00
daz
91a526b647
Refactor BuildResults 2024-07-17 20:35:14 -06:00
daz
d92de28b80
Improve cache reporting
- More succinct messages for cache-read-only and cache-disabled
- Report on cache-cleanup enabled/disabled status
2024-07-17 20:29:57 -06:00
daz
8d318190ad
Add better explanation for cache status
- Clarify default settings for cache-read-only
- Explain why cache was disabled or read-only
- Provide links to documentation in Job Summary

Fixes #255
2024-07-17 15:17:09 -06:00
daz
bb7a843511
Reset dependency-graph after submission
Fixes #204
2024-07-16 21:15:51 -06:00
daz
22818445b3
Restrict download-and-submit to selected file 2024-07-16 21:15:29 -06:00
Daz DeBoer
dff3ef9b8d
Only fetch checksums for unknown wrapper versions (#292)
The checksum values for most wrapper versions are hard-coded into the
action. These known checksum values are first used for validation: only
if none of the known values work do we download checksums.

Previously, we blindly downloaded all of the checksum values in this
case: we now only download the checksums for versions that are not in
our "known" set.

Fixes #171
2024-07-16 13:04:57 -06:00
Daz DeBoer
ff865cb801
Upload dependency graph on submission failure (#291) 2024-07-15 12:47:06 -06:00
github-actions[bot]
6407986e96
Update known wrapper checksums (#278)
Automatically generated pull request to update the known wrapper
checksums.

Co-authored-by: bigdaz <179734+bigdaz@users.noreply.github.com>
2024-07-12 11:29:43 -06:00
daz
621f3b3f79
Run cache-cleanup build with --info
Resolves #169
2024-06-28 13:25:56 -06:00
daz
95ef72241e
Use Gradle 8.8 features for cleanup
Gradle 8.8 introduces new features that allow us to avoid using
timestamp manipulation to force the cleanup of the Gradle User Home directory.

This solution is simpler and more robust, but relies on Gradle 8.8+ always being
used for the cache cleanup operation.

Fixes #24
2024-06-28 13:06:23 -06:00
daz
169bec5d8b
Provision latest Gradle for cache-cleanup
To cleanup Gradle User Home, a Gradle build must be executed.
Newer Gradle versions are able to cleanup the home directories of older versions,
but not vice-versa.

With this change, the latest version of Gradle is automatically provisioned
in order to run Gradle User Home cleanup. This ensures a consistent version of
Gradle is used for cleanup, and fixes #33 where Gradle is not pre-installed on
a custom runner.
2024-06-28 12:39:09 -06:00
Daz DeBoer
b9abb7b195
Use latest dependency graph plugin (#269)
Some checks are pending
CI-check-and-unit-test / check-format-and-unit-test (push) Waiting to run
CI-codeql / Analyze (javascript-typescript) (push) Waiting to run
CI-init-script-check / test-init-scripts (push) Waiting to run
CI-integ-test / wrapper-validation (push) Blocked by required conditions
CI-integ-test / determine-suite (push) Waiting to run
CI-integ-test / build-distribution (push) Blocked by required conditions
CI-integ-test / action-inputs (push) Blocked by required conditions
CI-integ-test / build-scan-publish (push) Blocked by required conditions
CI-integ-test / cache-cleanup (push) Blocked by required conditions
CI-integ-test / caching-config (push) Blocked by required conditions
CI-integ-test / dependency-graph (push) Blocked by required conditions
CI-integ-test / dependency-submission (push) Blocked by required conditions
CI-integ-test / dependency-submission-failures (push) Blocked by required conditions
CI-integ-test / execution-with-caching (push) Blocked by required conditions
CI-integ-test / execution (push) Blocked by required conditions
CI-integ-test / develocity-injection (push) Blocked by required conditions
CI-integ-test / provision-gradle-versions (push) Blocked by required conditions
CI-integ-test / restore-configuration-cache (push) Blocked by required conditions
CI-integ-test / restore-containerized-gradle-home (push) Blocked by required conditions
CI-integ-test / restore-custom-gradle-home (push) Blocked by required conditions
CI-integ-test / restore-gradle-home (push) Blocked by required conditions
CI-integ-test / restore-java-toolchain (push) Blocked by required conditions
CI-integ-test / sample-kotlin-dsl (push) Blocked by required conditions
CI-integ-test / sample-gradle-plugin (push) Blocked by required conditions
CI-integ-test / toolchain-detection (push) Blocked by required conditions
CI-update-dist / update-dist (push) Waiting to run
2024-06-27 19:42:01 -06:00
bigdaz
3f3913eed0 Update known wrapper checksums 2024-06-27 14:11:23 -06:00
Alexis Tual
bdc7162ff9
Forward the setup short-lived token Promise
This caused a race condition not allowing the short-lived token to be returned in time before the setup finished.
2024-06-17 19:03:10 +02:00
Daz DeBoer
719985db3d
Simplify requesting short-lived Develocity access tokens (#259)
- Always fetch a token for every hostname in the access key
- Use any tokens that are successfully fetched
- Retain access key if no tokens can be fetched
2024-06-14 21:18:08 -06:00
Inaki Villar
5f1c5827bf handle missing access token 2024-06-14 16:44:06 -06:00
daz
8dbe9a3802 Update DV access key regex to be more selective
This should address the code-scanning alert
  https://github.com/gradle/actions/security/code-scanning/1
2024-06-13 13:35:19 -06:00
daz
30c82f0068 Fail on invalid boolean for Develocity inputs 2024-06-13 13:31:25 -06:00
Iñaki Villar
d0a116fff5
Adding Develocity input actions (#244)
Adding Develocity input actions. 

If an input is configured in the action, it will generate the environment variable, example:

```yaml
    - name: Setup Gradle
      uses: gradle/actions/setup-gradle@v3
      with:
        develocity-injection-enabled: true
        develocity-url: https://develocity.your-server.com
        develocity-plugin-version: 3.17.4

    - name: Run a Gradle build with Develocity injection enabled from input actions
      run: ./gradlew build
```

This configuration will create the environment variables:
```
DEVELOCITY_INJECTION_ENABLED=true
DEVELOCITY_URL=https://develocity.your-server.com
DEVELOCITY_PLUGIN_VERSION=3.17.4
```

Relation variable-input available:

| Variable | Input |

|--------------------------------------|--------------------------------------|
| DEVELOCITY_INJECTION_ENABLED | develocity-injection-enabled |
| DEVELOCITY_URL | develocity-url |
| DEVELOCITY_ALLOW_UNTRUSTED_SERVER | develocity-allow-untrusted-server
|
| DEVELOCITY_CAPTURE_FILE_FINGERPRINTS |
develocity-capture-file-fingerprints |
| DEVELOCITY_ENFORCE_URL | develocity-enforce-url |
| DEVELOCITY_PLUGIN_VERSION | develocity-plugin-version |
| DEVELOCITY_CCUD_PLUGIN_VERSION | develocity-ccud-plugin-version |
| GRADLE_PLUGIN_REPOSITORY_URL | gradle-plugin-repository-url |
| GRADLE_PLUGIN_REPOSITORY_USERNAME | gradle-plugin-repository-username
|
| GRADLE_PLUGIN_REPOSITORY_PASSWORD | gradle-plugin-repository-password
|
2024-06-13 12:42:47 -06:00
bot-githubaction
1d2ea6e5a8 Bump references to Develocity Gradle plugin from 3.17.4 to 3.17.5 2024-06-13 10:01:04 -06:00
bigdaz
d1cd62d80a Update known wrapper checksums 2024-06-13 07:40:03 -06:00
Bot Githubaction
30610bc983
Bump references to Develocity Gradle plugin from 3.17.3 to 3.17.4 (#236)
This PR bumps references to Develocity Gradle plugin from 3.17.3 to 3.17.4.

---------

Co-authored-by: Eric Haag <ehaag@gradle.com>
2024-05-23 08:56:09 -06:00
Alexis Tual
96b9cb4988
Set both DEVELOCITY_ACCESS_KEY and GRADLE_ENTERPRISE_ACCESS_KEY env vars (#225)
Follow up of https://github.com/gradle/actions/pull/224, we now attempt to set both old and new access key env variables to a short lived token.
If a short-lived token cannot be obtained, then:
- DEVELOCITY_ACCESS_KEY is set to an empty string, preventing this from being used.
- GRADLE_ENTERPRISE_ACCESS_KEY is left intact, with a deprecation warning being issued.
2024-05-17 15:07:50 -06:00
Bot Githubaction
db270b9337 Update develocity-injection init script to v1.0
Updates the develocity-injection init script to the latest reference script content
from https://github.com/gradle/develocity-ci-injection.
2024-05-17 14:18:19 -06:00
Bot Githubaction
d91e2960eb Update develocity-injection init script to v0.5.1
Updates the develocity-injection init script to the latest reference script content
from https://github.com/gradle/develocity-ci-injection.
2024-05-17 11:10:27 -06:00
bigdaz
0498421560 Update develocity-injection init script to v0.5.0 2024-05-17 07:27:33 -06:00
bigdaz
edb13383f3 Update develocity-injection init script to v0.4.0 2024-05-15 16:56:41 -06:00
Alexis Tual
500e0ee5b3
Add support for short-lived tokens (#224)
The setup-gradle action tries to get a short-lived access token given the supplied Develocity access key.
This key can be passed either with the `DEVELOCITY_ACCESS_KEY` env var or via the  `develocity-access-key` input parameter.
If a token can be retrieved, then the `DEVELOCITY_ACCESS_KEY` env var will be set to the token. 
Otherwise the `DEVELOCITY_ACCESS_KEY` will be set to a blank string, to avoid a leak.

---------

Co-authored-by: daz <daz@gradle.com>
2024-05-15 16:49:55 -06:00
Daz DeBoer
ea14aa9caf
Dependency updates (#222)
- Bump to com.gradle.develocity plugin v3.17.3
- Bump JVM dependencies in sample projects
2024-05-11 07:45:47 -06:00
bigdaz
da512b52a5 Update known wrapper checksums 2024-04-28 15:49:59 +01:00
Daz DeBoer
bce7daca54
Improve build scan badge readability with long tasks (#200)
Improve readability of build scan when requested tasks is very long, as
agreed in #175. HTML diff for each case of job summary is clearer in
cd62d9c9ef.

- Ensure a minimum size for the badge, at least the size of "Build
scan®", by preventing a line break with `&nbsp;`
- Reduce the size of the badge by tweaking the inner text

Also fix a typo in the build shell script.
2024-04-25 21:22:36 +01:00
Gabriel Feo
cd62d9c9ef Improve job summary readability with long tasks
Change tests for nbsp and concise badge

Make tests pass

Signed-off-by: Gabriel Feo <gabriel@gabrielfeo.com>
2024-04-25 19:40:04 +01:00
Gabriel Feo
a54fb6a5bb Add tests on current job-summary behavior
Signed-off-by: Gabriel Feo <gabriel@gabrielfeo.com>
2024-04-25 17:44:41 +01:00
daz
7763d71170 Set the report dir for download-and-submit
Fixes #196
2024-04-25 11:19:43 +01:00
daz
d124ec149f Retain and log stacktrace for submission errors 2024-04-19 10:24:45 -06:00
Alex Serbin
6ccde15122
Use logger in dependency graph init script (#191)
Dependency graph init script now uses Gradle logger to emit warning/info messages.
This allows these messages to be suppressed using `--quiet`.
2024-04-19 07:03:17 -06:00
Daz DeBoer
c198d84863
Support custom report dir for dependency-submission (#189)
If the `DEPENDENCY_GRAPH_REPORT_DIR` var is set, use this value when locating dependency-graph files to upload/submit.

Fixes #188
2024-04-18 13:40:41 -06:00
daz
eef9b10930 Bump Develocity and CCUD plugin versions 2024-04-17 19:08:51 -06:00
daz
6d55902761 Deprecate 'wrapper-validation-action'
Deprecation warning will be emitted when we:
- Change 'wrapper-validation-action' to delegate to 'actions/wrapper-validation'
- Add the 'wrapper-validation-action' id as env var before delegating
2024-04-12 10:34:50 -06:00
daz
feb10e7858
Minor formatting fix 2024-04-12 00:39:23 -06:00
daz
b855ea8d07
Revert inconsequential change 2024-04-11 22:55:22 -06:00
daz
3e6b0e422f
Inconsequential change 2024-04-11 22:47:10 -06:00
daz
713dee76c6 Update extracted cache entries for Gradle 8.6+
- Extracted transform jars for newer Gradle versions 8.6+
- Extracted `groovy-dsl` which was introduced in Gradle 8.7

Fixes #45
2024-04-11 14:04:25 -06:00
daz
62557f3635
Enable wrapper validation with setup-gradle action 2024-04-11 11:56:55 -06:00
daz
ea328a863d
Update documentation link 2024-04-11 10:23:52 -06:00
daz
ba79f71e36
Consolidate error processing in actions 2024-04-11 10:19:53 -06:00
daz
f1476a710d
Initial import of wrapper-validation-action 2024-04-10 21:17:49 -06:00
Philip Wedemann
0f427bc07b
Add a test for merging existing toolchains.xml (#151) 2024-04-10 17:20:36 -06:00
Daz DeBoer
e21decc9db
Create toolchains.xml dynamically based on envs (#150)
Different runners have different JDKs installed, so using a hard-coded
list for
`toolchains.xml` doesn't work. With this change, the file is generated
based on the available `JAVA_HOME_*` environment variables.

Fixes #89 

Thanks @hfhbd for the contribution!

Co-authored-by: hfhbd <22521688+hfhbd@users.noreply.github.com>
2024-04-10 12:25:22 -06:00
daz
aeb3156e6f
Emit deprecation warning for 'gradle-build-action' 2024-04-09 15:30:42 -06:00
daz
7e9e469530
Rename 'input-params' to 'configuration' 2024-04-09 15:08:54 -06:00
daz
9d0de74673
Emit deprecation warnings for derecated inputs
- Adds an upgrade-guide to assist with resolving deprecations
- Emit a warning when deprecated features are used
- List all deprecated features in Job Summary and link to upgrade guide
2024-04-09 15:03:03 -06:00
daz
92975d7f32
Allow a task name to be specified for dependency-submission
Fixes: #125
2024-04-09 08:46:20 -06:00
Daz DeBoer
e235596c88
Only process build results once (#133)
On long-lived machines, it's possible that the `.build-results` directory isn't cleared between invocations. This will result in the job summary including results from previous jobs.

By marking each build-results file as 'processed' at the end of the job, we can avoid this scenario.
2024-04-08 19:44:46 -06:00
daz
498f0e409b
Update cache key names
- All cache keys are now structured as 'gradle-<cache-name>-<protocol-version>
  - This ensures that extracted entries are prefixed and versioned consistently
- Avoid using custom cache-key prefix for extracted entries. This should reduce the
  churn in integration tests that require some level of cache isolation.
2024-04-08 15:14:28 -06:00
daz
3335c16182
Move execution-related code into subpackage 2024-04-08 14:04:29 -06:00
daz
528fe78d31
Moved cache-related code into subpackage 2024-04-08 14:02:20 -06:00
daz
c93523a078
Fix Develocity deprecation warnings triggered by init-scripts 2024-04-08 10:58:12 -06:00
daz
0ac212a9d2
Make it possible to run more init-script tests on M1 Mac
Older TestKit on M1 Mac doesn't allow env vars to be passed, so we need to use
jvmArgs instead.
2024-04-08 09:46:48 -06:00
daz
a9dc5dee4e
Bump to CCUD plugin v2.0 everywhere 2024-04-07 22:42:14 -06:00
daz
90bf65c87c
Generated graph is submitted immediately by dependency-submission action
While `setup-gradle` must wait until the end of job to submit all of the generated
graphs, the `dependency-submission` action will not save/upload the generated graph
immediately, in the same step where it is generated.
2024-04-07 16:57:18 -06:00
daz
38a821729e
Use consistent action params between setup-gradle and dependency-submission
To ensure expected caching (and other) behaviour, we should keep these config
parameters as consistent as possible.
2024-04-07 12:11:50 -06:00
daz
627fa7627c
Revert "Provide default config values for dependency-submission"
This reverts commit b7ef93c7b7.
2024-04-07 11:54:02 -06:00
daz
e40c718900
Only verify TOU agreement when required 2024-04-07 11:25:02 -06:00
daz
b7ef93c7b7
Provide default config values for dependency-submission 2024-04-07 11:00:34 -06:00
daz
cfd20ecc0a
Replace static config methods with config types
This will allow different entry points to have different inputs.
2024-04-07 11:00:34 -06:00
daz
ed4d086d37
Make dependency-submission and setup-gradle play nicely
Now, a `dependency-submission` step will trigger a dependency-graph
generation, even if it follows a `setup-gradle` step in the workflow.

Similarly, a `setup-gradle` step with `dependency-graph` configured
will function as expected even if it follows a `setup-gradle` step.
2024-04-06 19:31:07 -06:00
daz
ebf4d13461
Convert dependency-submission action to Typescript
Instead of being a thin wrapper over `setup-gradle`, the `dependency-submission`
action is now a fully-fledged action sharing implementation with `setup-gradle`.
2024-04-06 19:31:04 -06:00
Daz DeBoer
a5a8ae9361
Bump to v1.3.0 of the dependency-graph plugin 2024-04-04 11:34:27 -06:00
daz
518b14b196
Switch from com.gradle.enterprise to com.gradle.develocity 2024-04-03 19:05:27 -06:00
daz
195c67f931
Use Develocity plugin v3.17 for build-scan-publish 2024-04-03 14:51:01 -06:00
Pavlo Shevchenko
5a171ce5b8
Inject Develocity plugin for versions 3.17 and above (#62)
To handle the rebranding of the GE plugin, this PR updates the inject-develocity init script 
to apply the `com.gradle.develocity` plugin if `3.17+` version of the plugin is requested.
2024-04-03 14:47:50 -06:00
daz
cc54166e15 Truncate long values in job summary table
Fixes #35
2024-04-01 12:24:45 -06:00
Iurii Ignatko
c276584302
Capture task input files when plugin not applied (#77)
This PR changes the behavior such that task input files are captured
when the environment variable is explicitly specified and for the cases
when the plugin is not applied.

---------

Co-authored-by: Alexis Tual <atual@gradle.com>
2024-03-25 16:34:45 +02:00
daz
a6050d4c14 Remove redundant method implementation 2024-03-21 21:52:16 -06:00
daz
cee9fbd6e2
Bump CCUD plugin to 1.13 2024-03-12 16:13:40 +13:00
daz
7b589d9740
Apply plugin repository credentials for dependency graph plugin 2024-03-12 15:49:28 +13:00
Iurii Ignatko
e43d10f419
Add an ability to capture task input files (#58)
This PR adds an ability to enable/disable [capturing task input
files](https://docs.gradle.com/enterprise/gradle-plugin/#capturing_task_input_files)
in a build scan.

---------

Co-authored-by: Eric Haag <eah0592@gmail.com>
2024-03-06 17:53:10 +02:00
Iurii Ignatko
579fbbe722
Allow configuring credentials for custom Gradle plugin repository (#61) 2024-03-06 08:48:24 +02:00
Iurii Ignatko
f091a59e67
Change messages log level in init script 2024-03-01 12:00:19 +02:00
daz
2262487821
Use v1.2.2 of dep-graph plugin 2024-02-12 21:41:04 -07:00
daz
aaf44989e3
Use v1.2.1 of dep-graph plugin 2024-02-11 18:22:33 -07:00
daz
9eb8242410
Improvements to debug logging
- Enable cache debugging when ACTIONS_STEP_DEBUG is on
- Replace some info messages with debug
2024-02-11 17:35:10 -07:00
hfhbd
f4f7af32dc
Configure --info and --stacktrace when GitHub ACTIONS_RUNNER_DEBUG is true
Fixes #6
2024-02-11 16:56:16 -07:00
daz
79414b4f92
Add link to workflow run from PR comment
Fixes #11
2024-02-11 16:53:03 -07:00
daz
e9c65b9fc0
Attempt to make build-scan links open in new tab
GitHub currently strips the target="_blank" from the rendered HTML,
but we'll leave this in since it's the desired behaviour.
2024-02-11 16:52:22 -07:00
daz
2f23d645f2
Warn and make Gradle Wrapper script executable
Instead of failing the build, detect a non-executable wrapper file
and set the executable bit.

Fixes #17
2024-02-08 22:26:12 -07:00
daz
b2288963e8
Use sub-directory for 'setup-gradle' dist
To prepare for converting the 'dependency-submission' action into Typescript,
we move the 'setup-gradle' entry points and outputs into a sub-directory.
2024-01-29 09:16:58 -07:00
daz
a97b588d8e
Bump to use v1.2.0 of the dep-graph plugin 2024-01-28 14:15:00 -07:00
daz
177cef6d02
Provide an override for the dependency-graph plugin version 2024-01-28 14:03:37 -07:00
daz
e833c3f088
Bump DV plugin version to 3.16.2 2024-01-26 12:58:26 -07:00
daz
a628cf9f2e
Replace occurrances of gradle-build-action
- Mostly with `setup-gradle`
- Some with `gradle-actions`
2024-01-25 12:36:53 -07:00
daz
5e522253a6
Combine all sources into a sub-directory 2024-01-25 11:53:44 -07:00