ci.yml 1.33 KB
Newer Older
1
build:
2
3
4
5
6
7
    only:
        - master
        - tags
        - merge_requests
    stage: build
    image: maven:3-jdk-11
8
9
10
11
12
13
14
    script: mvn compile

test:
    only:
        - master
        - tags
        - merge_requests
femiadeyemi's avatar
femiadeyemi committed
15
    stage: test-skip
16
    image: maven:3-jdk-11
17
18
    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")'
femiadeyemi's avatar
femiadeyemi committed
19
        - mvn -DskipTests -Dtoken=$AAI_TOKEN test
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

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:
femiadeyemi's avatar
femiadeyemi committed
51
        - "docker"