-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
36 lines (33 loc) · 1.43 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
sudo: required
language: go
go:
- 1.14.2
services:
- docker
jobs:
include:
- stage: "Tests and Linting"
script:
- go vet ./...
- go test -v ./...
- stage: "Build and Push Docker Image"
script:
- docker build -t jaskaransarkaria/timer-server:"$TRAVIS_TAG" .
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- docker push jaskaransarkaria/timer-server:"$TRAVIS_TAG"
- stage: Deploy to Kubernetes
before_install:
- openssl aes-256-cbc -K $encrypted_2fd045226a67_key -iv $encrypted_2fd045226a67_iv -in client-secret.json.enc -out client-secret.json -d
- curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
script:
- kubectl version --client
- gcloud auth activate-service-account [email protected] --key-file=client-secret.json
- gcloud container clusters get-credentials jobspeed-production --zone europe-west2-a --project jobspeed
- sed -i "s/replace_with_git_tag/$TRAVIS_TAG/" .kubernetes/deployment.yaml
- kubectl apply -f .kubernetes/deployment.yaml
stages:
- name: Tests and Linting
- name: Build and Push Docker Image
if: tag IS present
- name: Deploy to Kubernetes
if: tag IS present