This repository has been archived by the owner on Jul 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevents the use of actions/setup-java@v1 and adopt /adopt-hotspot (o…
…penjdk) distributions. (#82) * Improvements: Adding a new default rule that prevents the use of action/setup-java@v1 since it doesn't support eclipse temurin distributions. * Improvements: Adding an additional rule to prevent the use of adop/adopt-hotspot distributions on the actions/setup-java@v2+, since such distributions won't be supported anymore. * Improvements: Adding a better error message for the new rules. Checking if the action/setup-java@v2+ is used before checking for the use of adopt/adopt-hotspot distributions. * Improvements: Fixing typo on the 'enabledByDefault' field. Fixing the reference to the distribution property on the rule #13.
- Loading branch information
Showing
4 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
pkg/rulesConfig/defaultRules/github/12-prevent-action-setup-java-v1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"description": "Prevent use of action/setup-java@v1.", | ||
"failureMessage": "action/setup-java@v1 is used on the workflow. action/setup-java@v1 uses a java distribution that is out of support (AdoptOpenJDK) by default, please use action/setup-java@v2+ and avoid the use of adopt/adopt-host distributions.", | ||
"uniqueId": 12, | ||
"enabledByDefault": true, | ||
"schema": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"properties": { | ||
"repositories": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"properties": { | ||
"github-actions-workflows": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"properties": { | ||
"content": { | ||
"properties": { | ||
"jobs": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"properties": { | ||
"steps": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"uses": { | ||
"not": { | ||
"type": "string", | ||
"pattern": ".*actions\/setup-java@(v1).*" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
pkg/rulesConfig/defaultRules/github/13-prevent-adopt-distributions-on-setup-java.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"description": "Prevent use of adopt/adopt-hotspot distributions for actions/setup-java version 2+.", | ||
"failureMessage": "adopt/adopt-hotspot distribution is used on the workflow. Please, avoid the use of adopt/adopt-hotspot distributions since they are out of support. Use temurin based distributions instead (such distributions are currently maintained by the core adopt/adopt-hotspot team).", | ||
"uniqueId": 13, | ||
"enabledByDefault": true, | ||
"schema": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"properties": { | ||
"repositories": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "object", | ||
"properties": { | ||
"github-actions-workflows": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"properties": { | ||
"content": { | ||
"properties": { | ||
"jobs": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"properties": { | ||
"steps": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"if": { | ||
"properties": { | ||
"uses": { | ||
"type": "string", | ||
"pattern": ".*actions\/setup-java@(v2|v3).*" | ||
} | ||
}, | ||
"required": [ | ||
"uses" | ||
] | ||
}, | ||
"then": { | ||
"properties": { | ||
"with": { | ||
"type": "object", | ||
"properties": { | ||
"distribution": { | ||
"not": { | ||
"type": "string", | ||
"pattern": ".*adopt(-hotspot)?" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
pkg/rulesConfig/defaultRules/gitlab/12-prevent-action-setup-java-v1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"description": "Prevent use of action/setup-java@v1.", | ||
"failureMessage": "action/setup-java@v1 is used on the workflow. action/setup-java@v1 uses a java distribution that is out of support (AdoptOpenJDK) by default, please use action/setup-java@v2+ and avoid the use of adopt/adopt-host distributions.", | ||
"uniqueId": 12, | ||
"enabledByDefault": true, | ||
"schema": {} | ||
} |
7 changes: 7 additions & 0 deletions
7
pkg/rulesConfig/defaultRules/gitlab/13-prevent-adopt-distributions-on-setup-java.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"description": "Prevent use of adopt/adopt-hotspot distributions for actions/setup-java version 2+.", | ||
"failureMessage": "adopt/adopt-hotspot distribution is used on the workflow. Please, avoid the use of adopt/adopt-hotspot distributions since they are out of support. Use temurin based distributions instead (such distributions are currently maintained by the core adopt/adopt-hotspot team).", | ||
"uniqueId": 13, | ||
"enabledByDefault": true, | ||
"schema": {} | ||
} |