Skip to content

Commit

Permalink
Merge pull request #3778 from PetrusZ/ft/feature_limit
Browse files Browse the repository at this point in the history
add freestyle and notification job limit
  • Loading branch information
jamsman94 authored Nov 1, 2024
2 parents 6d44396 + ac1f262 commit 4cfa47c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (
commonrepo "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/mongodb"
commonservice "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/service"
"github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/util"
commonutil "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/util"
e "github.com/koderover/zadig/v2/pkg/tool/errors"
"github.com/koderover/zadig/v2/pkg/tool/log"
"github.com/koderover/zadig/v2/pkg/types"
steptypes "github.com/koderover/zadig/v2/pkg/types/step"
Expand Down Expand Up @@ -548,6 +550,13 @@ func (j *FreeStyleJob) LintJob() error {
}
}

if j.spec.FreestyleJobType == config.ServiceFreeStyleJobType {
err := commonutil.CheckZadigProfessionalLicense()
if err != nil {
return e.ErrLicenseInvalid.AddDesc("")
}
}

j.job.Spec = j.spec
return checkOutputNames(j.spec.Outputs)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"github.com/koderover/zadig/v2/pkg/microservice/aslan/config"
commonmodels "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/models"
"github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/mongodb"
commonutil "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/util"
e "github.com/koderover/zadig/v2/pkg/tool/errors"
"github.com/koderover/zadig/v2/pkg/tool/log"
)

Expand Down Expand Up @@ -160,5 +162,10 @@ func (j *NotificationJob) LintJob() error {
if j.spec.Title == "" {
return fmt.Errorf("job title is empty")
}

err := commonutil.CheckZadigProfessionalLicense()
if err != nil {
return e.ErrLicenseInvalid.AddDesc("")
}
return nil
}

0 comments on commit 4cfa47c

Please sign in to comment.