Commit b9829399 authored by femiadeyemi's avatar femiadeyemi
Browse files

refactor the ci/cd and supress false positive dependency

Motivation:

Maven test are unncessarily ran at least twice and some
stage that were declared that were not use. This cause
some unexpected behaviour in the ci/cd build.

Also, the ci/cd fail because of some false postive in the
dependency vulnerabilities scan

Modification:

- Define only neccessary stages and use them accordingly.
- add some few dependecies supression

Result:

- Keep the ci/cd simple and avoid running multiple tests
- when `mvn org.owasp:dependency-check-maven:check` is run
Vulnerabilities found equal 0

Target: master
Review: https://gitlab.hzdr.de/hifis-technical-platform/helmholtz-cerebrum/-/merge_requests/39
parent a1be3778
Pipeline #45258 canceled with stages
in 34 seconds
stages:
- build
- test
- pre_package
- package
- deploy
......@@ -17,4 +16,3 @@ cache:
include:
- local: .gitlab/ci/ci.yml
- local: .gitlab/ci/create-docker-image-ci.yml
ci_build:
build:
only:
- master
- tags
- merge_requests
stage: build
image: maven:3-jdk-11
script: mvn compile
test:
only:
- master
- tags
- merge_requests
stage: test
image: maven:3-jdk-11
script:
- 'export AAI_TOKEN=$(curl -u "helmholtz-marketplace:${CLIENT_SECRET}" -X POST "https://login.helmholtz.de/oauth2/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=refresh_token&refresh_token=${AAI_REFRESH_TOKEN}&client_id=helmholtz-marketplace&client_secret=${CLIENT_SECRET}" | sed "s/{.*\"access_token\":\"\([^\"]*\).*}/\1/g")'
- "mvn -Dtoken=$AAI_TOKEN -B package --file pom.xml"
\ No newline at end of file
- mvn -Dtoken=$AAI_TOKEN test
package:
only:
- master
stage: package
image: maven:3-jdk-11
script: mvn -DskipTests clean install
artifacts:
paths:
- "target/*.tar"
expire_in: 600 seconds
tags:
- "docker"
docker_push:
only:
- master
stage: deploy
image: docker:19.03.11
services:
- name: docker:19.03.11-dind
alias: docker
before_script:
- docker info
script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker build -t $DOCKER_IMAGE_LATEST .
- docker push $DOCKER_IMAGE_LATEST
dependencies:
- package
tags:
- "docker"
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment