Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 963997c

Browse files
committed
ADDED License scan stage to occur pre-commit in Jenkins
Signed-off-by: Zuhayr Elahi <[email protected]>
1 parent 2218ab2 commit 963997c

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

Jenkinsfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ pipeline {
3535
}
3636
}
3737
}
38+
stage("License Scan") {
39+
environment {
40+
FOSSA_API_KEY=credentials('cb07b147-32a4-4400-aaac-21c3f8c9e62e')
41+
}
42+
agent {
43+
label 'ubuntu-1604-aufs-edge'
44+
}
45+
steps {
46+
dir('src/github.com/docker/app') {
47+
checkout scm
48+
ansiColor(xterm) {
49+
sh "BRANCH_NAME='${BRANCH_NAME}' make fossa-analyze"
50+
sh 'make fossa-test'
51+
}
52+
}
53+
}
54+
}
3855
stage("Binaries"){
3956
agent {
4057
label 'ubuntu-1604-aufs-edge'

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,19 @@ coverage: coverage-test-unit coverage-test-e2e ## run tests with coverage
111111
go tool cover -func _build/cov/all.out
112112
go tool cover -html _build/cov/all.out -o _build/cov/coverage.html
113113

114+
fossa-analyze:
115+
docker run -i --rm -e FOSSA_API_KEY=$(FOSSA_API_KEY) \
116+
-e GO111MODULE=off \
117+
-v $(CURDIR)/$*:/go/src/github.com/docker/app \
118+
-w /go/src/github.com/docker/app \
119+
$(BUILD_ANALYZER) analyze $(FOSSA_OPTS) --branch $(BRANCH_NAME)
120+
121+
fossa-test:
122+
docker run -i --rm -e FOSSA_API_KEY=$(FOSSA_API_KEY) \
123+
-v $(CURDIR)/$*:/go/src/github.com/docker/app \
124+
-w /go/src/github.com/docker/app \
125+
$(BUILD_ANALYZER) test --debug
126+
114127
clean: ## clean build artifacts
115128
$(call rmdir,bin)
116129
$(call rmdir,_build)

vars.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ BIN_NAME ?= docker-app
33
BIN_STANDALONE_NAME := ${BIN_NAME}-standalone
44
E2E_NAME := $(BIN_NAME)-e2e
55

6+
# Variables for fossa scan
7+
BUILD_ANALYZER?=dockereng/fossa-analyzer
8+
FOSSA_OPTS?=--option all-tags:true --option allow-unresolved:true
9+
610
# Enable experimental features. "on" or "off"
711
EXPERIMENTAL := off
812

0 commit comments

Comments
 (0)