15 Commits

8 changed files with 109 additions and 21 deletions

View File

@ -1,30 +1,12 @@
stages:
- build
- check
- build
- dockerize
- deploy
variables:
IMAGE_NAME: $CI_REGISTRY/$CI_PROJECT_PATH
build:
image: node:14-buster
stage: build
tags:
- hottis
- linux
- docker
rules:
- if: $CI_COMMIT_TAG
artifacts:
paths:
- dist.tgz
expire_in: 1 day
script:
- cd hv2-ui
- npm install
- ./node_modules/.bin/ng build --prod
- tar -czf ../dist.tgz dist
check:
image: registry.hottis.de/dockerized/base-build-env:latest
stage: check
@ -40,6 +22,34 @@ check:
--validateMessage
--messageToValidate "$CI_COMMIT_MESSAGE"
build:
image: registry.hottis.de/hv2/hv2-node-build-env:1.0.0
stage: build
variables:
GIT_SUBMODULE_STRATEGY: recursive
tags:
- hottis
- linux
- docker
artifacts:
paths:
- dist.tgz
expire_in: 1 day
script:
- cd hv2-ui
- if [ "$CI_COMMIT_TAG" != "" ]; then
sed -i -e 's/GITTAGVERSION/'"$CI_COMMIT_TAG"':'"$CI_COMMIT_SHORT_SHA"'/' ./src/app/navigation/navigation.component.html;
fi
- npm install
- for F in ./src/app/*.tmpl; do
python ../helpers/hv2-api/generate.py -s ../helpers/hv2-api/schema.json -t $F;
done
- ./node_modules/.bin/ng build --prod
- tar -czf ../dist.tgz dist
dockerize:
image: registry.hottis.de/dockerized/docker-bash:latest
stage: dockerize
@ -56,3 +66,23 @@ dockerize:
- docker push $IMAGE_NAME:latest
- docker push $IMAGE_NAME:$CI_COMMIT_TAG
deploy:
stage: deploy
image: registry.hottis.de/dockerized/docker-bash:latest
only:
- tags
tags:
- hottis
- linux
- docker
variables:
GIT_STRATEGY: none
script:
- CONTAINER_NAME=$CI_PROJECT_NAME
- docker stop $CONTAINER_NAME || echo "$CONTAINER_NAME not running, anyway okay"
- docker rm $CONTAINER_NAME || echo "$CONTAINER_NAME not exsting, anyway okay"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY;
- docker pull $IMAGE_NAME:${CI_COMMIT_TAG}
- docker run -d --restart always --name $CONTAINER_NAME --network docker-server --ip 172.16.10.39 $IMAGE_NAME:${CI_COMMIT_TAG}

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "helpers/hv2-api"]
path = helpers/hv2-api
url = ../hv2-api

1
helpers/hv2-api Submodule

Submodule helpers/hv2-api added at 717d2bc7d8

View File

@ -7,7 +7,9 @@
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
"e2e": "ng e2e",
"generate": "python ../helpers/hv2-api/generate.py -s ../helpers/hv2-api/schema.json -t ./src/app/*.tmpl"
},
"private": true,
"dependencies": {

View File

@ -0,0 +1,35 @@
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { MessageService } from './message.service';
import { serviceBaseUrl } from './config';
#for $table in $tables
import { ${JsNameConverter($table.name)} } from './data-objects';
#end for
@Injectable({
providedIn: 'root'
})
#from generateHelper import JsNameConverter
#for $table in $tables
export class ${JsNameConverter($table.name)}Service {
constructor(private messageService: MessageService, private http: HttpClient) { }
async get${JsNameConverter($table.name)}(): Promise<${JsNameConverter($table.name)}> {
this.messageService.add(`${JsNameConverter($table.name)}Service: fetch data`);
return this.http.get<${JsNameConverter($table.name)}>(`\${serviceBaseUrl}/v1/${table.name}`).toPromise()
}
}
#end for

View File

@ -0,0 +1,11 @@
#from generateHelper import JsNameConverter
#for $table in $tables
export interface $JsNameConverter($table.name) {
#for $column in $table.columns
${column.name}: ${column.jstype}
#end for
}
#end for

View File

@ -18,4 +18,9 @@
.spacer {
flex: 1 1 auto;
}
.gittagversion {
font-size: x-small;
margin-right: 5em;
}

View File

@ -20,6 +20,7 @@
</button>
<span>Nober Grundbesitz GbR Hausverwaltung</span>
<span class="spacer"></span>
<span class="gittagversion">GITTAGVERSION</span>
<a *ngIf="!authenticated" mat-button routerLink="/login">Login</a>
<a *ngIf="authenticated" mat-button routerLink="/logout">Logout</a>
</mat-toolbar>