2020-06-07 10:10:21 +00:00
|
|
|
kind: pipeline
|
|
|
|
type: docker
|
|
|
|
name: default
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: build-service
|
2020-06-11 20:00:20 +00:00
|
|
|
image: maven:3.6-jdk-11
|
2020-07-03 18:15:54 +00:00
|
|
|
volumes:
|
|
|
|
- name: m2-cache
|
|
|
|
path: /root/.m2
|
2020-06-12 13:31:42 +00:00
|
|
|
environment:
|
|
|
|
NEXUS_USER:
|
|
|
|
from_secret: nexus_user
|
|
|
|
NEXUS_PASSWORD:
|
|
|
|
from_secret: nexus_password
|
2020-06-07 10:10:21 +00:00
|
|
|
commands:
|
2020-06-12 13:31:42 +00:00
|
|
|
- mkdir -p /root/.m2
|
|
|
|
- cp service/settings.xml /root/.m2/settings.xml
|
2020-06-07 10:10:21 +00:00
|
|
|
- cd service/fling
|
2020-06-12 13:31:42 +00:00
|
|
|
- mvn -Pprod clean deploy
|
2020-06-07 10:10:21 +00:00
|
|
|
|
2020-07-12 10:21:55 +00:00
|
|
|
- name: runservice
|
|
|
|
image: adoptopenjdk:11-jre-hotspot
|
|
|
|
commands:
|
|
|
|
- cd service/fling/target
|
|
|
|
- java -jar fling-0.1.0-SNAPSHOT.jar
|
|
|
|
detach: true
|
|
|
|
|
2020-07-12 16:48:12 +00:00
|
|
|
- name: generate-clients
|
|
|
|
image: alpine
|
|
|
|
environment:
|
|
|
|
NEXUS_USER:
|
|
|
|
from_secret: nexus_user
|
|
|
|
NEXUS_PASSWORD:
|
|
|
|
from_secret: nexus_password
|
|
|
|
commands:
|
|
|
|
- apk add --update --no-cache openjdk11 npm
|
|
|
|
- sleep 20
|
|
|
|
- npm install @openapitools/openapi-generator-cli -g
|
|
|
|
# Python client
|
|
|
|
- openapi-generator generate
|
|
|
|
-i http://runservice:8080/v3/api-docs
|
|
|
|
-g python
|
2020-07-13 19:55:02 +00:00
|
|
|
--additional-properties packageName=flingclient
|
2020-07-12 16:48:12 +00:00
|
|
|
-o flingclient.py
|
|
|
|
--enable-post-process-file
|
2020-07-13 19:55:02 +00:00
|
|
|
- cd flingclient.py
|
|
|
|
- |+
|
|
|
|
cat << EOF
|
|
|
|
[distutils]
|
|
|
|
index-servers =
|
|
|
|
nexus
|
|
|
|
[private-repository]
|
|
|
|
repository = <private-repository URL>
|
|
|
|
username = <private-repository username>
|
|
|
|
password = <private-repository password>
|
|
|
|
EOF >> .pypirc
|
|
|
|
- cat .pypirc
|
|
|
|
- cd ..
|
2020-07-12 16:48:12 +00:00
|
|
|
# JavaScript client
|
|
|
|
- openapi-generator generate
|
|
|
|
-i http://runservice:8080/v3/api-docs
|
|
|
|
-g javascript
|
|
|
|
--additional-properties projectName=@fling/flingclient,usePromises=true,npmRepository=https://nexus.friedl.net/repository/npm-private/
|
|
|
|
-o flingclient.js
|
|
|
|
--enable-post-process-file
|
|
|
|
- cd flingclient.js && npm install && npm run build
|
|
|
|
- echo "https://nexus.friedl.net/repository/npm-private/" >> .npmrc
|
|
|
|
- echo -n "_auth=" >> .npmrc && echo -n "$NEXUS_USER:$NEXUS_PASSWORD" | base64 >> .npmrc
|
|
|
|
- echo "email=dev@friedl.net" >> .npmrc
|
|
|
|
- npm publish
|
|
|
|
|
2020-06-07 10:10:21 +00:00
|
|
|
- name: build-web
|
|
|
|
image: node:latest
|
2020-07-03 18:15:54 +00:00
|
|
|
volumes:
|
|
|
|
- name: node-cache
|
|
|
|
path: /drone/src/web/fling/node_modules
|
2020-06-12 13:31:42 +00:00
|
|
|
environment:
|
|
|
|
NEXUS_USER:
|
|
|
|
from_secret: nexus_user
|
|
|
|
NEXUS_PASSWORD:
|
|
|
|
from_secret: nexus_password
|
2020-07-11 23:31:25 +00:00
|
|
|
VERSION: 0.1.0-snapshot
|
2020-06-07 10:10:21 +00:00
|
|
|
commands:
|
|
|
|
- ls -al
|
|
|
|
- cd web/fling
|
2020-06-21 11:44:33 +00:00
|
|
|
- npm install && npm run build
|
2020-07-11 23:31:25 +00:00
|
|
|
- tar czf fling-web-$VERSION.tar.gz build/
|
|
|
|
- curl --user "$NEXUS_USER:$NEXUS_PASSWORD"
|
|
|
|
--upload-file ./fling-web-$VERSION.tar.gz
|
|
|
|
https://nexus.friedl.net/repository/build-artifacts/fling-web-$VERSION.tar.gz
|
2020-06-11 20:00:20 +00:00
|
|
|
|
|
|
|
- name: publish
|
|
|
|
image: plugins/docker
|
|
|
|
settings:
|
|
|
|
username:
|
|
|
|
from_secret: docker_username
|
|
|
|
password:
|
|
|
|
from_secret: docker_password
|
|
|
|
dockerfile: container/Dockerfile
|
2020-06-12 13:31:42 +00:00
|
|
|
context: ./container
|
2020-06-11 20:00:20 +00:00
|
|
|
repo: arminfriedl/fling
|
2020-07-11 23:31:25 +00:00
|
|
|
tags: 0.1.0-snapshot
|
2020-07-12 09:46:47 +00:00
|
|
|
build_args:
|
|
|
|
- VERSION=0.1.0-snapshot
|
2020-07-01 20:58:56 +00:00
|
|
|
|
2020-07-03 18:15:54 +00:00
|
|
|
volumes:
|
|
|
|
- name: m2-cache
|
|
|
|
host:
|
|
|
|
path: /var/services/drone/cache/fling/m2
|
|
|
|
- name: node-cache
|
|
|
|
host:
|
|
|
|
path: /var/services/drone/cache/fling/node
|