Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 0 additions & 1 deletion pkg/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func newDefaults(project Project) Config {
Branches: Branches{
Main: "main",
ReleaseNext: "release-next",
SynchCI: "ci/",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I missed this. I need to restore this line, as it breaks daily check PR on kn-event.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe better to introduce a skip flag. Configuring an empty value might not be possible, due to processing of the defaults.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#48 fixes this

ReleaseTemplates: ReleaseTemplates{
Upstream: releaseTemplate,
Downstream: releaseTemplate,
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type Messages struct {
type Branches struct {
Main string `json:"main" valid:"required"`
ReleaseNext string `json:"releaseNext" valid:"required"`
SynchCI string `json:"synchCi" valid:"required"`
SyncCi string `json:"syncCi"`
ReleaseTemplates `json:"releaseTemplates"`
Searches `json:"searches"`
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sync/create_pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func (o Operation) createSyncReleaseNextPR() error {
o.triggerCIMessage(),
fmt.Sprintf(o.Config.Messages.TriggerCIBody, branches.ReleaseNext, branches.Main),
branches.ReleaseNext,
branches.SynchCI+branches.ReleaseNext,
branches.SyncCi+branches.ReleaseNext,
)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/sync/resync_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r resyncRelease) run() error {
if err != nil {
return errors.Wrap(err, ErrSyncFailed)
}
syncBranch := r.Config.Branches.SynchCI + downstreamBranch
syncBranch := r.Config.Branches.SyncCi + downstreamBranch
r.Printf("Re-syncing release: %s\n", color.Blue(r.rel.String()))
downstreamRemote := git.Remote{
Name: "downstream",
Expand Down
12 changes: 10 additions & 2 deletions pkg/sync/trigger_ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/openshift-knative/deviate/pkg/config/git"
"github.com/openshift-knative/deviate/pkg/errors"
"github.com/openshift-knative/deviate/pkg/log/color"
)

func (o Operation) triggerCI() error {
Expand All @@ -27,11 +28,18 @@ type triggerCI struct {

func (c triggerCI) run() error {
c.Println("Trigger CI")

// If SyncCi is not explicitly set (i.e., it's an empty string), skip this feature.
if c.Config.Branches.SyncCi == "" {
c.Println(color.Yellow("Skipping CI trigger because 'branches.syncCi' is not configured."))
return nil
}

return runSteps([]step{
c.checkout,
c.addChange,
c.commitChanges(c.triggerCIMessage()),
c.pushBranch(c.Config.Branches.SynchCI + c.Config.Branches.ReleaseNext),
c.pushBranch(c.Config.Branches.SyncCi + c.Config.Branches.ReleaseNext),
})
}

Expand All @@ -41,7 +49,7 @@ func (c triggerCI) checkout() error {
URL: c.Config.Downstream,
}
err := c.Repository.Checkout(remote, c.Config.Branches.ReleaseNext).
As(c.Config.Branches.SynchCI + c.Config.Branches.ReleaseNext)
As(c.Config.Branches.SyncCi + c.Config.Branches.ReleaseNext)
return errors.Wrap(err, ErrSyncFailed)
}

Expand Down