forked from vernemq/docker-vernemq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
90 lines (80 loc) · 3.07 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
sudo: 'required'
services:
- 'docker'
language: bash
stages:
- name: test
if: type = pull_request
- name: deploy
if: type != pull_request AND (branch = master OR tag IS present)
jobs:
include:
- &buildandtest
stage: test
before_script: docker build --build-arg TARGET=${TARGET} -t vmq-travis -f ${DOCKERFILE} .
script: docker run vmq-travis vernemq
env:
- DOCKERFILE=Dockerfile TARGET=rel
- <<: *buildandtest
env:
- DOCKERFILE=Dockerfile.alpine TARGET=rel
- &buildlatest
stage: deploy
before_script: docker build --build-arg TARGET=${TARGET} -t vmq-travis -f ${DOCKERFILE} .
env:
- DOCKERFILE=Dockerfile TARGET=rel TAG_SUFFIX=""
script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
- docker tag vmq-travis vernemq/vernemq:latest$TAG_SUFFIX
- docker push vernemq/vernemq:latest$TAG_SUFFIX
- <<: *buildlatest
env:
- DOCKERFILE=Dockerfile.alpine TARGET=rel TAG_SUFFIX="-alpine"
- &buildtag
stage: deploy
if: tag IS present AND NOT env(TRAVIS_TAG) =~ ^helm-
before_script: docker build --build-arg TARGET=${TARGET} -t vmq-travis -f ${DOCKERFILE} .
env:
- DOCKERFILE=Dockerfile TARGET=rel TAG_SUFFIX=""
script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin
- docker tag vmq-travis vernemq/vernemq:$TRAVIS_TAG$TAG_SUFFIX
- docker push vernemq/vernemq:$TRAVIS_TAG$TAG_SUFFIX
- <<: *buildtag
env:
- DOCKERFILE=Dockerfile.alpine TARGET=rel TAG_SUFFIX="-alpine"
- &helmlint
name: Helm lint
stage: test
env:
- KUBECTL_VERSION=v1.11.3
- HELM_VERSION=v2.11.0
install:
- wget https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl -O /tmp/kubectl
- chmod +x /tmp/kubectl
- wget http://storage.googleapis.com/kubernetes-helm/helm-${HELM_VERSION}-linux-amd64.tar.gz -O /tmp/helm.tar.gz
- tar xzf /tmp/helm.tar.gz -C /tmp --strip-components=1
- chmod +x /tmp/helm
- export PATH=$PATH:/tmp
before_script:
- helm init --client-only
script:
- helm lint helm/vernemq
- helm template -f helm/vernemq/values.yaml helm/vernemq
- helm package --save=false helm/vernemq
- <<: *helmlint
name: Helm deploy
if: tag IS present AND env(TRAVIS_TAG) =~ ^helm-
stage: deploy
after_script:
- git config user.name "travis"
- git config user.email "deploy@travis-ci.org"
- git stash push -u -- vernemq-*.tgz
- git config --replace-all remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
- git fetch origin helm-charts
- git checkout helm-charts
- git stash pop
- helm repo index .
- git add vernemq-*.tgz index.yaml
- git commit -m "Add helm chart release $TRAVIS_BRANCH"
- git push -q https://$GITHUB_USER:$GITHUB_TOKEN@github.com/vernemq/docker-vernemq helm-charts &>/dev/null