-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: split evaluations into SBOM or License for given user input (…
…#5)
- Loading branch information
Showing
45 changed files
with
1,776 additions
and
775 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
#.grant.yaml | ||
precedence: [deny, allow] | ||
deny-licenses: "*" | ||
allow-licenses: | ||
- MPL-2.0 | ||
- BSD-2-Clause | ||
- BSD-3-Clause | ||
- GPL-2.0-Or-Later+ | ||
- Zlib | ||
- MIT | ||
- Apache-2.0 | ||
format: json | ||
import: | ||
- ../local-policy.json | ||
- git@githubcom:anchore/central-policy.git@main#./org/*.policy.json | ||
- allowed: [] | ||
denied: [] | ||
# grant -o json alpine:latest=osi.arrpoved.json enterprisesystemsengineering:latest=special.approved.json | ||
# grant myimage:latest ./local-policy.json | ||
|
||
# .gitignore vs .gitconfig distinction (don't mix the what and how) | ||
|
||
# .grantpolicy.yaml | ||
# .grantpolicy/*.yaml |
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
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
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
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
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
File renamed without changes.
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,5 @@ | ||
/packages/* | ||
|
||
# maven when running in a volume may spit out directories like this | ||
**/\?/ | ||
\?/ |
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,19 @@ | ||
PKGSDIR=packages | ||
|
||
ifndef PKGSDIR | ||
$(error PKGSDIR is not set) | ||
endif | ||
|
||
clean: clean-examples | ||
rm -f $(PKGSDIR)/* | ||
|
||
jars: $(PKGSDIR)/example-java-app-maven-0.1.0.jar | ||
|
||
archives: $(PKGSDIR)/example-java-app-maven-0.1.0.zip | ||
|
||
$(PKGSDIR)/example-java-app-maven-0.1.0.zip: $(PKGSDIR)/example-java-app-maven-0.1.0.jar | ||
zip $(PKGSDIR)/example-java-app-maven-0.1.0.zip $(PKGSDIR)/example-java-app-maven-0.1.0.jar | ||
|
||
# Maven... | ||
$(PKGSDIR)/example-java-app-maven-0.1.0.jar: | ||
./build-example-java-app-maven.sh $(PKGSDIR) |
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,17 @@ | ||
#!/usr/bin/env bash | ||
set -uxe | ||
|
||
PKGSDIR=$1 | ||
CTRID=$(docker create -u "$(id -u):$(id -g)" -e MAVEN_CONFIG=/tmp/.m2 -v /example-java-app -w /example-java-app maven:3.8.6-openjdk-18 mvn -Duser.home=/tmp -DskipTests package) | ||
|
||
function cleanup() { | ||
docker rm "${CTRID}" | ||
} | ||
|
||
trap cleanup EXIT | ||
set +e | ||
|
||
docker cp "$(pwd)/example-java-app" "${CTRID}:/" | ||
docker start -a "${CTRID}" | ||
mkdir -p "$PKGSDIR" | ||
docker cp "${CTRID}:/example-java-app/target/example-java-app-maven-0.1.0.jar" "$PKGSDIR" |
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,6 @@ | ||
# maven build creates this when in a container volume | ||
/?/ | ||
/.gradle/ | ||
/build/ | ||
target/ | ||
dependency-reduced-pom.xml |
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,58 @@ | ||
plugins { | ||
id 'java' | ||
id 'eclipse' | ||
id 'application' | ||
} | ||
|
||
mainClassName = 'hello.HelloWorld' | ||
|
||
dependencyLocking { | ||
lockAllConfigurations() | ||
} | ||
// tag::repositories[] | ||
repositories { | ||
mavenCentral() | ||
} | ||
// end::repositories[] | ||
|
||
// tag::dependencies[] | ||
sourceCompatibility = 1.8 | ||
targetCompatibility = 1.8 | ||
|
||
dependencies { | ||
implementation "joda-time:joda-time:2.2" | ||
testImplementation "junit:junit:4.12" | ||
} | ||
// end::dependencies[] | ||
|
||
// tag::jar[] | ||
jar { | ||
archivesBaseName = 'example-java-app-gradle' | ||
version = '0.1.0' | ||
manifest { | ||
attributes( | ||
'Main-Class': 'hello.HelloWorld' | ||
) | ||
} | ||
from { | ||
configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } | ||
} | ||
} | ||
// end::jar[] | ||
|
||
// tag::wrapper[] | ||
// end::wrapper[] | ||
|
||
// to invoke: gradle resolveAndLockAll --write-locks | ||
tasks.register('resolveAndLockAll') { | ||
notCompatibleWithConfigurationCache("Filters configurations at execution time") | ||
doFirst { | ||
assert gradle.startParameter.writeDependencyLocks | ||
} | ||
doLast { | ||
configurations.findAll { | ||
// Add any custom filtering on the configurations to be resolved | ||
it.canBeResolved | ||
}.each { it.resolve() } | ||
} | ||
} |
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 @@ | ||
# This is a Gradle generated file for dependency locking. | ||
# Manual edits can break the build and are not advised. | ||
# This file is expected to be part of source control. | ||
joda-time:joda-time:2.2=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath | ||
junit:junit:4.12=testCompileClasspath,testRuntimeClasspath | ||
org.hamcrest:hamcrest-core:1.3=testCompileClasspath,testRuntimeClasspath | ||
empty=annotationProcessor,testAnnotationProcessor |
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,59 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.anchore</groupId> | ||
<artifactId>example-java-app-maven</artifactId> | ||
<packaging>jar</packaging> | ||
<version>0.1.0</version> | ||
|
||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
|
||
<dependencies> | ||
<!-- tag::joda[] --> | ||
<dependency> | ||
<groupId>joda-time</groupId> | ||
<artifactId>joda-time</artifactId> | ||
<version>2.9.2</version> | ||
</dependency> | ||
<!-- end::joda[] --> | ||
<!-- tag::junit[] --> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- end::junit[] --> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>2.1</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<transformers> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<mainClass>hello.HelloWorld</mainClass> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
7 changes: 7 additions & 0 deletions
7
fixtures/archive-builds/example-java-app/src/main/java/hello/Greeter.java
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 @@ | ||
package hello; | ||
|
||
public class Greeter { | ||
public String sayHello() { | ||
return "Hello world!"; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
fixtures/archive-builds/example-java-app/src/main/java/hello/HelloWorld.java
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,13 @@ | ||
package hello; | ||
|
||
import org.joda.time.LocalTime; | ||
|
||
public class HelloWorld { | ||
public static void main(String[] args) { | ||
LocalTime currentTime = new LocalTime(); | ||
System.out.println("The current local time is: " + currentTime); | ||
|
||
Greeter greeter = new Greeter(); | ||
System.out.println(greeter.sayHello()); | ||
} | ||
} |
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 @@ | ||
Copyright <YEAR> <COPYRIGHT HOLDER> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Oops, something went wrong.