首页 文章

注册跑者...禁止 - gitlab-runner.exe注册

提问于
浏览
0

我正在尝试使用GitLab CI / CD功能,但是当我尝试注册跑步者时遇到了问题 . 我的意图是每当我将一个新文件推送到我的角度项目存储库时,我的e2e测试将被触发并将在跑步者上运行 .

基本上,我按照这里的分步指南https://medium.com/letsboot/angular-continuous-delivery-deployment-with-gitlab-ci-stage-on-commit-and-prod-on-git-tag-151ce3c74619 .

这些是我采取的步骤:

  • 在项目根文件夹上创建了gitlab-ci.yml
image: trion/ng-cli-karma
cache:
paths:
  - node_modules/

deploy_stage:
  stage: deploy
  environment: Stage
  only:
    - master
  script:
    - rm ./package-lock.json
    - npm install
    - ./node_modules/@angular/cli/bin/ng test --progress false --single-run=true --watch=false
    - ./node_modules/@angular/cli/bin/ng e2e --progress false --watch=false
    - ./node_modules/@angular/cli/bin/ng build --progress false --prod --base-href angular_ci_cd-stage.surge.sh
    - ./node_modules/.bin/surge -p dist/ --domain angular_ci_cd-stage.surge.sh
  • 添加,提交并推送gitlab-ci.yml

在这一点上,当我查看项目gitlab管道时,我已经预计会看到我的测试被触发 . 但实际上我在deme> angular_ci_cd> Pipelines下看到一个欢迎页面"Build with confidence" . 老实说,我没想到进一步的配置,但我按照指导https://docs.gitlab.com/runner/register/(Windows)

enter image description here

希望我从正确的位置获得令牌:https://gitlab.com/profile/personal_access_tokens>您的新个人访问令牌

如果它以某种方式重要,这里是我的git配置(我使用HTTPS而不是SSH) . 我的意思是,我没有添加SSH密钥,我认为我不需要它:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
[remote "origin"]
    url = https://gitlab.com/carv/angular_ci_cd.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master

***编辑

C:\GitLab-Runner>gitlab-runner.exe register
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.com
Please enter the gitlab-ci token for this runner:
xxxxx
Please enter the gitlab-ci description for this runner:
[win10-cha]: my second tentative
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag, another-tag
Whether to run untagged builds [true/false]:
[false]: true
Whether to lock the Runner to current project [true/false]:
[true]: true
Registering runner... succeeded                   [0;m  runner[0;m=xtr3ae4U
Please enter the executor: shell, ssh, docker-ssh+machine, kubernetes, docker, docker-ssh, parallels, virtualbox, docker+machine:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded![0;m

C:\GitLab-Runner>

1 回答

  • 1

    您使用的是错误的令牌 . 您需要从此页面获取跑步者注册令牌:https://gitlab.com/carv/angular_ci_cd/settings/ci_cd

    以下是页面查找我创建的测试项目的方式:

    enter image description here

    您将不得不使用自己的令牌而不是上图中的令牌 .

相关问题