Merge pull request #598 from zelahi/integrate-fossa-scans-pre-commit
[TAR-995 ]ADDED License scan stage to occur pre-commit in Jenkins
This commit is contained in:
Коммит
93626e0aa7
|
@ -20,11 +20,3 @@ analyze:
|
|||
type: go
|
||||
target: github.com/docker/app/cmd/docker-app-standalone
|
||||
path: cmd/docker-app-standalone
|
||||
- name: github.com/docker/app/pkg/yatee/gopher
|
||||
type: go
|
||||
target: github.com/docker/app/pkg/yatee/gopher
|
||||
path: pkg/yatee/gopher
|
||||
- name: github.com/docker/app/pkg/yatee/samples
|
||||
type: go
|
||||
target: github.com/docker/app/pkg/yatee/samples
|
||||
path: pkg/yatee/samples
|
||||
|
|
|
@ -56,6 +56,26 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage("License Scan") {
|
||||
agent {
|
||||
label 'ubuntu-1604-aufs-edge'
|
||||
}
|
||||
steps {
|
||||
withCredentials([
|
||||
usernamePassword(credentialsId: 'dockerbuildbot-hub.docker.com', usernameVariable: 'REGISTRY_USERNAME', passwordVariable: 'REGISTRY_PASSWORD'),
|
||||
string(credentialsId: 'fossa-api-key', variable: 'FOSSA_API_KEY')
|
||||
]) {
|
||||
dir('src/github.com/docker/app') {
|
||||
checkout scm
|
||||
ansiColor('xterm') {
|
||||
sh "docker login -u $REGISTRY_USERNAME -p $REGISTRY_PASSWORD"
|
||||
sh "FOSSA_API_KEY=$FOSSA_API_KEY BRANCH_NAME='${BRANCH_NAME}' make fossa-analyze"
|
||||
sh "FOSSA_API_KEY=$FOSSA_API_KEY make fossa-test"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Invocation image'){
|
||||
agent {
|
||||
label 'ubuntu-1804'
|
||||
|
|
13
Makefile
13
Makefile
|
@ -111,6 +111,19 @@ coverage: coverage-test-unit coverage-test-e2e ## run tests with coverage
|
|||
go tool cover -func _build/cov/all.out
|
||||
go tool cover -html _build/cov/all.out -o _build/cov/coverage.html
|
||||
|
||||
fossa-analyze:
|
||||
docker run -i --rm -e FOSSA_API_KEY=$(FOSSA_API_KEY) \
|
||||
-e GO111MODULE=on \
|
||||
-v $(CURDIR)/$*:/go/src/github.com/docker/app \
|
||||
-w /go/src/github.com/docker/app \
|
||||
$(BUILD_ANALYZER) analyze $(FOSSA_OPTS) --branch $(BRANCH_NAME)
|
||||
|
||||
fossa-test:
|
||||
docker run -i --rm -e FOSSA_API_KEY=$(FOSSA_API_KEY) \
|
||||
-v $(CURDIR)/$*:/go/src/github.com/docker/app \
|
||||
-w /go/src/github.com/docker/app \
|
||||
$(BUILD_ANALYZER) test --debug
|
||||
|
||||
clean: ## clean build artifacts
|
||||
$(call rmdir,bin)
|
||||
$(call rmdir,_build)
|
||||
|
|
4
vars.mk
4
vars.mk
|
@ -3,6 +3,10 @@ BIN_NAME ?= docker-app
|
|||
BIN_STANDALONE_NAME := ${BIN_NAME}-standalone
|
||||
E2E_NAME := $(BIN_NAME)-e2e
|
||||
|
||||
# Variables for fossa scan
|
||||
BUILD_ANALYZER?=dockereng/fossa-analyzer
|
||||
FOSSA_OPTS?=--option all-tags:true --option allow-unresolved:true
|
||||
|
||||
# Enable experimental features. "on" or "off"
|
||||
EXPERIMENTAL := off
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче