如何在GitLab CI中重新创建Travis CI环境

时间:2018-09-23 18:59:07

标签: continuous-integration travis-ci gitlab-ci gitlab-ci-runner

我正在尝试将项目从Travis CI迁移到GitLab CI。我相信bash脚本不需要更改-除了交换默认提供的几个env变量之外。但是,我一直无法在GitLab yaml文件中重新创建环境。

sudo: required

services:
  - docker

env:
  DOCKER_COMPOSE_VERSION: 1.21.1

before_install:
  - sudo rm /usr/local/bin/docker-compose
  - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
  - chmod +x docker-compose
  - sudo mv docker-compose /usr/local/bin

script:
  - bash test-ci.sh $TRAVIS_BRANCH

after_success:
  - bash ./docker-push.sh
  - bash ./docker-deploy-stage.sh
  - bash ./docker-deploy-prod.sh

这是我最近的失败尝试:

image: ubuntu:14.04

services:
  - docker:dind

variables:
  DOCKER_COMPOSE_VERSION: 1.21.1

before_script:
  - apt-get update -qq && apt-get install -y -qq apt-transport-https ca-certificates curl software-properties-common unzip python3 python3-pip docker.io libcgroup1 
  - pip3 install awscli
  - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
  - chmod +x docker-compose
  - sudo mv docker-compose /usr/local/bin

stages:
  - build

build:
  stage: build
  script:
    - bash ./docker-push.sh
    - bash ./docker-deploy-stage.sh
    - bash ./docker-deploy-prod.sh

这是我第一次尝试设置CI。有人知道我想念什么吗?

0 个答案:

没有答案