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
2 changes: 1 addition & 1 deletion Makefile.core.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fmt: format-go tidy-go
test:
@go test -race ./...

gen: generate-config tidy-go mirror-licenses
gen: generate-config fmt mirror-licenses

gen-check: gen check-clean-repo

Expand Down
2 changes: 0 additions & 2 deletions boskos/cmd/mason/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ package main
import (
"context"
"flag"

"os"
"os/signal"
"syscall"
"time"

"github.com/sirupsen/logrus"

corev1 "k8s.io/api/core/v1"
"sigs.k8s.io/boskos/client"
"sigs.k8s.io/boskos/crds"
Expand Down
1 change: 0 additions & 1 deletion boskos/gcp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ func (rc resourceConfigs) construct(ctx context.Context, res common.Resource, ty
})
}
}

}
if err := errGroup.Wait(); err != nil {
logrus.WithError(err).Errorf("failed to construct resources for %s", res.Name)
Expand Down
75 changes: 41 additions & 34 deletions boskos/gcp/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"time"

container "google.golang.org/api/container/v1beta1"

"sigs.k8s.io/boskos/common"
"sigs.k8s.io/boskos/mason"
)
Expand Down Expand Up @@ -178,9 +177,7 @@ func TestParseConfig(t *testing.T) {
t.Errorf("Needs do not match for config %s. Expected %v found %v", config.Type, config.Needs, needs)
}
}

}

}
}

Expand Down Expand Up @@ -255,7 +252,7 @@ func TestResourcesConfig_Construct(t *testing.T) {
info *ResourceInfo
}

var testCases = []struct {
testCases := []struct {
name string
rc resourceConfigs
res common.Resource
Expand Down Expand Up @@ -336,13 +333,15 @@ func TestResourcesConfig_Construct(t *testing.T) {
name: "timeout vm creation",
setClient: true,
rc: resourceConfigs{
"test": {{
Clusters: []clusterConfig{
{},
"test": {
{
Clusters: []clusterConfig{
{},
},
Vms: []virtualMachineConfig{
{},
},
},
Vms: []virtualMachineConfig{
{},
}},
},
},
res: common.Resource{
Expand All @@ -364,13 +363,15 @@ func TestResourcesConfig_Construct(t *testing.T) {
name: "timeout cluster creation",
setClient: true,
rc: resourceConfigs{
"test": {{
Clusters: []clusterConfig{
{},
"test": {
{
Clusters: []clusterConfig{
{},
},
Vms: []virtualMachineConfig{
{},
},
},
Vms: []virtualMachineConfig{
{},
}},
},
},
res: common.Resource{
Expand Down Expand Up @@ -420,13 +421,15 @@ func TestResourcesConfig_Construct(t *testing.T) {
name: "failed cluster creation",
setClient: true,
rc: resourceConfigs{
"test": {{
Clusters: []clusterConfig{
{},
"test": {
{
Clusters: []clusterConfig{
{},
},
Vms: []virtualMachineConfig{
{},
},
},
Vms: []virtualMachineConfig{
{},
}},
},
},
res: common.Resource{
Expand All @@ -448,13 +451,15 @@ func TestResourcesConfig_Construct(t *testing.T) {
name: "running out project",
setClient: true,
rc: resourceConfigs{
"test": {{
Clusters: []clusterConfig{
{},
"test": {
{
Clusters: []clusterConfig{
{},
},
Vms: []virtualMachineConfig{
{},
},
},
Vms: []virtualMachineConfig{
{},
}},
},
},
res: common.Resource{
Expand All @@ -472,13 +477,15 @@ func TestResourcesConfig_Construct(t *testing.T) {
{
name: "client not set",
rc: resourceConfigs{
"test": {{
Clusters: []clusterConfig{
{},
"test": {
{
Clusters: []clusterConfig{
{},
},
Vms: []virtualMachineConfig{
{},
},
},
Vms: []virtualMachineConfig{
{},
}},
},
},
res: common.Resource{
Expand Down
1 change: 0 additions & 1 deletion boskos/gcp/gcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

"github.com/ghodss/yaml"
container "google.golang.org/api/container/v1beta1"

clientapi "k8s.io/client-go/tools/clientcmd/api/v1"

"istio.io/test-infra/toolbox/util"
Expand Down
2 changes: 0 additions & 2 deletions boskos/gcp/gke.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func (cc *containerEngine) waitForReady(ctx context.Context, cluster, project, z
if err := os.Remove(kubeconfigFile.Name()); err != nil {
logrus.WithError(err).Errorf("failed to delete file %s", kubeconfigFile.Name())
}

}()

if err := SetKubeConfig(project, zone, cluster, kubeconfigFile.Name()); err != nil {
Expand All @@ -92,7 +91,6 @@ func (cc *containerEngine) waitForReady(ctx context.Context, cluster, project, z
err := checkCluster(kubeconfigFile.Name())
if err != nil {
logrus.WithError(err).Errorf("cluster %s in zone %s for project %s is not ready", cluster, zone, project)

} else {
logrus.Infof("cluster %s in zone %s for project %s is ready", cluster, zone, project)
return nil
Expand Down
6 changes: 4 additions & 2 deletions prow/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ import (
"k8s.io/test-infra/prow/plugins"
)

var configPath = flag.String("config", "../config.yaml", "Path to prow config")
var jobConfigPath = flag.String("job-config", "../cluster/jobs/", "Path to prow job config")
var (
configPath = flag.String("config", "../config.yaml", "Path to prow config")
jobConfigPath = flag.String("job-config", "../cluster/jobs/", "Path to prow job config")
)

// Loaded at TestMain.
var c *config.Config
Expand Down
2 changes: 1 addition & 1 deletion prow/config/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestGenerateConfig(t *testing.T) {
}

func TestFilterReleaseBranchingJobs(t *testing.T) {
var testCases = []struct {
testCases := []struct {
name string
jobs []Job
filteredJobs []Job
Expand Down
7 changes: 1 addition & 6 deletions prow/genjobs/cmd/genjobs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ const (
yamlExt = ".(yml|yaml)$"
)

var (
defaultJobTypes = []string{"presubmit", "postsubmit", "periodic"}
)
var defaultJobTypes = []string{"presubmit", "postsubmit", "periodic"}

// sortOrder is the type to define sort order.
type sortOrder string
Expand Down Expand Up @@ -185,7 +183,6 @@ func (o *options) parseConfiguration() []options {
}

for _, c := range o.Configs {

if err := filepath.Walk(c, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil
Expand Down Expand Up @@ -527,7 +524,6 @@ volume:
job.Spec.Volumes[i] = vol
continue volume
}

}

job.Spec.Volumes = append(job.Spec.Volumes, vol)
Expand Down Expand Up @@ -866,7 +862,6 @@ func sortJobs(o options, pre map[string][]config.Presubmit, post map[string][]co
sort.Slice(per, func(a, b int) bool {
return comparator(per[a].Name, per[b].Name)
})

}

// getOutPath derives the output path from the specified input directory and current path.
Expand Down
1 change: 0 additions & 1 deletion prow/rewriteConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ repos:
if strings.Compare(output, string(correctOutput)) != 0 {
t.Fail()
}

}

func TestMasterForMasterWithConentsNoNeedsAdmin(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions toolbox/githubctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func getBaseSha(repo string, prNumber int) (string, error) {
return "", err
}

var allCommitShas = make(map[string]bool)
allCommitShas := make(map[string]bool)
for _, commit := range commits {
allCommitShas[*commit.SHA] = true
}
Expand All @@ -78,7 +78,6 @@ func getBaseSha(repo string, prNumber int) (string, error) {
}
}
return "", errors.New("base cannot be found")

}

// CreateReleaseRequest triggers release pipeline by creating a PR.
Expand Down
2 changes: 1 addition & 1 deletion toolbox/metrics/buildfreshness/buildFreshness.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func GetAgeMetrics(owner, repo, branch string) ([]DepFreshness, error) {
return stats, err
}
var wg sync.WaitGroup
var mutex = &sync.Mutex{} // used to synchronize access to stats and multiErr
mutex := &sync.Mutex{} // used to synchronize access to stats and multiErr
var multiErr error
for _, dep := range deps {
wg.Add(1)
Expand Down
2 changes: 1 addition & 1 deletion toolbox/metrics/coverage/coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func getCoverage(r io.ReadCloser) (Coverage, error) {
}
}()

//Line example: "istio.io/mixer/adapter/denyChecker 99"
// Line example: "istio.io/mixer/adapter/denyChecker 99"
scanner := bufio.NewScanner(r)
reg := regexp.MustCompile(`(.*)\t(.*)`)
for scanner.Scan() {
Expand Down
8 changes: 3 additions & 5 deletions toolbox/metrics/flakes/flakes.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@ import (
"encoding/json"
"strconv"

u "istio.io/test-infra/toolbox/util"

"github.com/golang/glog"
"github.com/prometheus/client_golang/prometheus"

u "istio.io/test-infra/toolbox/util"
)

const (
bucket = "k8s-metrics"
latestFlakesMetric = "istio-job-flakes-latest.json"
)

var (
gcsClient = u.NewGCSClient(bucket)
)
var gcsClient = u.NewGCSClient(bucket)

// FlakeGauge implement the metrics.Metric interface
type FlakeGauge struct {
Expand Down
4 changes: 1 addition & 3 deletions toolbox/metrics/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import (
"github.com/prometheus/client_golang/prometheus"
)

var (
m *Publisher
)
var m *Publisher

func newGauge(n string) prometheus.Gauge {
return prometheus.NewGauge(prometheus.GaugeOpts{
Expand Down
7 changes: 4 additions & 3 deletions toolbox/release_note_collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import (
u "istio.io/test-infra/toolbox/util"
)

type orderV string
type sortV string
type (
orderV string
sortV string
)

const (
// Allowed field values can be found at https://developer.github.com/v3/search/#search-repositories
Expand Down Expand Up @@ -66,7 +68,6 @@ func init() {
} else {
gh = u.NewGithubClientNoAuth(*org)
}

}

func main() {
Expand Down
12 changes: 5 additions & 7 deletions toolbox/util/commonUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ const (
ReleaseNoteNone = "none"
)

var (
kvSplitters = []string{
" = ",
"=",
":",
}
)
var kvSplitters = []string{
" = ",
"=",
":",
}

// Retry executes do() until no error was returned or numTrials has reached
func Retry(interval time.Duration, numTrials int, do func() error) error {
Expand Down
5 changes: 1 addition & 4 deletions toolbox/util/githubClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ import (
"golang.org/x/oauth2"
)

var (
commitType = "commit"
)
var commitType = "commit"

const (
maxCommitDistance = 200
Expand Down Expand Up @@ -171,7 +169,6 @@ func (g *GithubClient) AddAutoMergeLabelsToPR(repo string, pr *github.PullReques
// AddlabelsToPR adds labels to the pull request
func (g *GithubClient) AddlabelsToPR(
repo string, pr *github.PullRequest, labels ...string) error {

// skip existing labels
existingLabels, _, err := g.client.Issues.ListLabelsByIssue(context.Background(), g.owner, repo, *pr.Number, &github.ListOptions{})
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion tools/github_helper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (h helper) updatePullRequest(pr *github.PullRequest, s *github.CombinedStat
for _, check := range h.CheckToSkip {
pattern := fmt.Sprintf("(^|/)%s(/|$)", check)
if match, _ := regexp.MatchString(pattern, context); match {
//Find a match so that this failure can be skipped
// Find a match so that this failure can be skipped
return true
}
}
Expand Down