Add custom location for jobs and fix exec of jobs
Gitea/ncDocConverter/pipeline/head This commit looks good Details

main
Jonas Letzbor 2023-01-06 18:40:39 +01:00
parent 65cfa0ec64
commit 3ce008c97e
Signed by: RPJosh
GPG Key ID: 46D72F589702E55A
6 changed files with 14 additions and 7 deletions

2
.gitignore vendored
View File

@ -34,5 +34,5 @@ go.work
# Build binaries # Build binaries
/ncDocConverth-* /ncDocConverth-*
# Note folder # Space for private notes
/notes /notes

7
Jenkinsfile vendored
View File

@ -27,9 +27,10 @@ pipeline {
} }
stage('Deploy') { stage('Deploy') {
when { // Tags not working with gitea?
buildingTag() //when {
} // buildingTag()
//}
steps { steps {
script { script {

View File

@ -53,13 +53,14 @@ func main() {
WriteTimeout: 10 * time.Second, WriteTimeout: 10 * time.Second,
} }
ncConvertUsers, err := models.ParseConvertUsers("./ncConverter.json") ncConvertUsers, err := models.ParseConvertUsers(webApp.config.Server.JobFile)
if err != nil { if err != nil {
logger.Error("Unable to parse the file %s: %s", "dd", err) logger.Error("Unable to parse the file %s: %s", "dd", err)
} }
ncworker.NewScheduler(ncConvertUsers, config) ncworker.NewScheduler(ncConvertUsers, config)
if 1 == 1 { if 1 == 1 {
// Webserver for BookStack hooks currently not implemented
return return
} }

View File

@ -9,6 +9,9 @@ server:
# Afterward the program does exit -> The "execution" field in the jobs are going to be ignored # Afterward the program does exit -> The "execution" field in the jobs are going to be ignored
oneShot: false oneShot: false
# Location of the file with the job configurations
JobFile: "./ncConverter.json"
logging: logging:
# Minimum log Level for printing to the console (debug, info, warning, error, fatal) # Minimum log Level for printing to the console (debug, info, warning, error, fatal)
printLogLevel: info printLogLevel: info

View File

@ -18,6 +18,7 @@ type Server struct {
Address string `yaml:"address"` Address string `yaml:"address"`
Certificate string `yaml:"certificate"` Certificate string `yaml:"certificate"`
OneShot bool `yaml:"oneShot"` OneShot bool `yaml:"oneShot"`
JobFile string `yaml:"JobFile"`
Version string Version string
} }
@ -49,6 +50,7 @@ func getDefaultConfig() *WebConfig {
return &WebConfig{ return &WebConfig{
Server: Server{ Server: Server{
Address: ":4000", Address: ":4000",
JobFile: "./ncConverter.json",
}, },
Logging: Logging{ Logging: Logging{
PrintLogLevel: "info", PrintLogLevel: "info",

View File

@ -87,7 +87,7 @@ func (s NcConvertScheduler) ScheduleExecutions() {
// Schedule Nextcloud jobs // Schedule Nextcloud jobs
for i, job := range user.ConvertJobs { for i, job := range user.ConvertJobs {
convJob := NewNcJob(&s.users.Users[ui].ConvertJobs[i], &s.users.Users[i]) convJob := NewNcJob(&s.users.Users[ui].ConvertJobs[i], &s.users.Users[ui])
_, err := s.scheduler.Cron(job.Execution).DoWithJobDetails(s.executeJob, convJob) _, err := s.scheduler.Cron(job.Execution).DoWithJobDetails(s.executeJob, convJob)
if err != nil { if err != nil {
@ -98,7 +98,7 @@ func (s NcConvertScheduler) ScheduleExecutions() {
// Schedule boockstack jobs // Schedule boockstack jobs
if user.BookStack.URL != "" { if user.BookStack.URL != "" {
for i, job := range user.BookStack.Jobs { for i, job := range user.BookStack.Jobs {
bsJob := NewBsJob(&s.users.Users[ui].BookStack.Jobs[i], &s.users.Users[i]) bsJob := NewBsJob(&s.users.Users[ui].BookStack.Jobs[i], &s.users.Users[ui])
_, err := s.scheduler.Cron(job.Execution).DoWithJobDetails(s.executeJob, bsJob) _, err := s.scheduler.Cron(job.Execution).DoWithJobDetails(s.executeJob, bsJob)
if err != nil { if err != nil {