Skip to content

Commit

Permalink
[infra] optional dockerfile; copy .dict and .options
Browse files Browse the repository at this point in the history
- Remove requirement of specifying dockerfile in Jenkinsfile. Assume it
  is in the library directory by deefault.
- Try to copy any *.dict or *.options files to output directory.
  • Loading branch information
oliverchang authored and mikea committed Aug 30, 2016
1 parent 44f33a3 commit bcdafbe
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion boringssl/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def libfuzzerPipeline = fileLoader.fromGit(

libfuzzerPipeline {
git = "https://boringssl.googlesource.com/boringssl"
dockerfile = "oss-fuzz/boringssl/Dockerfile"
}


1 change: 0 additions & 1 deletion docs/new_library.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def libfuzzerBuild = fileLoader.fromGit('infra/libfuzzer-pipeline.groovy',
libfuzzerBuild {
git = "git://git.code.sf.net/p/expat/code_git"
dockerfile = "oss-fuzz/expat/Dockerfile"
}
```

Expand Down
1 change: 0 additions & 1 deletion expat/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ def libfuzzerBuild = fileLoader.fromGit('infra/libfuzzer-pipeline.groovy',

libfuzzerBuild {
git = "git://git.code.sf.net/p/expat/code_git"
dockerfile = "oss-fuzz/expat/Dockerfile"
}
1 change: 0 additions & 1 deletion freetype2/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ def libfuzzerBuild = fileLoader.fromGit(

libfuzzerBuild {
git = "git://git.sv.nongnu.org/freetype/freetype2.git"
dockerfile = "oss-fuzz/freetype2/Dockerfile"
}

11 changes: 7 additions & 4 deletions infra/libfuzzer-pipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ def call(body) {
body()

// Mandatory configuration
def dockerfile = config["dockerfile"]
assert dockerfile : "dockerfile should be specified"
def gitUrl = config["git"]
assert gitUrl : "git should be specified"

// Optional configuration
def projectName = config["name"] ?: env.JOB_BASE_NAME
def dockerfile = config["dockerfile"] ?: "oss-fuzz/$projectName/Dockerfile"
def sanitizers = config["sanitizers"] ?: ["address"]
def checkoutDir = config["checkoutDir"] ?: projectName
def dockerContextDir = config["dockerContextDir"]
Expand All @@ -38,7 +37,7 @@ def call(body) {
def ossFuzzUrl = 'https:/google/oss-fuzz.git'

node {
echo "Building project $projectName with Dockerfile=$dockerfile"
echo "Building project $projectName"

def wsPwd = pwd()

Expand Down Expand Up @@ -74,10 +73,14 @@ def call(body) {
// Build docker image
sh "docker build -t $dockerTag -f $dockerfile $dockerContextDir"

// Run image to produce fuzzers"
// Run image to produce fuzzers
sh "rm -rf $out"
sh "mkdir -p $out"
sh "docker run -v $workspace/$checkoutDir:/src/$checkoutDir -v $workspace/oss-fuzz:/src/oss-fuzz -v $out:/out -e SANITIZER_FLAGS=\"-fsanitize=$sanitizer\" -t $dockerTag"
"
// Copy dict and options files
sh "cp $workspace/oss-fuzz/$projectName/*.dict $out/ || true"
sh "cp $workspace/oss-fuzz/$projectName/*.options $out/ || true"
}
}
Expand Down

0 comments on commit bcdafbe

Please sign in to comment.