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:
Chris Crone 2019-09-13 08:30:13 +02:00 коммит произвёл GitHub
Родитель ab21570f8a 95438afc52
Коммит 93626e0aa7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 37 добавлений и 8 удалений

Просмотреть файл

@ -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'

Просмотреть файл

@ -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)

Просмотреть файл

@ -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