【发布时间】:2019-09-06 11:58:30
【问题描述】:
我想在 gitlab-ci.yml 中使用 newman 设置部署前邮递员测试,如果测试通过则部署如果测试失败则部署将被取消。
这是我的 .gitlab-ci.yml 文件 -
variables:
POSTMAN_COLLECTION : collection.json
POSTMAN_ENVIRONMENT: postman-test.postman_environment.json
stages:
- build
- test
build:
stage: build
script:
- docker build -t registry.tech5-sa.com/t5-platform/t5-templates-db_app:$CI_COMMIT_REF_NAME --build-arg UID=$(id -u) -f API/Dockerfile .
- docker build -t registry.tech5-sa.com/t5-platform/t5-templates-db_postgresql:$CI_COMMIT_REF_NAME --build-arg UID=$(id -u) -f API/Dockerfile.postgresql .
- docker push registry.tech5-sa.com/t5-platform/t5-templates-db_app:$CI_COMMIT_REF_NAME
- docker push registry.tech5-sa.com/t5-platform/t5-templates-db_postgresql:$CI_COMMIT_REF_NAME
tags:
- t5
- t5-templates-db
stage: test
image:
name: postman/newman_alpine33
entrypoint:[""]
before_script:
- docker login -u "$CI_REGISTRY_USER" -P "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- docker-compose up
- newman --version
- newman run ${POSTMAN_COLLECTION} -e ${POSTMAN_ENVIRONMENT}
【问题讨论】:
标签: docker-compose dockerfile gitlab-ci gitlab-ci-runner