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

Commit 93626e0

Browse files
authored
Merge pull request #598 from zelahi/integrate-fossa-scans-pre-commit
[TAR-995 ]ADDED License scan stage to occur pre-commit in Jenkins
2 parents ab21570 + 95438af commit 93626e0

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

.fossa.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,3 @@ analyze:
2020
type: go
2121
target: github.com/docker/app/cmd/docker-app-standalone
2222
path: cmd/docker-app-standalone
23-
- name: github.com/docker/app/pkg/yatee/gopher
24-
type: go
25-
target: github.com/docker/app/pkg/yatee/gopher
26-
path: pkg/yatee/gopher
27-
- name: github.com/docker/app/pkg/yatee/samples
28-
type: go
29-
target: github.com/docker/app/pkg/yatee/samples
30-
path: pkg/yatee/samples

Jenkinsfile.baguette

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ pipeline {
5656
}
5757
}
5858
}
59+
stage("License Scan") {
60+
agent {
61+
label 'ubuntu-1604-aufs-edge'
62+
}
63+
steps {
64+
withCredentials([
65+
usernamePassword(credentialsId: 'dockerbuildbot-hub.docker.com', usernameVariable: 'REGISTRY_USERNAME', passwordVariable: 'REGISTRY_PASSWORD'),
66+
string(credentialsId: 'fossa-api-key', variable: 'FOSSA_API_KEY')
67+
]) {
68+
dir('src/github.com/docker/app') {
69+
checkout scm
70+
ansiColor('xterm') {
71+
sh "docker login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD"
72+
sh "FOSSA_API_KEY=$FOSSA_API_KEY BRANCH_NAME='${BRANCH_NAME}' make fossa-analyze"
73+
sh "FOSSA_API_KEY=$FOSSA_API_KEY make fossa-test"
74+
}
75+
}
76+
}
77+
}
78+
}
5979
stage('Invocation image'){
6080
agent {
6181
label 'ubuntu-1804'

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=on \
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)