Adjust build process
This commit is contained in:
parent
99add9dbe2
commit
f64d5c2420
8 changed files with 31 additions and 6 deletions
|
@ -6,6 +6,7 @@ stages:
|
|||
include:
|
||||
- local: .gitlab/_common.gitlab-ci.yml
|
||||
- local: .gitlab/_rules.gitlab-ci.yml
|
||||
- local: /.gitlab/test.gitlab-ci.yml
|
||||
- local: /.gitlab/build.gitlab-ci.yml
|
||||
- local: /.gitlab/deploy.gitlab-ci.yml
|
||||
- template: Jobs/Secret-Detection.gitlab-ci.yml
|
||||
|
|
15
.gitlab/test.gitlab-ci.yml
Normal file
15
.gitlab/test.gitlab-ci.yml
Normal file
|
@ -0,0 +1,15 @@
|
|||
unit_tests:
|
||||
rules: !reference [.rules:default, rules]
|
||||
stage: test
|
||||
image: golang:$GOLANG_VERSION-alpine
|
||||
extends:
|
||||
- .go-cache
|
||||
script:
|
||||
- go install gotest.tools/gotestsum@latest
|
||||
- gotestsum --junitfile report.xml --format testname -- ./... -coverprofile=profile.cov
|
||||
- go tool cover -func profile.cov
|
||||
coverage: '/\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/'
|
||||
artifacts:
|
||||
when: always
|
||||
reports:
|
||||
junit: report.xml
|
|
@ -41,7 +41,6 @@ COPY ./scripts/entrypoint.sh .
|
|||
COPY --from=logo /logo.txt .
|
||||
COPY --from=nodeBuilder /app/dist/ ./templates/
|
||||
COPY --from=goBuilder /app/cafe-plaetschwiesle .
|
||||
COPY config.toml .
|
||||
|
||||
ARG VERSION
|
||||
ENV VERSION=$VERSION
|
||||
|
|
2
internal/env/env.go
vendored
2
internal/env/env.go
vendored
|
@ -14,7 +14,7 @@ type Config struct {
|
|||
TimeZone string `env:"TZ" envDefault:"Etc/UTC" validate:"timezone"`
|
||||
Port int `env:"PORT" envDefault:"8080" validate:"min=1024,max=49151"`
|
||||
LogLevel string `env:"LOG_LEVEL" envDefault:"info" validate:"oneof=debug info warn error panic fatal"`
|
||||
Version string `env:"APP_VERSION" envDefault:"v0.0.0"`
|
||||
Version string `env:"VERSION" envDefault:"v0.0.0"`
|
||||
SwaggerHost string `env:"SWAGGER_HOST" envDefault:"https://cafe.test"`
|
||||
DB_Host string `env:"DB_HOST"`
|
||||
DB_User string `env:"DB_USER"`
|
||||
|
|
|
@ -75,13 +75,13 @@ func SetupRoutes(e *echo.Echo, ctrl *controller.Controller, env *env.Config) {
|
|||
health := api.Group("/health", authHeader)
|
||||
{
|
||||
health.GET("", func(ctx echo.Context) error {
|
||||
return ctx.String(http.StatusOK, ".")
|
||||
return ctx.String(http.StatusOK, env.Version)
|
||||
})
|
||||
}
|
||||
|
||||
if env.SwaggerHost != "" {
|
||||
docs.SwaggerInfo.Title = "Cafe"
|
||||
docs.SwaggerInfo.Description = "This is the backend of a cafe"
|
||||
docs.SwaggerInfo.Title = "Café Plätschwiesle"
|
||||
docs.SwaggerInfo.Description = "This is the backend of Café Plätschwiesle"
|
||||
docs.SwaggerInfo.Version = env.Version
|
||||
docs.SwaggerInfo.BasePath = "/api"
|
||||
parsed, _ := url.Parse(env.SwaggerHost)
|
||||
|
|
|
@ -103,6 +103,7 @@ export default defineComponent({
|
|||
visible: () => maker.value,
|
||||
},
|
||||
{ label: "Abmelden", icon: "pi pi-fw pi-power-off", command: () => emit("logout") },
|
||||
{ label: store.getters.getVersion, icon: "pi pi-fw pi-github", disabled: true },
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { createApp } from "vue";
|
||||
import { createApp, version } from "vue";
|
||||
import { OpenAPI, UsersService } from "@/services/openapi";
|
||||
import App from "./App.vue";
|
||||
import router from "./router";
|
||||
|
@ -26,6 +26,7 @@ async function getHealth() {
|
|||
store.commit("setGroups", groups);
|
||||
const user = await UsersService.getUsers(response.headers.get("remote-name") || "Benutzer");
|
||||
store.commit("setUser", user);
|
||||
store.commit("setVersion", await response.text());
|
||||
}
|
||||
|
||||
getHealth().then(() => {
|
||||
|
|
|
@ -6,6 +6,7 @@ import { controller_User } from "@/services/openapi";
|
|||
interface AppStateModel {
|
||||
user: controller_User;
|
||||
groups: string[];
|
||||
version: string;
|
||||
}
|
||||
export default createStore({
|
||||
state: {
|
||||
|
@ -15,6 +16,7 @@ export default createStore({
|
|||
show_hot_drinks: true,
|
||||
},
|
||||
groups: [""],
|
||||
version: "",
|
||||
},
|
||||
getters: {
|
||||
getUser(state: AppStateModel) {
|
||||
|
@ -26,6 +28,9 @@ export default createStore({
|
|||
getUsername(state: AppStateModel) {
|
||||
return state.user.username;
|
||||
},
|
||||
getVersion(state: AppStateModel) {
|
||||
return state.version;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
setUser(state: AppStateModel, _user: controller_User) {
|
||||
|
@ -34,6 +39,9 @@ export default createStore({
|
|||
setGroups(state: AppStateModel, groups: string[]) {
|
||||
state.groups = groups;
|
||||
},
|
||||
setVersion(state: AppStateModel, version: string) {
|
||||
state.version = version;
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
modules: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue