Skip to content

Commit 28d6040

Browse files
committed
Update workflow
1 parent 7b940eb commit 28d6040

File tree

3 files changed

+79
-59
lines changed

3 files changed

+79
-59
lines changed

.github/workflows/build-push-gcr.yaml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build & Publish Image to GCR
33
on:
44
push:
55
branches:
6-
- master
6+
- non-existing-branch
77

88
env:
99
PROJECT_ID: hackathon-297608
@@ -14,18 +14,23 @@ env:
1414
jobs:
1515
gcloud-install-build-push-GCR:
1616
name: Add gcloud, Build & Publish
17-
runs-on: ubuntu-18.04
17+
runs-on: ubuntu-20.04
1818
steps:
1919
- name: Checkout
20-
uses: actions/checkout@v2
20+
uses: actions/checkout@v3
21+
22+
- name: Google Authentication
23+
uses: google-github-actions/[email protected]
24+
with:
25+
credentials_json: ${{ secrets.GCR_SERVICE_ACCOUNT_KEY }}
2126

2227
- name: Setup gcloud cli
23-
uses: google-github-actions/setup-gcloud@v0.2.0
28+
uses: google-github-actions/setup-gcloud@v0.6.0
2429
with:
25-
version: '290.0.1'
26-
service_account_key: ${{ secrets.GCR_SERVICE_ACCOUNT_KEY }}
30+
version: '391.0.0'
2731

2832
- name: Build & Publish
33+
working-directory: iris
2934
run: |
3035
gcloud auth configure-docker
3136
export TAG=${GCR_LOCATION}/${PROJECT_ID}/$(echo ${IMAGE_NAME,,} | tr '/' '-'):${GITHUB_SHA}

.github/workflows/workflow.yaml

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- master
77
release:
88
types:
9-
- published
9+
- published
1010

1111
# Environment variables.
1212
# ${{ secrets }} are taken from GitHub -> Settings -> Secrets
@@ -26,76 +26,82 @@ env:
2626
jobs:
2727
gcloud-setup-and-build-and-publish-to-GCR:
2828
name: Setup gcloud utility, Build DC-ANALYTICS image and Publish it to Container Registry
29-
runs-on: ubuntu-18.04
29+
runs-on: ubuntu-20.04
3030
steps:
3131
- name: Checkout
32-
uses: actions/checkout@v2
32+
uses: actions/checkout@v3
33+
34+
- name: Google Authentication
35+
uses: google-github-actions/[email protected]
36+
with:
37+
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}
3338

3439
- name: Setup gcloud cli
35-
uses: google-github-actions/setup-gcloud@v0.2.0
40+
uses: google-github-actions/setup-gcloud@v0.6.0
3641
with:
37-
version: '320.0.0'
38-
service_account_key: ${{ secrets.SERVICE_ACCOUNT_KEY }}
42+
version: '391.0.0'
3943

4044
- name: Configure docker to use the gcloud as a credential helper
4145
run: |
42-
gcloud auth configure-docker
46+
gcloud --quiet auth configure-docker
4347
4448
- name: Build DC-ANALYTICS image
49+
working-directory: iris
4550
run: |
4651
docker build -t ${GCR_LOCATION}/${PROJECT_ID}/${IMAGE_NAME}:${GITHUB_SHA} .
4752
4853
- name: Publish DC-ANALYTICS image to Google Container Registry
54+
working-directory: iris
4955
run: |
5056
docker push ${GCR_LOCATION}/${PROJECT_ID}/${IMAGE_NAME}:${GITHUB_SHA}
5157
52-
gke-provisioner:
53-
# Inspired by:
54-
## https://www.terraform.io/docs/github-actions/getting-started.html
55-
## https://github.com/hashicorp/terraform-github-actions
56-
name: Provision GKE cluster
57-
runs-on: ubuntu-18.04
58-
steps:
59-
- name: Checkout
60-
uses: actions/checkout@v2
61-
62-
- name: Terraform init
63-
uses: hashicorp/terraform-github-actions@master
64-
with:
65-
tf_actions_version: 0.12.17
66-
tf_actions_subcommand: 'init'
67-
tf_actions_working_dir: 'terraform'
68-
69-
- name: Terraform validate
70-
uses: hashicorp/terraform-github-actions@master
71-
with:
72-
tf_actions_version: 0.12.17
73-
tf_actions_subcommand: 'validate'
74-
tf_actions_working_dir: 'terraform'
75-
76-
- name: Terraform plan
77-
uses: hashicorp/terraform-github-actions@master
78-
with:
79-
tf_actions_version: 0.12.17
80-
tf_actions_subcommand: 'plan'
81-
tf_actions_working_dir: 'terraform'
82-
83-
- name: Terraform apply
84-
uses: hashicorp/terraform-github-actions@master
85-
with:
86-
tf_actions_version: 0.12.17
87-
tf_actions_subcommand: 'apply'
88-
tf_actions_working_dir: 'terraform'
58+
# gke-provisioner:
59+
# # Inspired by:
60+
# ## https://www.terraform.io/docs/github-actions/getting-started.html
61+
# ## https://github.com/hashicorp/terraform-github-actions
62+
# name: Provision GKE cluster
63+
# runs-on: ubuntu-20.04
64+
# steps:
65+
# - name: Checkout
66+
# uses: actions/checkout@v3
67+
68+
# - name: Terraform init
69+
# uses: hashicorp/terraform-github-actions@master
70+
# with:
71+
# tf_actions_version: 0.12.17
72+
# tf_actions_subcommand: 'init'
73+
# tf_actions_working_dir: 'terraform'
74+
75+
# - name: Terraform validate
76+
# uses: hashicorp/terraform-github-actions@master
77+
# with:
78+
# tf_actions_version: 0.12.17
79+
# tf_actions_subcommand: 'validate'
80+
# tf_actions_working_dir: 'terraform'
81+
82+
# - name: Terraform plan
83+
# uses: hashicorp/terraform-github-actions@master
84+
# with:
85+
# tf_actions_version: 0.12.17
86+
# tf_actions_subcommand: 'plan'
87+
# tf_actions_working_dir: 'terraform'
88+
89+
# - name: Terraform apply
90+
# uses: hashicorp/terraform-github-actions@master
91+
# with:
92+
# tf_actions_version: 0.12.17
93+
# tf_actions_subcommand: 'apply'
94+
# tf_actions_working_dir: 'terraform'
8995

9096
kubernetes-deploy:
9197
name: Deploy Kubernetes manifests to GKE cluster
9298
needs:
9399
- gcloud-setup-and-build-and-publish-to-GCR
94-
- gke-provisioner
95-
runs-on: ubuntu-18.04
100+
# - gke-provisioner
101+
runs-on: ubuntu-20.04
96102
steps:
97103
- name: Checkout
98-
uses: actions/checkout@v2
104+
uses: actions/checkout@v3
99105

100106
- name: Replace placeholders with values in statefulset template
101107
working-directory: ./k8s/
@@ -105,15 +111,21 @@ jobs:
105111
sed "s|DOCKER_IMAGE_TAG|${GITHUB_SHA}|" > statefulset.yaml
106112
cat statefulset.yaml
107113
114+
- name: Google Authentication
115+
uses: google-github-actions/[email protected]
116+
with:
117+
credentials_json: ${{ secrets.SERVICE_ACCOUNT_KEY }}
118+
108119
- name: Setup gcloud cli
109-
uses: google-github-actions/setup-gcloud@v0.2.0
120+
uses: google-github-actions/setup-gcloud@v0.6.0
110121
with:
111-
version: '320.0.0'
112-
service_account_key: ${{ secrets.SERVICE_ACCOUNT_KEY }}
122+
version: '391.0.0'
113123

114124
- name: Apply Kubernetes manifests
115125
working-directory: ./k8s/
116126
run: |
127+
gcloud components install gke-gcloud-auth-plugin
128+
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
117129
gcloud container clusters get-credentials ${GKE_CLUSTER} --zone ${GKE_ZONE} --project ${PROJECT_ID}
118130
kubectl apply -f namespace.yaml
119131
kubectl apply -f managed-certificate.yaml

k8s/ingress.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
apiVersion: extensions/v1beta1
1+
apiVersion: networking.k8s.io/v1
22
kind: Ingress
33
metadata:
44
annotations:
@@ -15,6 +15,9 @@ spec:
1515
http:
1616
paths:
1717
- backend:
18-
serviceName: dc-analytics
19-
servicePort: 52773
18+
service:
19+
name: dc-analytics
20+
port:
21+
number: 52773
2022
path: /*
23+
pathType: ImplementationSpecific

0 commit comments

Comments
 (0)