variables:
  DOCKER_DRIVER: overlay

stages:
- build
- docker
- deploy

# configure $GOPATH correctly on all build stages
before_script:
  - mkdir -p "$GOPATH/src/gitlab.jetstack.net/$CI_PROJECT_NAMESPACE"
  - ln -s "$(pwd)" "$GOPATH/src/gitlab.jetstack.net/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"
  - cd "$GOPATH/src/gitlab.jetstack.net/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"

test:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make test_golang

vet:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make vet_golang

fmt:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make fmt_golang

build:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make build
  artifacts:
    paths:
    - colonel_linux_amd64

docker:image:
  image: docker:latest
  stage: docker
  tags:
  - docker
  script:
  - apk add --no-cache
      make
  - make docker_build docker_push IMAGE_TAGS="${CI_BUILD_REF_SLUG}-${CI_PIPELINE_ID} latest"
  only:
  - master
  services:
  - docker:dind
  dependencies:
  - build:golang

variables:
  DOCKER_DRIVER: overlay

stages:
- build
- docker
- deploy

# configure $GOPATH correctly on all build stages
before_script:
  - mkdir -p "$GOPATH/src/gitlab.jetstack.net/$CI_PROJECT_NAMESPACE"
  - ln -s "$(pwd)" "$GOPATH/src/gitlab.jetstack.net/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"
  - cd "$GOPATH/src/gitlab.jetstack.net/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"

test:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make test_golang

vet:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make vet_golang

fmt:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make fmt_golang

build:golang:
  image: golang:1.8
  stage: build
  tags:
  - docker
  script:
  - make build
  artifacts:
    paths:
    - colonel_linux_amd64

docker:image:
  image: docker:latest
  stage: docker
  tags:
  - docker
  script:
  - apk add --no-cache
      make
  - mkdir -p ~/.docker && echo "${DOCKER_AUTH_CONFIG}" > ~/.docker/config.json && chmod 600 ~/.docker/config.json
  - make docker_build docker_push IMAGE_TAGS="${CI_BUILD_REF_SLUG}-${CI_PIPELINE_ID} latest"
  only:
  - master
  services:
  - docker:dind
  dependencies:
  - build:golang

Fix auth for docker hub
Fix auth for docker hub
