Skip to content

Commit

Permalink
lastCommit is no longer needed, removing it (#189)
Browse files Browse the repository at this point in the history
Signed-off-by: Sally O'Malley <somalley@redhat.com>
  • Loading branch information
sallyom committed Jun 3, 2022
1 parent 4e2f21a commit 08858af
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
33 changes: 0 additions & 33 deletions pkg/engine/fetchit.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,40 +202,7 @@ func (hc *FetchitConfig) InitConfig(initial bool) {
cobra.CheckErr(err)
}

beforeTargets := len(hc.Targets)
hc.Targets = config.Targets
if beforeTargets > 0 {
// replace lastCommit - to avoid re-running same jobs, since the scheduler finished all jobs
// with the last commit before arriving here
for i, t := range hc.Targets {
if t.Methods.Raw != nil {
if config.Targets[i].Methods.Raw != nil {
t.Methods.Raw.lastCommit = config.Targets[i].Methods.Raw.lastCommit
}
}
if t.Methods.Kube != nil {
if config.Targets[i].Methods.Kube != nil {
t.Methods.Kube.lastCommit = config.Targets[i].Methods.Kube.lastCommit
}
}
if t.Methods.Ansible != nil {
if config.Targets[i].Methods.Ansible != nil {
t.Methods.Ansible.lastCommit = config.Targets[i].Methods.Ansible.lastCommit
}
}
if t.Methods.FileTransfer != nil {
if config.Targets[i].Methods.FileTransfer != nil {
t.Methods.FileTransfer.lastCommit = config.Targets[i].Methods.FileTransfer.lastCommit
}
}
if t.Methods.Systemd != nil {
if config.Targets[i].Methods.Systemd != nil {
t.Methods.Systemd.lastCommit = config.Targets[i].Methods.Systemd.lastCommit
}
}
}
}

// look for a ConfigFileTarget, only find the first
// TODO: add logic to merge multiple configs
for _, t := range hc.Targets {
Expand Down
12 changes: 0 additions & 12 deletions pkg/engine/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package engine

import (
"sync"

"github.com/go-git/go-git/v5/plumbing/object"
)

type Target struct {
Expand Down Expand Up @@ -63,8 +61,6 @@ type RawTarget struct {
PullImage bool `mapstructure:"pullImage"`
// initialRun is set by fetchit
initialRun bool
// lastCommit is set by fetchit
lastCommit *object.Commit
}

// SystemdTarget to place and/or enable systemd unit files on host
Expand Down Expand Up @@ -99,8 +95,6 @@ type SystemdTarget struct {
Skew *int `mapstructure:"skew"`
// initialRun is set by fetchit
initialRun bool
// lastCommit is set by fetchit
lastCommit *object.Commit
}

// FileTransferTarget to place files on host system
Expand All @@ -116,8 +110,6 @@ type FileTransferTarget struct {
Skew *int `mapstructure:"skew"`
// initialRun is set by fetchit
initialRun bool
// lastCommit is set by fetchit
lastCommit *object.Commit
}

// KubeTarget to launch pods using podman kube-play
Expand All @@ -131,8 +123,6 @@ type KubeTarget struct {
Skew *int `mapstructure:"skew"`
// initialRun is set by fetchit
initialRun bool
// lastCommit is set by fetchit
lastCommit *object.Commit
}

// AnsibleTarget to place and run ansible playbooks
Expand All @@ -148,8 +138,6 @@ type AnsibleTarget struct {
SshDirectory string `mapstructure:"sshDirectory"`
// initialRun is set by fetchit
initialRun bool
// lastCommit is set by fetchit
lastCommit *object.Commit
}

// Clean configures targets to run a system prune periodically
Expand Down

0 comments on commit 08858af

Please sign in to comment.