Skip to content

Commit

Permalink
💝 Handover of magetasks to Knative project (#28)
Browse files Browse the repository at this point in the history
* Handover of magetasks to Knative project

* Fixing unit tests

* Update copyright

* Bump the provenance-generator prowapi dep

* Fix aw0k3n linter
  • Loading branch information
cardil authored Apr 12, 2024
1 parent 9c3eea8 commit 703489d
Show file tree
Hide file tree
Showing 104 changed files with 9,893 additions and 2,737 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ indent_size = 2
[{*.go,go.mod,go.work,Makefile}]
indent_style = tab

# Ignore paths
[LICENSE]
indent_style = unset
indent_size = unset
4 changes: 2 additions & 2 deletions go-ls-tags/.gotagsignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
test_tag_v1
test_tag_v3
test_tag_ignored1
test_tag_ignored2
24 changes: 18 additions & 6 deletions go-ls-tags/cli/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,37 @@ func TestApp(t *testing.T) {
}, {
name: "no options",
args: []string{},
tags: []string{"test_tag_v1", "test_tag_v2", "test_tag_v3"},
tags: []string{"test_tag_v1", "test_tag_v2"},
}, {
name: "with comma joiner",
args: []string{"--joiner", ","},
fragments: []string{"test_tag_v1,test_tag_v2,test_tag_v3"},
fragments: []string{"test_tag_v1,test_tag_v2"},
}, {
name: "using absolute ignorefile",
args: []string{
"--ignore-file",
path.Join(test.Rootdir(), "go-ls-tags", tags.DefaultIgnoreFile),
},
tags: []string{"test_tag_v2"},
tags: []string{"test_tag_v1", "test_tag_v2"},
}, {
name: "using relative ignorefile",
args: []string{
"--ignore-file",
path.Join("go-ls-tags", tags.DefaultIgnoreFile),
tags.DefaultIgnoreFile,
},
tags: []string{"test_tag_v1", "test_tag_v2"},
}, {
name: "using non-existing ignorefile",
args: []string{
"--ignore-file",
"not-existing-file" + tags.DefaultIgnoreFile,
},
tags: []string{
"test_tag_ignored1",
"test_tag_ignored2",
"test_tag_v1",
"test_tag_v2",
},
tags: []string{"test_tag_v2"},
}}
for _, tc := range tcs {
tc := tc
Expand Down Expand Up @@ -105,7 +117,7 @@ func (tc *testCase) test(t *testing.T) {

func execute(args []string) testExecution {
te := testExecution{}
test.WithDirectory(test.Rootdir(), func() {
test.WithDirectory(path.Join(test.Rootdir(), "go-ls-tags"), func() {
err := commandline.New(cli.App{}).Execute(
commandline.WithArgs(args...),
commandline.WithOutput(&te.out),
Expand Down
5 changes: 3 additions & 2 deletions go-ls-tags/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package main

import (
"bytes"
"path"
"reflect"
"strings"
"testing"
Expand All @@ -39,7 +40,7 @@ func TestMainFunc(t *testing.T) {
}, {
name: "no options",
args: []string{},
tags: []string{"test_tag_v1", "test_tag_v2", "test_tag_v3"},
tags: []string{"test_tag_v1", "test_tag_v2"},
}}
for _, tc := range tcs {
tc := tc
Expand Down Expand Up @@ -93,7 +94,7 @@ func executeMain(args []string) testExecution {
defer func() {
cli.Options = nil
}()
test.WithDirectory(test.Rootdir(), func() {
test.WithDirectory(path.Join(test.Rootdir(), "go-ls-tags"), func() {
main()
})

Expand Down
4 changes: 4 additions & 0 deletions go-ls-tags/test/rootdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ package test
import (
"path"
"runtime"
"testing"
)

// Rootdir returns a path to a root directory of toolbox repo.
func Rootdir() string {
if !testing.Testing() {
panic("test.WithDirectory can be used only in tests")
}
_, curfile, _, _ := runtime.Caller(0) //nolint:dogsled
return path.Dir(path.Dir(path.Dir(curfile)))
}
4 changes: 4 additions & 0 deletions go-ls-tags/test/withdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,15 @@ package test
import (
"log"
"os"
"testing"
)

// WithDirectory executes a function with a current working directory set
// to a given directory.
func WithDirectory(dir string, fn func()) {
if !testing.Testing() {
panic("test.WithDirectory can be used only in tests")
}
wd, err := os.Getwd()
if err != nil {
log.Panic(err)
Expand Down
2 changes: 1 addition & 1 deletion go-ls-tags/testdata/tagged.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// This file is used for testing purposes.
//go:build test_tag_v1 || test_tag_v2 || test_tag_v3
//go:build test_tag_v1 || test_tag_v2 || (test_tag_ignored1 && test_tag_ignored2)

/*
Copyright 2022 The Knative Authors
Expand Down
151 changes: 84 additions & 67 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,97 +3,114 @@ module knative.dev/toolbox
go 1.21

require (
cloud.google.com/go/storage v1.22.1
cloud.google.com/go/storage v1.39.1
github.com/blang/semver/v4 v4.0.0
github.com/davecgh/go-spew v1.1.1
github.com/go-git/go-git-fixtures/v4 v4.2.1
github.com/go-git/go-git/v5 v5.4.2
github.com/go-sql-driver/mysql v1.5.0
github.com/google/go-cmp v0.5.8
github.com/google/go-containerregistry v0.11.0
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399
github.com/go-git/go-git/v5 v5.11.0
github.com/go-sql-driver/mysql v1.7.1
github.com/google/go-cmp v0.6.0
github.com/google/go-containerregistry v0.19.1
github.com/google/go-github/v32 v32.1.1-0.20201004213705-76c3c3d7c6e7 // HEAD as of Nov 6
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/kelseyhightower/envconfig v1.4.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.5.0
github.com/stretchr/testify v1.8.0
github.com/spf13/cobra v1.8.0
github.com/stretchr/testify v1.9.0
github.com/wavesoftware/go-commandline v1.0.0
go.uber.org/atomic v1.9.0
go.uber.org/zap v1.19.1
golang.org/x/mod v0.14.0
golang.org/x/net v0.15.0
golang.org/x/oauth2 v0.0.0-20220718184931-c8730f7fcb92
google.golang.org/api v0.84.0
k8s.io/apimachinery v0.24.4
go.uber.org/atomic v1.11.0
go.uber.org/zap v1.27.0
golang.org/x/mod v0.16.0
golang.org/x/net v0.22.0
golang.org/x/oauth2 v0.18.0
google.golang.org/api v0.171.0
k8s.io/apimachinery v0.29.3
knative.dev/hack v0.0.0-20240404013450-1133b37da8d7
sigs.k8s.io/boskos v0.0.0-20230301234717-8b694e7dafa2
sigs.k8s.io/yaml v1.3.0
sigs.k8s.io/yaml v1.4.0
)

require github.com/spf13/pflag v1.0.5

require (
cloud.google.com/go v0.102.0 // indirect
cloud.google.com/go/compute v1.7.0 // indirect
cloud.google.com/go/iam v0.3.0 // indirect
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute v1.25.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/docker/cli v20.10.17+incompatible // indirect
github.com/docker/distribution v2.8.1+incompatible // indirect
github.com/docker/docker v20.10.17+incompatible // indirect
github.com/docker/docker-credential-helpers v0.6.4 // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.15.1 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/docker/cli v25.0.4+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v25.0.4+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa // indirect
github.com/googleapis/gax-go/v2 v2.4.0 // indirect
github.com/googleapis/go-type-adapters v1.0.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.12.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.6.0 // indirect
github.com/prometheus/common v0.51.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/vbatts/tar-split v0.11.5 // indirect
github.com/wavesoftware/go-retcode v1.0.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.uber.org/goleak v1.1.12 // indirect
go.uber.org/multierr v1.7.0 // indirect
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90 // indirect
google.golang.org/grpc v1.47.0 // indirect
google.golang.org/protobuf v1.28.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/sdk v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240311132316-a219d84964c2 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240314234333-6e1732d8331c // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/test-infra v0.0.0-20220913174101-46ac1a6cf806 // indirect
k8s.io/utils v0.0.0-20220725171434-9bab9ef40391 // indirect
gotest.tools/v3 v3.5.1 // indirect
k8s.io/test-infra v0.0.0-20240409223816-6c80f12129c8 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
)
Loading

0 comments on commit 703489d

Please sign in to comment.