iterative / cml

♾️ CML - Continuous Machine Learning | CI/CD for ML
http://cml.dev
Apache License 2.0
4k stars 337 forks source link

self-hosted runner not connected to my repo. #562

Closed mhs-achyut closed 3 years ago

mhs-achyut commented 3 years ago

Hello, I am new to cml community. I am trying to use self-hosted runners with github actions to set up CI with my private github repo. I have pulled the docker container dvcorg/cml-py3 and ran with all the environment variables as specified in this video https://www.youtube.com/watch?v=rVq-SCNyxVc&ab_channel=DVCorgDVCorg

I have created a personal access token with workflow and repo permissions.

However, when I run this without -d flag, I see an error as follows:

{"level":"error","status":"terminated"}
Error: REPO_TOKEN does not have enough permissions to access workflow API
    at CML.repo_token_check (/cml/src/cml.js:236:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    Destroy scheduled: 30 seconds remaining.
    No TF resource found

@elleobrien , Can you please take a look and help me understand, what I am doing wrong?

0x2b3bfa0 commented 3 years ago

👋🏼 Welcome, @mhs-achyut! Can you please post the command you're running to get this error message?

mhs-achyut commented 3 years ago

Hello @0x2b3bfa0 please find the command below:

docker run --name gpurunner --gpus all -e RUNNER_IDLE_TIMEOUT=1000 -e RUNNER_LABELS=cml,gpu -e RUNNER_REPO="https://github.com/<myprivate_repo>" -e repo_token=<my_private_token> dvcorg/cml-py3
0x2b3bfa0 commented 3 years ago

@mhs-achyut, I have been unable to reproduce your issue by running the command you provided.

The most frequent causes for this particular error message are:

Please verify that your token is a pesonal access token and it has access to the whole repo scope.

DavidGOrtega commented 3 years ago

@mhs-achyut cml runner needs access to the github actions API, for that you need to create a personal access token with the workflow enabled.

image

mhs-achyut commented 3 years ago

Hi, I have the personal access token with those respective access permissions enabled. Does it need to be a public repo?

0x2b3bfa0 commented 3 years ago

@mhs-achyut, no, it doesn't need to be a public repository. Can you please try creating a new token?

mhs-achyut commented 3 years ago

no luck, I tried creating a new token. also, I tried using a public repo. Same error for both the cases.

0x2b3bfa0 commented 3 years ago

@mhs-achyut, can you please try again with this debug version of CML?

docker run --name gpurunner --gpus all -e RUNNER_IDLE_TIMEOUT=1000 -e RUNNER_LABELS=cml,gpu -e RUNNER_REPO="https://github.com/<myprivate_repo>" -e repo_token=<my_private_token> dvcorg/cml-py3 bash -c "npm config set user 0 && npm install --global git+https://github.com/iterative/cml#dont-mask-token-exception && cml-runner"
mhs-achyut commented 3 years ago

@0x2b3bfa0 ,after running the debug version as shown above, Please find the error below:

/usr/bin/cml-send-github-check -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-send-github-check.js
/usr/bin/cml-send-comment -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-send-comment.js
/usr/bin/cml-publish -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-publish.js
/usr/bin/cml-runner -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-runner.js
/usr/bin/cml-tensorboard-dev -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-tensorboard-dev.js
/usr/bin/cml-cloud-runner-entrypoint -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-runner.js
/usr/bin/cml-pr -> /usr/lib/node_modules/@dvcorg/cml/bin/cml-pr.js

> mmmagic@0.5.3 install /usr/lib/node_modules/@dvcorg/cml/node_modules/mmmagic
> node-gyp rebuild

make: Entering directory '/usr/lib/node_modules/@dvcorg/cml/node_modules/mmmagic/build'
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/apprentice.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/apptype.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/ascmagic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/cdf.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/cdf_time.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/compress.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/der.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/encoding.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/fsmagic.o
../deps/libmagic/src/fsmagic.c: In function ‘file_fsmagic’:
../deps/libmagic/src/fsmagic.c:223:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
        COMMA, (long)major(sb->st_rdev),
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                             
../deps/libmagic/src/fsmagic.c:224:13: warning: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>.
        (long)minor(sb->st_rdev)) == -1)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                             
../deps/libmagic/src/fsmagic.c:258:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
        COMMA, (long)major(sb->st_rdev),
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                             
../deps/libmagic/src/fsmagic.c:259:13: warning: In the GNU C Library, "minor" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "minor", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "minor", you should undefine it after including <sys/types.h>.
        (long)minor(sb->st_rdev)) == -1)
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                                                                                                                                                                                                                                                                             
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/funcs.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/is_tar.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/magic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/print.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/readcdf.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/readelf.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/softmagic.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/fmtcheck.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/strlcat.o
  CC(target) Release/obj.target/libmagic/deps/libmagic/src/strlcpy.o
  AR(target) Release/obj.target/deps/libmagic/magic.a
  COPY Release/magic.a
  CXX(target) Release/obj.target/magic/src/binding.o
  SOLINK_MODULE(target) Release/obj.target/magic.node
  COPY Release/magic.node
make: Leaving directory '/usr/lib/node_modules/@dvcorg/cml/node_modules/mmmagic/build'
+ @dvcorg/cml@0.4.3
added 2 packages from 9 contributors and updated 141 packages in 14.776s
{"level":"error","status":"terminated"}
    Destroy scheduled: 30 seconds remaining.
RequestError [HttpError]: Not Found
    at /usr/lib/node_modules/@dvcorg/cml/node_modules/@octokit/request/dist-node/index.js:68:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Github.runner_token (/usr/lib/node_modules/@dvcorg/cml/src/drivers/github.js:122:11)
    at async CML.runner_token (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:140:12)
    at async CML.repo_token_check (/usr/lib/node_modules/@dvcorg/cml/src/cml.js:223:5)
    at async run (/usr/lib/node_modules/@dvcorg/cml/bin/cml-runner.js:290:3) {
  status: 404,
  headers: {
    'access-control-allow-origin': '*',
    'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset',
    connection: 'close',
    'content-encoding': 'gzip',
    'content-security-policy': "default-src 'none'",
    'content-type': 'application/json; charset=utf-8',
    date: 'Wed, 26 May 2021 21:34:34 GMT',
    'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
    server: 'GitHub.com',
    'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
    'transfer-encoding': 'chunked',
    vary: 'Accept-Encoding, Accept, X-Requested-With',
    'x-accepted-oauth-scopes': 'repo',
    'x-content-type-options': 'nosniff',
    'x-frame-options': 'deny',
    'x-github-media-type': 'github.v3; format=json',
    'x-github-request-id': 'D740:7A31:3A32F17:72B3631:60AEBEEA',
    'x-oauth-scopes': 'repo, workflow',
    'x-ratelimit-limit': '5000',
    'x-ratelimit-remaining': '4992',
    'x-ratelimit-reset': '1622066794',
    'x-ratelimit-resource': 'core',
    'x-ratelimit-used': '8',
    'x-xss-protection': '0'
  },
  request: {
    method: 'POST',
    url: 'https://api.github.com/repos/{redacted user}/{redacted repository}.git/actions/runners/registration-token',
    headers: {
      accept: 'application/vnd.github.v3+json',
      'user-agent': 'octokit-core.js/3.4.0 Node.js/12.22.1 (linux; x64)',
      authorization: 'token [REDACTED]',
      'content-length': 0
    },
    request: { agent: [Agent], hook: [Function: bound bound register] }
  },
  documentation_url: 'https://docs.github.com/rest/reference/actions#create-a-registration-token-for-a-repository'
}
    No TF resource found
0x2b3bfa0 commented 3 years ago

🎉 @mhs-achyut, eureka! Just remove the .git suffix from your repository address, e.g. https://github.com/mhs-achyut/example_cml instead of https://github.com/mhs-achyut/example_cml.git

0x2b3bfa0 commented 3 years ago

@mhs-achyut, did this change solve your issue?

mhs-achyut commented 3 years ago

@0x2b3bfa0 yes, Thanks a lot for the quick responses!