Skip to content
Snippets Groups Projects
Commit 67fde387 authored by Alexis POYEN's avatar Alexis POYEN
Browse files

Merge branch '3-ci' into 'master'

Resolve "CI"

Closes #3

See merge request apoyen/elections!2
parents 460d7a9f c75aea46
No related branches found
No related tags found
1 merge request!2Resolve "CI"
Pipeline #5273 passed
.env 0 → 100644
HOSTNAME=elections.127.0.0.1.nip.io
ADMIN_GROUP=ADMINS
CLIENT_GROUP=VISUALIZER
# Needed to user OAuth2 authentication :
REDIRECT_URL=https://${HOSTNAME}/OAuth2Callback
CLIENT_ID=__GET_ONE_FROM_YOUR_IDP__
CLIENT_SECRET=__GET_ONE_FROM_YOUR_IDP__
AUTH_URL=https://myidp.fr/IdPOAuth2/authorize/oidc-rec
TOKEN_URL=https://myidp.fr/IdPOAuth2/token/oidc-rec
USERINFO_URL=https://myidp.fr/IdPOAuth2/userinfo/oidc-rec
LOGOUT_URL=https://myidp.fr/auth/logout.jsp
__debug_bin
data
\ No newline at end of file
#
# Ce fichier doit être adapté en fonction du projet en renseignant les variables SONAR_PROJECT_KEY et SONAR_TOKEN dans la configuration graphique du projet (https://forge.grandlyon.com/<CHEMIN_DE_VOTRE_PROJET>/settings/ci_cd)
# La variable SONAR_PROJET_KEY peut être trouvée sur https://sonarqube.forge.grandlyon.com/dashboard en ouvrant le projet et en copiant collant le champ en bas à droite (Project Key)
#
# La variable SONAR_TOKEN doit être générée par le responsable du projet depuis son interface sonar : https://sonarqube.forge.grandlyon.com/account/security/
#
image: docker:git
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
SONAR_URL: https://sonarqube.forge.grandlyon.com
stages:
- sonar-analysis
- build
sonarqube:
stage: sonar-analysis
image: skilldlabs/sonar-scanner:3.4.0
script:
- >
sonar-scanner
-Dsonar.projectName=${CI_PROJECT_NAME}
-Dsonar.projectVersion=1.0
-Dsonar.sourceEncoding=UTF-8
-Dsonar.projectBaseDir=.
-Dsonar.host.url=${SONAR_URL}
-Dsonar.projectKey=${SONAR_PROJECT_KEY}
-Dsonar.login=${SONAR_TOKEN}
build-master:
stage: build
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- DOCKER_BUILDKIT=1 docker build --pull -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE"
only:
- master
build:
stage: build
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- DOCKER_BUILDKIT=1 docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
except:
- master
......@@ -39,7 +39,7 @@ type election struct {
name string
ballotType string
areas []area
Rounds []Round
rounds []round
}
type area struct {
......@@ -102,7 +102,6 @@ type parameter struct {
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-"`
roundID round
countBalnkAndNull bool
showOnlyCompleted bool
showMap bool
......@@ -113,7 +112,7 @@ type round struct {
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-"`
ElectionID uint
electionID uint
parameter parameter
name string
date time.Time
......@@ -127,11 +126,11 @@ type deskRound struct {
CreatedAt time.Time `json:"-"`
UpdatedAt time.Time `json:"-"`
DeletedAt *time.Time `json:"-"`
RoundID uint
roundID uint
completed bool
dateCompletion time.Time
validated bool
votes []Vote
votes []vote
}
type candidateList struct {
ID uint `gorm:"primary_key"`
......@@ -143,7 +142,7 @@ type candidateList struct {
area area `gorm:"foreignkey:AreaRefer"`
name string
candidates []candidate
votes []Vote
votes []vote
}
type candidate struct {
......@@ -180,10 +179,19 @@ func NewDataHandler() *DataHandler {
}
db.LogMode(true)
// Add FK with SQLite doesn't work
// db.Model(&Operation{}).AddForeignKey("creditor", "bank_account(id)", "Set Null", "Set Null")
// Migrate the schema
db.AutoMigrate(&capturer{})
db.AutoMigrate(&election{})
db.AutoMigrate(&area{})
db.AutoMigrate(&section{})
db.AutoMigrate(&desk{})
db.AutoMigrate(&round{})
db.AutoMigrate(&deskRound{})
db.AutoMigrate(&party{})
db.AutoMigrate(&candidateList{})
db.AutoMigrate(&candidate{})
db.AutoMigrate(&vote{})
db.AutoMigrate(&parameter{})
return &DataHandler{db: db}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment