Skip to content

Commit

Permalink
requie export-path flage on export set config command
Browse files Browse the repository at this point in the history
  • Loading branch information
guy-har committed Nov 12, 2020
1 parent 892f092 commit 890938c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions export/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package export

import (
"context"
"errors"
"fmt"

nanoid "github.com/matoous/go-nanoid"
Expand All @@ -19,6 +20,8 @@ func getExportID(repo, branch, commitRef string) (string, error) {
return fmt.Sprintf("%s-%s-%s-%s", repo, branch, commitRef, nid), nil
}

var ErrExportInProgress = errors.New("export currently in progress")

// ExportBranchStart inserts a start task on branch, sets branch export state to pending.
// It returns an error if an export is already in progress.
func ExportBranchStart(paradeDB parade.Parade, cataloger catalog.Cataloger, repo, branch string) (string, error) {
Expand All @@ -36,6 +39,9 @@ func ExportBranchStart(paradeDB parade.Parade, cataloger catalog.Cataloger, repo
if err != nil {
return "", nil, err
}
if state == catalog.ExportStatusInProgress {
return state, nil, ErrExportInProgress
}
tasks, err := GetStartTasks(repo, branch, oldRef, commitRef, exportID, config)
if err != nil {
return "", nil, err
Expand Down

0 comments on commit 890938c

Please sign in to comment.