-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbitbucket-pipelines.yml
More file actions
82 lines (79 loc) · 3.35 KB
/
bitbucket-pipelines.yml
File metadata and controls
82 lines (79 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
image: metasolutions/jdk-node
options:
max-time: 10
stepdefinitions:
- build: &build
name: Build
caches:
- maven
script:
- java -version
- mvn --version
- mvn clean install -DskipITs
- rm -rf ~/.m2/repository/org/entrystore/
artifacts:
- standalone/jetty/target/**
- webapp/target/*.jar
- webapp/target/*.war
- testpg: &testpg
name: Integration Test PostgreSQL
caches:
- maven
- docker
script:
- java -version
- mvn --version
- export TESTCONTAINERS_RYUK_DISABLED=true
- cd webapp
- mvn verify -Dsurefire.skip=true
services:
- docker
- deploy: &deploy
name: Deploy
script:
- gpg --version
- echo $GPG_SIGN_KEY | base64 -d | gpg --import
- gpg --list-secret-keys
- export VERSION=`cat VERSION.txt` && echo $VERSION
# We allow semantic versioning plus x.y-z (e.g. 4.10-SNAPSHOT which does not exactly conform to semver)
- echo $VERSION | grep -P -q '^(0|[1-9]\d*)\.(0|[1-9]\d*)(\.*)(0*|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$'
- export FILE_BASE="rowstore-jetty-$VERSION" && echo $FILE_BASE
- ( cd standalone/jetty/target/dist/ && tar czf ${FILE_BASE}.tar.gz * && sha256sum ${FILE_BASE}.tar.gz > ${FILE_BASE}.tar.gz.sha256 && gpg --clearsign --default-key 4C12C06EE69EBA383C1A47C61010232068FF1D01 ${FILE_BASE}.tar.gz.sha256 )
- scp -v standalone/jetty/target/dist/{*.tar.gz,*.sha256.asc} deploy@meta1.metasolutions.se:/var/www/entrystore.org/download/rowstore/
- if [ $BITBUCKET_BRANCH == "develop" ]; then ssh deploy@meta1.metasolutions.se "echo $VERSION > /var/www/entrystore.org/download/rowstore/develop.version" ; elif [ $BITBUCKET_BRANCH == "master" ]; then ssh deploy@meta1.metasolutions.se "echo $VERSION > /var/www/entrystore.org/download/rowstore/latest.version" ; fi
- dockerhub: &dockerhub
name: Docker Hub
script:
- docker version
- export VERSION=`cat VERSION.txt` && echo $VERSION
- export VERSION_MAJOR_MINOR=${VERSION%.*} && echo $VERSION_MAJOR_MINOR
- git clone -b master git@bitbucket.org:metasolutions/docker.git
- docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASSWORD
- cd docker/rowstore
- ls -l
- docker build --build-arg ROWSTORE_VERSION=$VERSION --pull --no-cache --tag metasolutions/rowstore:$VERSION .
- docker push metasolutions/rowstore:$VERSION
- if [ $BITBUCKET_BRANCH == "develop" ]; then docker tag metasolutions/rowstore:$VERSION metasolutions/rowstore:develop ; docker push metasolutions/rowstore:develop ; fi
- if [ $BITBUCKET_BRANCH == "master" ]; then docker tag metasolutions/rowstore:$VERSION metasolutions/rowstore:$VERSION_MAJOR_MINOR ; docker push metasolutions/rowstore:$VERSION_MAJOR_MINOR ; fi
services:
- docker
caches:
- docker
pipelines:
default:
- step: *build
- parallel:
- step: *testpg
branches:
master:
- step: *build
- parallel:
- step: *testpg
- step: *deploy
- step: *dockerhub
develop:
- step: *build
- parallel:
- step: *testpg
- step: *deploy
- step: *dockerhub