mirror of
https://github.com/gradle/actions.git
synced 2025-11-26 17:09:10 +08:00
Compare commits
7 Commits
renovate/r
...
jprinet/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e48ea170d2 | ||
|
|
aac6626d42 | ||
|
|
d45eec9a5e | ||
|
|
1b708738f6 | ||
|
|
3574b901d9 | ||
|
|
19d90431a4 | ||
|
|
b8ceb1b11e |
@@ -52,13 +52,6 @@ jobs:
|
||||
- name: Test uses Gradle v7.1.1
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help "-DgradleVersionCheck=7.1.1"
|
||||
- name: Setup Gradle with release-candidate
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
gradle-version: release-candidate
|
||||
- name: Test use release-candidate
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help
|
||||
- name: Setup Gradle with current
|
||||
id: gradle-current
|
||||
uses: ./setup-gradle
|
||||
@@ -73,6 +66,29 @@ jobs:
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.gradle-current.outputs.gradle-version }}"')
|
||||
|
||||
provision-gradle-with-jdk-17:
|
||||
strategy:
|
||||
max-parallel: 1
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: ${{fromJSON(inputs.runner-os)}}
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: Initialize integ-test
|
||||
uses: ./.github/actions/init-integ-test
|
||||
with:
|
||||
java-version: '17'
|
||||
|
||||
- name: Setup Gradle with release-candidate
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
gradle-version: release-candidate
|
||||
- name: Test use release-candidate
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help
|
||||
|
||||
provision-gradle-version:
|
||||
strategy:
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
"cheerio": "1.1.0",
|
||||
"semver": "7.7.2",
|
||||
"string-argv": "0.3.2",
|
||||
"typed-rest-client": "2.1.0",
|
||||
"unhomoglyph": "1.0.6",
|
||||
"which": "5.0.0"
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as httpm from 'typed-rest-client/HttpClient'
|
||||
import * as cheerio from 'cheerio'
|
||||
import * as core from '@actions/core'
|
||||
import * as httpm from '@actions/http-client'
|
||||
//import * as httpm from '@actions/http-client'
|
||||
|
||||
import fileWrapperChecksums from './wrapper-checksums.json'
|
||||
|
||||
@@ -69,20 +70,23 @@ async function httpGetJsonArray(url: string): Promise<unknown[]> {
|
||||
}
|
||||
|
||||
async function httpGetText(url: string): Promise<string> {
|
||||
const maxAttempts = 4
|
||||
let attempts = 0
|
||||
while (attempts < maxAttempts) {
|
||||
try {
|
||||
const response = await httpc.get(url)
|
||||
return await response.readBody()
|
||||
} catch (error) {
|
||||
attempts++
|
||||
if (attempts === maxAttempts) {
|
||||
return new Promise((_resolve, reject) => reject(error))
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Promise((_resolve, reject) => reject(new Error('Illegal state')))
|
||||
const response = await httpc.get(url)
|
||||
return await response.readBody()
|
||||
|
||||
// const maxAttempts = 4
|
||||
// let attempts = 0
|
||||
// while (attempts < maxAttempts) {
|
||||
// try {
|
||||
// const response = await httpc.get(url)
|
||||
// return await response.readBody()
|
||||
// } catch (error) {
|
||||
// attempts++
|
||||
// if (attempts === maxAttempts) {
|
||||
// return new Promise((_resolve, reject) => reject(error))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return new Promise((_resolve, reject) => reject(new Error('Illegal state')))
|
||||
}
|
||||
|
||||
async function addDistributionSnapshotChecksumUrls(checksumUrls: [string, string][]): Promise<void> {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import * as core from '@actions/core'
|
||||
|
||||
import * as find from './find'
|
||||
import * as checksums from './checksums'
|
||||
import * as hash from './hash'
|
||||
@@ -21,6 +23,16 @@ export async function findInvalidWrapperJars(
|
||||
previouslyValidatedChecksums.includes(sha) ||
|
||||
knownValidChecksums.checksums.has(sha)
|
||||
) {
|
||||
if (allowedChecksums.includes(sha)) {
|
||||
core.info("Found allowed Gradle Wrapper JAR file: " + sha)
|
||||
}
|
||||
if (previouslyValidatedChecksums.includes(sha)) {
|
||||
core.info(`Found previously validated Gradle Wrapper JAR file: ${sha}`)
|
||||
}
|
||||
if(knownValidChecksums.checksums.has(sha)) {
|
||||
core.info(`Found known valid Gradle Wrapper JAR file: ${sha}`)
|
||||
}
|
||||
|
||||
result.valid.push(new WrapperJar(wrapperJar, sha))
|
||||
} else {
|
||||
notYetValidatedWrappers.push(new WrapperJar(wrapperJar, sha))
|
||||
@@ -36,6 +48,7 @@ export async function findInvalidWrapperJars(
|
||||
if (!fetchedValidChecksums.checksums.has(wrapperJar.checksum)) {
|
||||
result.invalid.push(wrapperJar)
|
||||
} else {
|
||||
core.info(`Fall back - Found valid Gradle Wrapper JAR file: ${wrapperJar.checksum}`)
|
||||
result.valid.push(wrapperJar)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ export async function validateWrappers(
|
||||
|
||||
const allowedChecksums = process.env['ALLOWED_GRADLE_WRAPPER_CHECKSUMS']?.split(',') || []
|
||||
const previouslyValidatedChecksums = checksumCache.load()
|
||||
|
||||
core.info(`gradleUserHome = ${gradleUserHome}`)
|
||||
core.info(`Previously validated checksums loaded from cache: ${previouslyValidatedChecksums.join(', ')}`)
|
||||
|
||||
const result = await findInvalidWrapperJars(
|
||||
workspaceRoot,
|
||||
config.allowSnapshotWrappers(),
|
||||
|
||||
Reference in New Issue
Block a user