Skip to content

Commit

Permalink
Remove old, envtest ci code
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Feb 12, 2024
1 parent 8a0c61e commit fdb6e14
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 47 deletions.
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,6 @@ ci:
postgres:
enabled: true
version: 12
kubernetesEnvtest:
enabled: true
version: 1.25.x!
ignorePaths: []
```

Expand All @@ -401,13 +398,6 @@ If `postgres.enabled` is `true` then a PostgreSQL service container will be adde
image][docker-hub-postgres] that is used for this container. By default `12` is used as
image tag.

If `kubernetesEnvtest.enabled` is `true` then
[Envtest](https://book.kubebuilder.io/reference/envtest.html) binaries will be downloaded
using
[`setup-envtest`](https://pkg.go.dev/sigs.k8s.io/controller-runtime/tools/setup-envtest)
for the `test` job. The version for binaries can be specified using the
`kubernetesEnvtest.version` field. By default `1.25.x!` is used as the version.

`ignorePaths` specifies a list of filename patterns. Workflows will not trigger if a path
name matches a pattern in this list. [More info][ref-onpushpull] and [filter pattern cheat
sheet][ref-pattern-cheat-sheet]. This option is not defined by default.
Expand Down
14 changes: 4 additions & 10 deletions internal/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ type CIWorkflowConfig struct {
Enabled bool `yaml:"enabled"`
Version string `yaml:"version"`
} `yaml:"postgres"`
KubernetesEnvtest struct {
Enabled bool `yaml:"enabled"`
Version string `yaml:"version"`
} `yaml:"kubernetesEnvtest"`
}

// LicenseWorkflowConfig appears in type Configuration.
Expand Down Expand Up @@ -247,14 +243,12 @@ func (c *Configuration) Validate() {
}

// Validate CI workflow configuration.
if ghwCfg.CI.Postgres.Enabled || ghwCfg.CI.KubernetesEnvtest.Enabled {
if ghwCfg.CI.Postgres.Enabled {
if !ghwCfg.CI.Enabled {
logg.Fatal("githubWorkflow.ci.enabled must be set to 'true' when githubWorkflow.ci.postgres or githubWorkflow.ci.kubernetesEnvtest is enabled")
logg.Fatal("githubWorkflow.ci.enabled must be set to 'true' when githubWorkflow.ci.postgres is enabled")
}
if len(ghwCfg.CI.RunnerType) > 0 {
if len(ghwCfg.CI.RunnerType) > 1 || !strings.HasPrefix(ghwCfg.CI.RunnerType[0], "ubuntu") {
logg.Fatal("githubWorkflow.ci.runOn must only define a single Ubuntu based runner when githubWorkflow.ci.postgres or githubWorkflow.ci.kubernetesEnvtest is enabled")
}
if len(ghwCfg.CI.RunnerType) > 1 || !strings.HasPrefix(ghwCfg.CI.RunnerType[0], "ubuntu") {
logg.Fatal("githubWorkflow.ci.runOn must only define a single Ubuntu based runner when githubWorkflow.ci.postgres is enabled")
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions internal/core/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ const (
DefaultGoVersion = "1.22"
DefaultPostgresVersion = "12"
DefaultLinkerdAwaitVersion = "0.2.7"
DefaultK8sEnvtestVersion = "1.26.x!"
DefaultGitHubComRunnerType = "ubuntu-latest"
)

var DefaultGitHubEnterpriseRunnerType = [...]string{"self-hosted"}

const (
CacheAction = "actions/cache@v4"
CheckoutAction = "actions/checkout@v4"
SetupGoAction = "actions/setup-go@v5"

Expand Down
25 changes: 0 additions & 25 deletions internal/ghworkflow/workflow_ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,31 +66,6 @@ func ciWorkflow(cfg *core.GithubWorkflowConfiguration, hasBinaries bool) {
}, " "),
}}
}
if cfg.CI.KubernetesEnvtest.Enabled {
testJob.addStep(jobStep{
ID: "cache-envtest",
Name: "Cache envtest binaries",
Uses: core.CacheAction,
With: map[string]any{
"path": "test/bin",
"key": `${{ runner.os }}-envtest-${{ hashFiles('Makefile.maker.yaml') }}`,
},
})
// Download the envtest binaries, in case of cache miss.
envtestVersion := core.DefaultK8sEnvtestVersion
if cfg.CI.KubernetesEnvtest.Version != "" {
envtestVersion = cfg.CI.KubernetesEnvtest.Version
}
testJob.addStep(jobStep{
Name: "Download envtest binaries",
If: "steps.cache-envtest.outputs.cache-hit != 'true'",
Run: makeMultilineYAMLString([]string{
"go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest",
"mkdir -p test/bin", // create dir if it doesn't exist already
"setup-envtest --bin-dir test/bin use " + envtestVersion,
}),
})
}
testJob.addStep(jobStep{
Name: "Run tests and generate coverage report",
Run: "make build/cover.out",
Expand Down

0 comments on commit fdb6e14

Please sign in to comment.