gitlab-ci作业未运行脚本

时间:2018-08-25 14:37:34

标签: gitlab-ci

我是gitlab-ci的新手,正在尝试基于gitlab模板的最小Python应用程序。

我的.gitlab-ci.yml文件如下:

# This file is a template, and might need editing before it works on your project.
# Official language image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/python/tags/
#image: python:latest

# Change pip's cache directory to be inside the project directory since we can
# only cache local items.
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache"

stages:
  - test
  - run

# Pip's cache doesn't store the python packages
# https://pip.pypa.io/en/stable/reference/pip_install/#caching
#
# If you want to also cache the installed packages, you have to install
# them in a virtualenv and cache it as well.
#cache:
#  paths:
#    - .cache/pip
#    - venv/

before_script:
  - python -V               # Print out python version for debugging
    #- pip install virtualenv
    #- virtualenv venv
  - python -m venv venv
  - venv/scripts/activate

job1:
  stage: test
  script:
  - python setup.py test
  #- pip install tox flake8  # you can also use tox
  #- tox -e py36,flake8

job2:
  stage: run
  script:
  - pip install wheel
  - python setup.py bdist_wheel
  artifacts:
    paths:
      - dist/*.whl

      #pages:
      #  script:
      #  - pip install sphinx sphinx-rtd-theme
      #  - cd doc ; make html
      #  - mv build/html/ ../public/
      #  artifacts:
      #    paths:
      #    - public
      #  only:
      #  - master

可以在gitlab Web用户界面中看到这些作业,并且它们似乎在我的(基于Windows的Shell executor)运行器上运行。

当我查看作业的输出时,似乎好像每个作业的实际脚本命令都没有运行。

这是job1的输出:

Running with gitlab-runner 11.2.0 (35e8515d)
  on GKUHN-L04 b0162458
Using Shell executor...
Running on GKUHN-L04...
Fetching changes...
Removing venv/
HEAD is now at 2484105 And agai..
From https://gitlab.analog.com/GKuhn/test_gitlab_ci
 - [deleted]         (none)     -> origin/test_ci
   fdd4216..cd618ba  master     -> origin/master
Checking out cd618ba9 as master...
Skipping Git submodules setup
$ python -V
Python 3.7.0
$ python -m venv venv
$ venv/scripts/activate
Job succeeded

和工作2:

Running with gitlab-runner 11.2.0 (35e8515d)
  on GKUHN-L04 b0162458
Using Shell executor...
Running on GKUHN-L04...
Fetching changes...
Removing venv/
HEAD is now at cd618ba updated .gitlab-ci.yml file
Checking out cd618ba9 as master...
Skipping Git submodules setup
$ python -V
Python 3.7.0
$ python -m venv venv
$ venv/scripts/activate
Uploading artifacts...
WARNING: dist/*.whl: no matching files             
ERROR: No files to upload                          
Job succeeded

我在做什么错??

1 个答案:

答案 0 :(得分:2)

事实证明,这是Windows中使用shell执行程序的错误: https://gitlab.com/gitlab-org/gitlab-runner/issues/2730

此问题的重复项:Gitlab CI does not execute npm scripts