我很困惑为什么会发生这种情况。在我的 .gitlab-ci.yml 中,每件事似乎都很好,如果我在npm run build
本地运行,它可以正常工作,如下所示
image: node
cache:
paths:
- dist
- node_modules
stages:
- prepare
- build
- deploy
prepare:
stage: prepare
script:
- npm ci --cache .npm --prefer-offline
build:
stage: build
needs:
- prepare
script:
- npm run build
artifacts:
paths:
- dist
deploy:
stage: deploy
only:
- master
before_script:
- 'which ssh-agent || ( yum update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY_DEV"
- ssh-add <(echo "$SSH_PRIVATE_KEY_DEV")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
script:
- scp -r ./dist/ $CUSTOM_USERNAME@$CUSTOM_IP:/home/docker-nginx
注意: 问题正在构建阶段。我曾尝试更改构建脚本
script:
- echo 'whyyyyy'
那么一切都好......为什么它最后杀死了我的构建阶段。