簡體   English   中英

我需要使用哪個 Gitlab 轉輪?

[英]Which Gitlab runner do I need to use?

我正在制作我的 yml 文件,但我一直在為遇到的錯誤而苦苦掙扎。 錯誤是:

apt-get:術語“apt-get”未被識別為 cmdlet、function、腳本文件或可運行程序的名稱。 檢查名稱的拼寫,或者如果包含路徑,請驗證路徑是否正確並重試。 在 C:\Windows\TEMP\build_script267802092\script.ps1:217 char:1

我認為問題在於我沒有正確的跑步者來運行它。 問題是我不知道哪個跑步者對我來說是正確的跑步者。

我試過使用 shell 跑步者,但那個給了我上面的錯誤。

我的 yml 文件:

image: node:latest


stages:
  # - build
  # - sonarqube-check
  # - test
  - deploy

cache:
  paths:
    - .gradle/wrapper
    - .gradle/caches

build:
  stage: build
  script:
    - ./gradlew assemble
  artifacts:
    paths:
      - build/libs/*.jar
    expire_in: 1 week
  only:
    - master

sonarqube-check:
  stage: test
  image: gradle:jre11-slim
  variables:
    SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar"  # Defines the location of the analysis task cache
    GIT_DEPTH: "0"  # Tells git to fetch all the branches of the project, required by the analysis task
  cache:
    key: "${CI_JOB_NAME}"
    paths:
      - .sonar/cache
  script: ./gradlew sonarqube
  allow_failure: true
  only:
    - master

test:
  stage: test
  script:
    - ./gradlew check



deploy:
  stage: deploy
  image: ruby:latest
  script:
  - apt-get update -qy
  - apt-get install -y ruby-dev
  - gem install dpl
  - dpl --provider=heroku --app=heroku-coalition --api-key=$HEROKU_API_KEY
  - echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
  only:
  - master
    


after_script:
  - echo "End CI"

我正在使用 windows 10 的 windows 機器(如果需要該信息)有人可以幫助我嗎? 提前致謝!

由於您正在定義要在 yml 中使用的image ,因此您應該使用 docker 執行器。

假設您已經按照文檔安裝了 GitLab Runner,那么您可以添加一個帶有“docker”的運行器作為執行器。 這是文檔的鏈接

Docker 也應該已經安裝在您的服務器上。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM