-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,22 +2,28 @@ version: 2.1 | |
orbs: | ||
gradle: circleci/[email protected] | ||
workflows: | ||
backend: | ||
default: | ||
jobs: | ||
- build | ||
- pack: | ||
- be-build | ||
- ad-build | ||
- be-pack: | ||
requires: | ||
- build | ||
- be-build | ||
- ad-pack: | ||
requires: | ||
- ad-build | ||
- deploy: | ||
requires: | ||
- pack | ||
- be-pack | ||
- ad-pack | ||
- meta-pack | ||
filters: | ||
branches: | ||
only: | ||
- main | ||
|
||
jobs: | ||
build: | ||
be-build: | ||
environment: | ||
# Configure the JVM and Gradle to avoid OOM errors | ||
_JAVA_OPTIONS: "-Xmx3g" | ||
|
@@ -44,10 +50,36 @@ jobs: | |
- store_artifacts: | ||
path: build/libs | ||
- persist_to_workspace: | ||
root: . # why is this not an optional parameter? :shaking_head: | ||
root: ~/project | ||
paths: | ||
- backend/build/distributions/* | ||
|
||
ad-build: | ||
docker: | ||
- image: cimg/node:15.8.0 | ||
working_directory: ~/project/administration | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- restore_cache: | ||
keys: | ||
- v1-node-modules-{{ checksum "package-lock.json" }} | ||
- v1-node-modules- | ||
- run: | | ||
npm install | ||
npm run-script build | ||
- save_cache: | ||
paths: | ||
- node_modules | ||
key: v1-node-modules-{{ checksum "package-lock.json" }} | ||
- store_artifacts: | ||
path: build | ||
- persist_to_workspace: | ||
root: ~/project | ||
paths: | ||
- build/distributions/* | ||
pack: | ||
- administration/build | ||
|
||
be-pack: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/backend | ||
|
@@ -56,20 +88,58 @@ jobs: | |
path: ~/project | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: ../scripts/backend_deb.sh -v 0.1 -t /tmp/workspace/build/distributions/*.tar -s ../scripts/eak-backend.service | ||
- run: ../scripts/pack_deb.sh -v 0.1 -t /tmp/workspace/backend/build/distributions/*.tar -s ../scripts/eak-backend.service -d "Backend server for the Ehrenamtskarte app" -n "eak-backend" -c "default-jre" | ||
- run: | | ||
mkdir -p /tmp/artifacts | ||
cp *.deb /tmp/artifacts | ||
mkdir -p /tmp/artifacts/debs | ||
cp *.deb /tmp/artifacts/debs | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
- persist_to_workspace: | ||
root: . | ||
root: /tmp/artifacts | ||
paths: | ||
- ./*.deb | ||
- debs/*.deb | ||
|
||
ad-pack: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/administration | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
- run: ../scripts/pack_deb.sh -v 0.1 -f /tmp/workspace/administration/build -d "Administration backend for the Ehrenamtskarte app" -n "eak-administration" | ||
- run: | | ||
mkdir -p /tmp/artifacts/debs | ||
cp *.deb /tmp/artifacts/debs | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
- persist_to_workspace: | ||
root: /tmp/artifacts | ||
paths: | ||
- debs/*.deb | ||
|
||
meta-pack: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/administration | ||
steps: | ||
- checkout: | ||
path: ~/project | ||
- run: ../scripts/pack_deb.sh -v 0.1 -d "Meta package for the Ehrenamtskarte app" -n "eak" -c "eak-backend, eak-administration" | ||
- run: | | ||
mkdir -p /tmp/artifacts/debs | ||
cp *.deb /tmp/artifacts/debs | ||
- store_artifacts: | ||
path: /tmp/artifacts | ||
- persist_to_workspace: | ||
root: /tmp/artifacts | ||
paths: | ||
- debs/*.deb | ||
|
||
deploy: | ||
docker: | ||
- image: cimg/base:2020.01 | ||
working_directory: ~/project/backend | ||
steps: | ||
- attach_workspace: | ||
at: /tmp/workspace | ||
|
@@ -78,4 +148,4 @@ jobs: | |
- "5c:8a:70:dc:61:9d:fa:c2:c2:6d:2d:fc:4a:ab:d2:e3" | ||
- run: | | ||
echo $APT_HOST_FINGERPRINT > known_hosts | ||
sftp -b - -v -o UserKnownHostsFile=known_hosts [email protected]:/local-apt-repository/ \<<< "put -r /tmp/workspace/*.deb" | ||
sftp -b - -v -o UserKnownHostsFile=known_hosts [email protected]:/local-apt-repository/ \<<< "put -r /tmp/workspace/debs/*.deb" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,24 +4,27 @@ set -eo pipefail | |
# deb constants | ||
version=1.0 | ||
revision=1 | ||
name=eak-backend | ||
name=eak | ||
architecture=amd64 | ||
maintainer="The Ehrenamtskarte Team <[email protected]>" | ||
description="Backend server for the Ehrenamtskarte app" | ||
dependencies="default-jre" | ||
description="" | ||
dependencies="" | ||
|
||
# read input | ||
while getopts v:r:a:n:t:s:h flag | ||
while getopts v:r:a:n:t:s:f:h flag | ||
do | ||
case "${flag}" in | ||
v) version=${OPTARG};; | ||
r) revision=${OPTARG};; | ||
a) architecture=${OPTARG};; | ||
n) name=${OPTARG};; | ||
d) description=${OPTARG};; | ||
t) tarfile=${OPTARG};; | ||
f) adminfolder=${OPTARG};; | ||
s) servicefile=${OPTARG};; | ||
c) dependencies=${OPTARG};; | ||
h) | ||
echo "$0 [-v version] [-r revision] [-a architecture] [-n name] [-t backend_tar] [-s service_file]" | ||
echo "$0 [-v version] [-r revision] [-a architecture] [-n name] [-t backend_tar] [-s service_file] [-d description] [-f adminfolder] [-c dependencies]" | ||
exit 0;; | ||
*) | ||
echo "Unknown flag" | ||
|
@@ -56,7 +59,11 @@ if [[ -n "$servicefile" ]]; then | |
mkdir -p "${debworkdir}/etc/systemd/system" | ||
cp "$servicefile" "${debworkdir}/etc/systemd/system/${name}.service" | ||
fi | ||
|
||
if [[ -n "$adminfolder" ]]; then | ||
echo "Copying $adminfolder …" | ||
mkdir -p "${debworkdir}/opt/ehrenamtskarte/administration" | ||
cp "$adminfolder/"* "${debworkdir}/opt/ehrenamtskarte/administration" | ||
fi | ||
|
||
# build the deb | ||
dpkg-deb --build --root-owner-group "$debworkdir" "$debfile" | ||
|