Gitlab CI Potrubí se nezdaří, protože ruby vydání (Ruby nainstalován)

0

Otázka

Snažím se nastavit CI na Gitlab. Mám problém. Vypadá to, že běžec se pracuje dobře, ale pokaždé, když se snažím spustit potrubí se nezdaří s následující chybová zpráva :

Running with gitlab-runner 14.4.0 (4b9e985a)
  on local-runner g_SbFiLZ
Resolving secrets
00:00
Preparing the "shell" executor
00:00
Using Shell executor...
Preparing environment
00:00
Running on GU33...
Getting source from Git repository
00:02
Fetching changes with git depth set to 50...
Reinitialized existing Git repository in C:/Users/xxx/GitLab-Runner/builds/g_SbFiLZ/0/xxx/xxx/.git/
Checking out f4fb6ec9 as main...
git-lfs/2.11.0 (GitHub; windows amd64; go 1.14.2; git 48b28d97)
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:01
$ gem install bundler
gem : The term 'gem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the s
pelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\WINDOWS\TEMP\build_script461193448\script.ps1:225 char:1
+ gem install bundler
+ ~~~
    + CategoryInfo          : ObjectNotFound: (gem:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
 
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: exit status 1

Mám Ruby nainstalováno a nastaveno správně. Můžu běžet gem příkazy lokálně. Runner je také nastavit lokálně, takže jsem opravdu dont pochopit problém. Tady je můj gitlab-ci.yml :

stages:
  - prepare
  - build
  - test
  - ui-test

variables:
  LC_ALL: "en_US.UTF-8"
  LANG: "en_US.UTF-8"

.setup_bundler: &setup_bundler |
  gem install bundler
  bundle config
  bundle install

.setup: &setup
  - *setup_bundler

prepare_project:
  stage: prepare
  script:
    *setup
  cache:
    key:
      files:
        - Gemfile.lock
    paths:
      - vendor
  artifacts:
    name: "Bundle_${CI_BUILD_NAME}_${CI_BUILD_REF_NAME}_${CI_BUILD_ID}"
    expire_in: 1 day
    paths:
      - vendor
    when: always
  when: on_success
  tags:
    - android

build:
  stage: build
  script:
    - bundle exec fastlane build
  dependencies:
    - prepare_project
  tags:
    - android

test:
  stage: test
  script:
    - bundle exec fastlane tests
  dependencies:
    - prepare_project
  tags:
    - android

ui-test:
  stage: ui-test
  script:
    - bundle exec fastlane ui_tests
  dependencies:
    - prepare_project
  tags:
    - android

Nějaké nápady, pelase ?

android continuous-integration gitlab
2021-11-20 21:06:53
1

Nejlepší odpověď

0

Je pravděpodobné, že když jste běží gem ladění, používáte jej s jiným uživatelem, než gitlab-runner, což je výchozí nastavení gitlab-runner uživatele. Podívejte se na PATH nastavení gitlab-runner uživatele, a zajistit, že gem je na cestě.

2021-11-21 02:59:35

Chcete říct, podívejte se na CESTĚ v env proměnné ? Přidal jsem Ruby tam funguje dobře.
Bartos

Ano, konkrétně v proměnné prostředí pro váš gitlab-runner uživatel (který je uživatel systémem používá ve výchozím nastavení, pokud jste zadali jiný uživatel, nastavte CESTU pro uživatele příliš). To zní, jako jste vy, že to funguje i když, což je dobře!
Patrick

V jiných jazycích

Tato stránka je v jiných jazycích

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................