-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (68 loc) · 2.61 KB
/
dev.yaml
File metadata and controls
80 lines (68 loc) · 2.61 KB
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
name: Build, Tag, Publish and Deploy to GKE
on:
push:
branches:
- dev
# Environment variables available to all jobs and steps in this workflow
env:
GITHUB_SHA: ${{ github.sha }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_ORGANIZATION: ${{ secrets.DOCKER_ORGANIZATION }}
PROJECT_ID: ${{ secrets.GKE_PROJECT }}
GKE_CLUSTER: wisp-prod
GKE_ZONE: northamerica-northeast1-c
IMAGE: wisp-ui
jobs:
setup-build-tag-publish-deploy:
name: Setup, Build, Tag, Publish, and Deploy
runs-on: ubuntu-latest
steps:
# Checkout Commit
- name: Checkout
uses: actions/checkout@v2
# Setup gcloud CLI
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
# Configure Docker to use the gcloud command-line tool as a credential
# helper for authentication
- run: |-
gcloud --quiet auth configure-docker
- run: |-
gcloud container clusters get-credentials "$GKE_CLUSTER" --zone "$GKE_ZONE"
# Build the Docker image
- name: Build
run: |
docker build -t "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) \
--build-arg VUE_APP_WISP_API_URL=https://dev-api.wisp.training .
# Tag the Docker image
- name: Tag
run: |
docker tag "$DOCKER_ORGANIZATION"/"$IMAGE":dev-$(echo ${GITHUB_SHA} | cut -c1-8) "$DOCKER_ORGANIZATION"/"$IMAGE":dev-latest
# Push the Docker image to Dockerhub
- name: Publish
run: |
docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
docker push $DOCKER_ORGANIZATION/$IMAGE
env:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# Install helm for use in pipeline
- name: Install helm
run: |
wget -q -O get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
# Deploy to GKE cluster using helm
- name: Deploy
run: |-
helm upgrade --atomic --install dev-ui ./chart/wisp-ui/ --namespace dev --set image.tag=dev-$(echo ${GITHUB_SHA} | cut -c1-8)
e2e:
needs: setup-build-tag-publish-deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: wget https://raw.githubusercontent.com/Compete-McGill/wisp/master/e2e/docker-compose.yaml -O docker-compose.e2e.yaml
- run: docker login -u=$DOCKER_USERNAME -p=$DOCKER_PASSWORD
- run: docker-compose -f docker-compose.e2e.yaml up --abort-on-container-exit