106 lines
3.2 KiB
YAML
106 lines
3.2 KiB
YAML
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
docker:
|
|
- image: circleci/golang:1.11.0
|
|
working_directory: /go/src/github.com/roboll/helmfile
|
|
steps:
|
|
- checkout
|
|
- run: make build
|
|
- persist_to_workspace:
|
|
root: /go/src/github.com/roboll/helmfile
|
|
paths:
|
|
- .
|
|
|
|
test:
|
|
docker:
|
|
- image: circleci/golang:1.11.0
|
|
working_directory: /go/src/github.com/roboll/helmfile
|
|
steps:
|
|
- checkout
|
|
- run: make check
|
|
- run: make pristine
|
|
- run: make test
|
|
|
|
# thanks to https://raw.githubusercontent.com/weaveworks/launcher/master/.circleci/config.yml
|
|
integration_tests:
|
|
machine: true
|
|
environment:
|
|
CHANGE_MINIKUBE_NONE_USER: true
|
|
steps:
|
|
- checkout
|
|
- run: mkdir ~/build
|
|
- attach_workspace:
|
|
at: ~/build
|
|
- run: cp ~/build/helmfile ~/project/helmfile
|
|
- run:
|
|
name: Install helm
|
|
environment:
|
|
HELM_VERSION: v2.9.0
|
|
command: |
|
|
HELM_FILENAME="helm-${HELM_VERSION}-linux-amd64.tar.gz"
|
|
curl -Lo ${HELM_FILENAME} "https://kubernetes-helm.storage.googleapis.com/${HELM_FILENAME}"
|
|
tar zxf ${HELM_FILENAME} linux-amd64/helm
|
|
chmod +x linux-amd64/helm
|
|
sudo mv linux-amd64/helm /usr/local/bin/
|
|
- run:
|
|
name: Deploy minikube
|
|
environment:
|
|
CHANGE_MINIKUBE_NONE_USER: true
|
|
K8S_VERSION: v1.9.0
|
|
MINIKUBE_VERSION: v0.25.2
|
|
command: |
|
|
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl
|
|
chmod +x kubectl && sudo mv kubectl /usr/local/bin/
|
|
curl -Lo minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64
|
|
chmod +x minikube && sudo mv minikube /usr/local/bin/
|
|
sudo minikube config set WantReportErrorPrompt false
|
|
sudo -E minikube start --vm-driver=none --kubernetes-version=${K8S_VERSION}
|
|
sudo -E minikube update-context
|
|
- run:
|
|
name: Wait for nodes to become ready
|
|
command: JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'; until kubectl get nodes -o jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 1; done
|
|
- run:
|
|
name: Execute integration tests
|
|
command: |
|
|
export TERM=xterm
|
|
make integration
|
|
|
|
# GITHUB_TOKEN env var must be setup in circleci console
|
|
|
|
release:
|
|
docker:
|
|
- image: circleci/golang:1.11.0
|
|
working_directory: /go/src/github.com/roboll/helmfile
|
|
steps:
|
|
- checkout
|
|
- setup_remote_docker
|
|
- run:
|
|
command: |
|
|
docker login -u="$DOCKER_USER" -p="$DOCKER_PASS" quay.io
|
|
make tools
|
|
BUILD_URL="$CIRCLE_BUILD_URL" make push release
|
|
|
|
workflows:
|
|
version: 2
|
|
build_and_test:
|
|
jobs:
|
|
- build
|
|
- test
|
|
- integration_tests:
|
|
requires:
|
|
- build
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- /pull.*/
|
|
- release:
|
|
filters:
|
|
branches:
|
|
ignore: /.*/
|
|
tags:
|
|
only: /v.*/
|