Unverified Commit b644be61 authored by daz's avatar daz
Browse files

Enable wrapper validation by default

- Add 'allow-snapshot-wrappers' input parameter
- Default 'validate-wrappers' to 'true'

Fixes #12
parent 71799097
Loading
Loading
Loading
Loading
+5
Changes for .github/actions/init-integ-test/action.yml: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,11 @@ runs:
        distribution: 'temurin'
        java-version: 11

    - name: Configure environment
      shell: bash
      run: |
        echo "ALLOWED_GRADLE_WRAPPER_CHECKSUMS=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" >> "$GITHUB_ENV"

    # Downloads a 'dist' directory artifact that was uploaded in an earlier 'build-dist' step
    - name: Download dist
      if: ${{ env.SKIP_DIST != 'true' && !env.ACT }}
+2 −2
Changes for .github/workflows/integ-test-wrapper-validation.yml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ jobs:
    - name: Run wrapper-validation-action
      id: setup-gradle
      uses: ./setup-gradle
      with:
        validate-wrappers: true
      env:
        ALLOWED_GRADLE_WRAPPER_CHECKSUMS: ''
      continue-on-error: true

    - name: Check failure
+15
Changes for dependency-submission/action.yml: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -172,6 +172,21 @@ inputs:
    description: The Develocity short-lived access tokens expiry in hours. Default is 2 hours.
    required: false

  # Wrapper validation configuration
  validate-wrappers:
    description: |
      When 'true' the action will automatically validate all wrapper jars found in the repository.
      If the wrapper checksums are not valid, the action will fail.
    required: false
    default: false

  allow-snapshot-wrappers:
    description: |
      When 'true', wrapper validation will include the checksums of snapshot wrapper jars. 
      Use this if you are running with nightly or snapshot versions of the Gradle wrapper.
    required: false
    default: false

  # DEPRECATED ACTION INPUTS

  # EXPERIMENTAL ACTION INPUTS
+18 −2
Changes for docs/setup-gradle.md: 18 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -515,14 +515,30 @@ Since Gradle applies init scripts in alphabetical order, one way to ensure this

## Gradle Wrapper validation

Instead of using the [wrapper-validation action](./wrapper-validation.md) separately, you can enable
wrapper validation directly in your Setup Gradle step.
By default, this action will perform the same wrapper validation as is performed by the dedicated 
[wrapper-validation action](./wrapper-validation.md). 
This means that invalid wrapper jars will be automatically detected when using `setup-gradle`. 

If you do not want wrapper-validation to occur automatically, you can disable it:

```yaml
    - name: Setup Gradle
      uses: gradle/actions/setup-gradle@v3
      with:
        validate-wrappers: false
```

If your repository uses snapshot versions of the Gradle wrapper, such as nightly builds, then you'll need to 
explicitly allow snapshot wrappers in wrapper validation.
These are not allowed by default.


```yaml
    - name: Setup Gradle
      uses: gradle/actions/setup-gradle@v3
      with:
        validate-wrappers: true
        allow-snapshot-wrappers: true
```

If you need more advanced configuration, then you're advised to continue using a separate workflow step
+3
Changes for docs/wrapper-validation.md: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,9 @@ This action validates the checksums of _all_ [Gradle Wrapper](https://docs.gradl

The action should be run in the root of the repository, as it will recursively search for any files named `gradle-wrapper.jar`.

The `setup-gradle` action will perform wrapper validation on each execution. If you are using `setup-gradle` in your
workflows, it is unlikely that you will need to use this action.

## The Gradle Wrapper Problem in Open Source

The `gradle-wrapper.jar` is a binary blob of executable code that is checked into nearly
Loading