Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix project pull webhook args #828

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/config/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ type Projects []Project

// NewProject returns a new project composed with the default parameters.
func NewProject(name string) (p Project) {

defaults.MustSet(&p)
p.Name = name

Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
)

// PullProject ..
func (c *Controller) PullProject(ctx context.Context, name string) error {
func (c *Controller) PullProject(ctx context.Context, name string, pull config.ProjectPull) error {
gp, err := c.Gitlab.GetProject(ctx, name)
if err != nil {
return err
}

p := schemas.NewProject(gp.PathWithNamespace)
p.Pull = pull

projectExists, err := c.Store.ProjectExists(ctx, p.Key())
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ func NewTaskController(ctx context.Context, r *redis.Client, maximumJobsQueueSiz
}

// TaskHandlerPullProject ..
func (c *Controller) TaskHandlerPullProject(ctx context.Context, name string) error {
func (c *Controller) TaskHandlerPullProject(ctx context.Context, name string, pull config.ProjectPull) error {
defer c.unqueueTask(ctx, schemas.TaskTypePullProject, name)

return c.PullProject(ctx, name)
return c.PullProject(ctx, name, pull)
}

// TaskHandlerPullProjectsFromWildcard ..
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (c *Controller) triggerRefMetricsPull(ctx context.Context, ref schemas.Ref)
}

if matches {
c.ScheduleTask(context.TODO(), schemas.TaskTypePullProject, ref.Project.Name)
c.ScheduleTask(context.TODO(), schemas.TaskTypePullProject, ref.Project.Name, ref.Project.Name, w.Pull)
mvisonneau marked this conversation as resolved.
Show resolved Hide resolved
log.WithFields(logFields).Info("project ref not currently exported but its configuration matches a wildcard, triggering a pull of the project")
} else {
log.WithFields(logFields).Debug("project ref not matching wildcard, skipping..")
Expand Down Expand Up @@ -284,7 +284,7 @@ func (c *Controller) triggerEnvironmentMetricsPull(ctx context.Context, env sche
}

if matches {
c.ScheduleTask(context.TODO(), schemas.TaskTypePullProject, env.ProjectName)
c.ScheduleTask(context.TODO(), schemas.TaskTypePullProject, env.ProjectName, env.ProjectName, w.Pull)
log.WithFields(logFields).Info("project environment not currently exported but its configuration matches a wildcard, triggering a pull of the project")
} else {
log.WithFields(logFields).Debug("project ref not matching wildcard, skipping..")
Expand Down
Loading