Gitlab-ci文件对我的项目没有影响

时间:2019-10-31 16:12:08

标签: gitlab gitlab-ci

我正在尝试将我的角度应用程序自动构建/部署到远程服务器,但是我不明白为什么gitlab-ci.yml无法正常工作:

image: trion/ng-cli-karma

cache:
  paths:
    - node_modules/

before_script:
  - apt-get update -qq && apt-get install -y -qq sshpass

deploy_stage:
  stage: deploy
  environment: Staging
  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
    - cd dist/
    - ls
    - sshpass -V
    - export SSHPASS=$USER_PASS
    - sshpass -e scp -o stricthostkeychecking=no -r . myusername@myserver:/var/www/html


deploy_production:
  stage: deploy
  environment: Production
  only:
    - tags
  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
    - cd dist/
    - ls
    - sshpass -V
    - export SSHPASS=$USER_PASS
    - sshpass -e scp -o stricthostkeychecking=no -r . myusername@myserver-prd:/var/www/html

在我的Gitlab CE服务器上,我看不到文件的效果,没有构建作业:

enter image description here

我在这里错过了一步吗?

1 个答案:

答案 0 :(得分:0)

您在问题中提到的gitlab-ci.yml文件应重命名为.gitlab-ci.yml

GitLab CI/CD Pipeline Configuration Reference