diff --git a/pkg/client/client.go b/pkg/client/client.go index 0554085..ecf35ee 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -80,6 +80,7 @@ func (c *Client) Run() error { for _, dest := range destList { // TODO: support multiple destinations for one task ruleTask, err := task.NewRuleTask(source, dest, + c.config.osFilterList, c.config.archFilterList, func(repository string) types.Auth { auth, exist := c.config.GetAuth(repository) if !exist { diff --git a/pkg/task/rule.go b/pkg/task/rule.go index c7c4f3e..c9cdb3e 100644 --- a/pkg/task/rule.go +++ b/pkg/task/rule.go @@ -14,12 +14,15 @@ type RuleTask struct { source string destination string + osFilterList, archFilterList []string + getAuthFunc func(repository string) types.Auth forceUpdate bool } func NewRuleTask(source, destination string, + osFilterList, archFilterList []string, getAuthFunc func(repository string) types.Auth, forceUpdate bool) (*RuleTask, error) { if source == "" { return nil, fmt.Errorf("source url should not be empty") @@ -30,10 +33,12 @@ func NewRuleTask(source, destination string, } return &RuleTask{ - source: source, - destination: destination, - getAuthFunc: getAuthFunc, - forceUpdate: forceUpdate, + source: source, + destination: destination, + getAuthFunc: getAuthFunc, + osFilterList: osFilterList, + archFilterList: archFilterList, + forceUpdate: forceUpdate, }, nil } @@ -64,8 +69,13 @@ func (r *RuleTask) Run() ([]Task, string, error) { var results []Task for index, s := range sourceURLs { - results = append(results, NewURLTask(s, destinationURLs[index], r.getAuthFunc(s.GetURLWithoutTagOrDigest()), - r.getAuthFunc(destinationURLs[index].GetURLWithoutTagOrDigest()), r.forceUpdate)) + results = append(results, + NewURLTask(s, destinationURLs[index], + r.getAuthFunc(s.GetURLWithoutTagOrDigest()), + r.getAuthFunc(destinationURLs[index].GetURLWithoutTagOrDigest()), + r.osFilterList, r.archFilterList, r.forceUpdate, + ), + ) } return results, "", nil diff --git a/pkg/task/url.go b/pkg/task/url.go index d546203..cae5b6b 100644 --- a/pkg/task/url.go +++ b/pkg/task/url.go @@ -27,12 +27,17 @@ type URLTask struct { forceUpdate bool } -func NewURLTask(source, destination *utils.RepoURL, sourceAuth, destinationAuth types.Auth, forceUpdate bool) Task { +func NewURLTask(source, destination *utils.RepoURL, + sourceAuth, destinationAuth types.Auth, + osFilterList, archFilterList []string, + forceUpdate bool) Task { return &URLTask{ source: source, destination: destination, sourceAuth: sourceAuth, destinationAuth: destinationAuth, + osFilterList: osFilterList, + archFilterList: archFilterList, forceUpdate: forceUpdate, } }