kata-containers / tests

Kata Containers tests, CI, and metrics
https://katacontainers.io/
Apache License 2.0
140 stars 196 forks source link

OSX CI failure: missing /Users/travis/gopath/bin/yq #558

Closed bergwolf closed 6 years ago

bergwolf commented 6 years ago

I'm constantly getting this on travis-ci osx build for kata-proxy. E.g., https://travis-ci.org/kata-containers/proxy/jobs/411225835

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     9    0     9    0     0     52      0 --:--:-- --:--:-- --:--:--    52
/Users/travis/gopath/bin/yq: line 1: Not: command not found
INFO: Forcing gometalinter version 
fatal: empty string is not a valid pathspec. please use . instead if you meant to match all paths

It seems osx does not have the required command?

jodh-intel commented 6 years ago

@raravena80 - I don't have any osx hardware - any thoughts?

raravena80 commented 6 years ago

@jodh-intel looks like we either need to do any of these:

brew install yq

or

go get gopkg.in/mikefarah/yq.v2

I suppose using brew might be a better option since it picks up a stable version. Is this in .ci/static-checks.sh?

jodh-intel commented 6 years ago

Thanks @raravena80 - I'll fix this on https://github.com/kata-containers/proxy/issues/95 then...

jodh-intel commented 6 years ago

Hi @raravena80 - alas, that didn't work.

@raravena80, @egernst, @jcvenegas (or anyone else with mac hardware) - Any chance you could try running the static checks script on a proxy clone in a test osx environment?:

grahamwhaley commented 6 years ago

/cc @amshinde also has a Mac iirc. @jodh-intel - Santa is a Linux user, of course... ;-)

raravena80 commented 6 years ago

I get this error on my mac now

$ .ci/static-checks.sh
/Users/raravena/go/src/github.com/kata-containers/tests/.ci/static-checks.sh: line 24: typeset: -A: invalid option
typeset: usage: typeset [-afFirtx] [-p] name[=value] ...

(need to debug more)

I see what the problem may be in Travis. The executable from go get gopkg.in/mikefarah/yq.v2 is called yq.v2 and not yq

We can either do

cp $GOPATH/bin/yq.v2 $GOPATH/bin/yq

or

mv $GOPATH/bin/yq.v1 $GOPATH/bin/yq

In essence looks like gometalinter hasn't been updated to use yq.v2

@jodh-intel I'll ask Santa to buy you a Mac 😄

raravena80 commented 6 years ago

ok. I ran it on my mac successfully, after renaming yq.v2 to yq

I had to modify the following lines in the tests repo.

$ git diff
diff --git a/.ci/static-checks.sh b/.ci/static-checks.sh
index 0c787f6..fc2f264 100755
--- a/.ci/static-checks.sh
+++ b/.ci/static-checks.sh
@@ -21,7 +21,7 @@ repo=""
 master_branch="false"
 force="false"

-typeset -A long_options
+#typeset -A long_options

 long_options=(
        [commits]="Check commits"
@@ -32,7 +32,7 @@ long_options=(
        [help]="Display usage statement"
        [licenses]="Check licenses"
        [master]="Force checking of master branch"
-       [repo:]="Specify GitHub URL of repo to use (github.com/user/repo)"
+       [repo]="Specify GitHub URL of repo to use (github.com/user/repo)"
        [versions]="Check versions files"
 )

For the typeset line we probably have to make a condition that checks for darwin and ignore that line. For the [repo:] line we can just remove the colon?

jodh-intel commented 6 years ago

Hi @raravena80 - thanks for investigating!

Ah, yes, the typeset issue is due to osx providing an older version of bash - we worked around that in Travis by installing a newer version using brew:

@chavafg - could you update the install_yq() function based on @raravena80's findings?

grahamwhaley commented 6 years ago

@raravena80 @jodh-intel @chavafg - so, are we going to fix the yq issue for the apple travis, or should we disable it for now? Having that fail the CI is a little blip right now, and if we are not going to fix it rsn, I vote we disable it for the minute.

jodh-intel commented 6 years ago

@grahamwhaley - I don't have a MacBook I'm afraid - do you? I think @amshinde may have one?

grahamwhaley commented 6 years ago

Nope. So either we keep prodding it with changes and test it using the travis pass/fails, or we disable it if nobody can figure out what the issue is.

jodh-intel commented 6 years ago

Let's see if @amshinde or @egernst can help out...

chavafg commented 6 years ago

I don't have a Mac either, so can't help here :(

raravena80 commented 6 years ago

I tested it successfully, we would need to rename the binary from yq.v2 to yq. We would also need to change static-checks.sh to check if it's macos I'm cool if we want to disable the mac tests though. uname would do it.

$ uname
Darwin
marcov commented 6 years ago

There are a couple of problems in install_yq():