Improved the output in minikube github action

pull/13264/head
Nikhil Sharma 2022-01-06 23:26:54 +05:30
parent 1b25cac7f5
commit d2b87aa6fd
5 changed files with 19 additions and 16 deletions

View File

@ -107,3 +107,9 @@ func DockerInstalledViaSnap() bool {
return strings.Contains(string(o), "snap")
}
// GithubActionRunner returns true if running inside a github action runner
func GithubActionRunner() bool {
// based on https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
return os.Getenv("GITHUB_ACTIONS") == "true"
}

View File

@ -28,6 +28,7 @@ import (
"github.com/juju/mutex"
"github.com/pkg/errors"
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/detect"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/minikube/style"
"k8s.io/minikube/pkg/util/lock"
@ -60,7 +61,7 @@ func CreateDstDownloadMock(src, dst string) error {
// download is a well-configured atomic download function
func download(src string, dst string) error {
var clientOptions []getter.ClientOption
if out.IsTerminal(os.Stdout) {
if out.IsTerminal(os.Stdout) && !detect.GithubActionRunner() {
progress := getter.WithProgress(DefaultProgressBar)
if out.JSON {
progress = getter.WithProgress(DefaultJSONOutput)

View File

@ -43,6 +43,7 @@ import (
"k8s.io/minikube/pkg/drivers/kic/oci"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/detect"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/reason"
"k8s.io/minikube/pkg/util/retry"
@ -67,7 +68,7 @@ var apiPortTest = 8441
// Store the proxy session so we can clean it up at the end
var mitm *StartSession
var runCorpProxy = GithubActionRunner() && runtime.GOOS == "linux" && !arm64Platform()
var runCorpProxy = detect.GithubActionRunner() && runtime.GOOS == "linux" && !arm64Platform()
// TestFunctional are functionality tests which can safely share a profile in parallel
func TestFunctional(t *testing.T) {
@ -278,7 +279,7 @@ func validateImageCommands(ctx context.Context, t *testing.T, profile string) {
t.Skip("image commands are not available on the none driver")
}
// docs(skip): Skips on GitHub Actions and macOS as this test case requires a running docker daemon
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("skipping on darwin github action runners, as this test requires a running docker daemon")
}
@ -1034,7 +1035,7 @@ func validateCacheCmd(ctx context.Context, t *testing.T, profile string) {
// docs: Run `minikube cache add` and make sure we can build and add a local image to the cache
t.Run("add_local", func(t *testing.T) {
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skipf("skipping this test because Docker can not run in macos on github action free version. https://github.community/t/is-it-possible-to-install-and-configure-docker-on-macos-runner/16981")
}
@ -2062,7 +2063,7 @@ func startMinikubeWithProxy(ctx context.Context, t *testing.T, profile string, p
// Use more memory so that we may reliably fit MySQL and nginx
memoryFlag := "--memory=4000"
// to avoid failure for mysq/pv on virtualbox on darwin on free github actions,
if GithubActionRunner() && VirtualboxDriver() {
if detect.GithubActionRunner() && VirtualboxDriver() {
memoryFlag = "--memory=6000"
}
// passing --api-server-port so later verify it didn't change in soft start.

View File

@ -38,6 +38,7 @@ import (
"k8s.io/minikube/pkg/kapi"
"k8s.io/minikube/pkg/minikube/config"
"k8s.io/minikube/pkg/minikube/detect"
"k8s.io/minikube/pkg/util"
"k8s.io/minikube/pkg/util/retry"
)
@ -133,7 +134,7 @@ func validateTunnelStart(ctx context.Context, t *testing.T, profile string) {
// validateServiceStable starts nginx pod, nginx service and waits nginx having loadbalancer ingress IP
func validateServiceStable(ctx context.Context, t *testing.T, profile string) {
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("The test WaitService is broken on github actions in macos https://github.com/kubernetes/minikube/issues/8434")
}
checkRoutePassword(t)
@ -192,7 +193,7 @@ func validateAccessDirect(ctx context.Context, t *testing.T, profile string) {
if runtime.GOOS == "windows" {
t.Skip("skipping: access direct test is broken on windows: https://github.com/kubernetes/minikube/issues/8304")
}
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("skipping: access direct test is broken on github actions on macos https://github.com/kubernetes/minikube/issues/8434")
}
@ -240,7 +241,7 @@ func validateAccessDirect(ctx context.Context, t *testing.T, profile string) {
// validateDNSDig validates if the DNS forwarding works by dig command DNS lookup
// NOTE: DNS forwarding is experimental: https://minikube.sigs.k8s.io/docs/handbook/accessing/#dns-resolution-experimental
func validateDNSDig(ctx context.Context, t *testing.T, profile string) {
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("skipping: access direct test is broken on github actions on macos https://github.com/kubernetes/minikube/issues/8434")
}
@ -275,7 +276,7 @@ func validateDNSDig(ctx context.Context, t *testing.T, profile string) {
// validateDNSDscacheutil validates if the DNS forwarding works by dscacheutil command DNS lookup
// NOTE: DNS forwarding is experimental: https://minikube.sigs.k8s.io/docs/handbook/accessing/#dns-resolution-experimental
func validateDNSDscacheutil(ctx context.Context, t *testing.T, profile string) {
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("skipping: access direct test is broken on github actions on macos https://github.com/kubernetes/minikube/issues/8434")
}
@ -300,7 +301,7 @@ func validateDNSDscacheutil(ctx context.Context, t *testing.T, profile string) {
// validateAccessDNS validates if the test service can be accessed with DNS forwarding from host
// NOTE: DNS forwarding is experimental: https://minikube.sigs.k8s.io/docs/handbook/accessing/#dns-resolution-experimental
func validateAccessDNS(ctx context.Context, t *testing.T, profile string) {
if GithubActionRunner() && runtime.GOOS == "darwin" {
if detect.GithubActionRunner() && runtime.GOOS == "darwin" {
t.Skip("skipping: access direct test is broken on github actions on macos https://github.com/kubernetes/minikube/issues/8434")
}

View File

@ -165,12 +165,6 @@ func ContainerRuntime() string {
return constants.DefaultContainerRuntime
}
// GithubActionRunner returns true if running inside a github action runner
func GithubActionRunner() bool {
// based on https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
return os.Getenv("GITHUB_ACTIONS") == "true"
}
// arm64Platform returns true if running on arm64/* platform
func arm64Platform() bool {
return runtime.GOARCH == "arm64"