Add FOSSA checks to Jenkins CI

Signed-off-by: Dmytro Makovey <dmytro.makovey@docker.com>
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Dmytro Makovey 2019-09-11 10:22:20 -06:00 committed by Tibor Vass
parent c1ce7300d5
commit 5f4d4a87f7
2 changed files with 47 additions and 0 deletions

29
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,29 @@
@Library('jps')
_
pipeline {
agent {
node {
label 'ubuntu-1804-overlay2'
}
}
options {
disableConcurrentBuilds()
}
stages {
stage("FOSSA Analyze") {
steps {
withCredentials([string(credentialsId: 'fossa-api-key', variable: 'FOSSA_API_KEY')]) {
withGithubStatus('FOSSA.scan') {
labelledShell returnStatus: false, returnStdout: true, label: "make fossa-analyze",
script:'make -f Makefile.fossa BRANCH_NAME=${BRANCH_NAME} fossa-analyze'
labelledShell returnStatus: false, returnStdout: true, label: "make fossa-test",
script: 'make -f Makefile.fossa BRANCH_NAME=${BRANCH_NAME} fossa-test'
}
}
}
}
}
}

18
Makefile.fossa Normal file
View File

@ -0,0 +1,18 @@
REPO_PATH?=docker/buildx
BUILD_ANALYZER?=docker/fossa-analyzer
FOSSA_OPTS?=--option all-tags:true --option allow-unresolved:true --no-ansi
fossa-analyze:
docker run -i --rm -e FOSSA_API_KEY=$(FOSSA_API_KEY) \
-v $(CURDIR)/$*:/go/src/github.com/$(REPO_PATH) \
-w /go/src/github.com/$(REPO_PATH) \
-e GO111MODULE=on \
$(BUILD_ANALYZER) analyze $(FOSSA_OPTS) --branch $(BRANCH_NAME)
# This command is used to run the fossa test command
fossa-test:
docker run -i --rm -e FOSSA_API_KEY=$(FOSSA_API_KEY) \
-v $(CURDIR)/$*:/go/src/github.com/$(REPO_PATH) \
-w /go/src/github.com/$(REPO_PATH) \
-e GO111MODULE=on \
$(BUILD_ANALYZER) test --debug