1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Add support for remote validation services. (#185)

* Simple tool to test the remote validation

* Added remote validator support to provider.

* Added remote validation to aggregator.

* Calm golint

* Removed csaf_remote_validator tool as it was only for dev.

* Re-added csaf_remote_validator tool. Testing is not done.

* Embed the document entirely

* Include testing the remote validator in the Itests

* Change permission of the script

* Remove code for Itests

* As these will be done in another branch

Co-authored-by: Fadi Abbud <fadi.abbud@intevation.de>
This commit is contained in:
Sascha L. Teichmann 2022-06-21 14:47:06 +02:00 committed by GitHub
parent 7cbbb4bf81
commit 78d8b89aca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 466 additions and 43 deletions

View file

@ -149,12 +149,12 @@ func (w *worker) setupProviderInterim(provider *provider) {
w.provider = provider
// Each job needs a separate client.
w.client = w.cfg.httpClient(provider)
w.client = w.processor.cfg.httpClient(provider)
}
func (w *worker) interimWork(wg *sync.WaitGroup, jobs <-chan *interimJob) {
defer wg.Done()
path := filepath.Join(w.cfg.Web, ".well-known", "csaf-aggregator")
path := filepath.Join(w.processor.cfg.Web, ".well-known", "csaf-aggregator")
for j := range jobs {
w.setupProviderInterim(j.provider)
@ -162,7 +162,7 @@ func (w *worker) interimWork(wg *sync.WaitGroup, jobs <-chan *interimJob) {
providerPath := filepath.Join(path, j.provider.Name)
j.err = func() error {
tx := newLazyTransaction(providerPath, w.cfg.Folder)
tx := newLazyTransaction(providerPath, w.processor.cfg.Folder)
defer tx.rollback()
// Try all the labels
@ -178,7 +178,7 @@ func (w *worker) interimWork(wg *sync.WaitGroup, jobs <-chan *interimJob) {
interimsCSV := filepath.Join(labelPath, "interims.csv")
interims, err := readInterims(
interimsCSV, w.cfg.InterimYears)
interimsCSV, w.processor.cfg.InterimYears)
if err != nil {
return err
}
@ -240,7 +240,7 @@ func (p *processor) interim() error {
log.Printf("Starting %d workers.\n", p.cfg.Workers)
for i := 1; i <= p.cfg.Workers; i++ {
wg.Add(1)
w := newWorker(i, p.cfg)
w := newWorker(i, p)
go w.interimWork(&wg, queue)
}