-
Notifications
You must be signed in to change notification settings - Fork 23
158 lines (139 loc) · 5.34 KB
/
cluster-init.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: infra/cluster-init
on:
# Automatically run CI on Release and Pre-Release tags and main branch
# (only if there are changes to relevant paths)
push:
tags:
- "cluster-init/v[0-9]+.[0-9]+.[0-9]+*"
branches:
- main
paths:
- ".github/workflows/cluster-init.yaml"
- "infra/cluster-init/**"
# Automatically run CI on branches, that have active PR opened
pull_request:
branches:
- main
paths:
- ".github/workflows/cluster-init.yaml"
- "infra/cluster-init/**"
# To make it possible to trigger e2e CI workflow for any arbitrary git ref
workflow_dispatch:
jobs:
release-rules:
runs-on: ubuntu-latest
outputs:
release-type: ${{ steps.release-rules.outputs.release-type }}
steps:
- uses: actions/checkout@v4
- id: release-rules
uses: ./.github/actions/release-rules
with:
prefix: cluster-init/
build-cluster-init:
runs-on: ubuntu-latest
outputs:
cluster-init-version: ${{ steps.build-cluster-init.outputs.cluster-init-version }}
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run action build-cluster-init
id: build-cluster-init
uses: ./.github/actions/build-cluster-init
test-e2e:
runs-on: ubuntu-latest
env:
CLUSTER_INIT_VERSION: ${{ needs.build-cluster-init.outputs.cluster-init-version }}
CLUSTER_NAME: turing-e2e
ISTIO_VERSION: 1.9.9
KNATIVE_VERSION: 1.7.4
KNATIVE_ISTIO_VERSION: 1.7.1
LOCAL_REGISTRY: registry.localhost:5000
needs:
- build-cluster-init
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Download Cluster Init Docker tar archieve
uses: actions/download-artifact@v2
with:
name: cluster-init.${{ env.CLUSTER_INIT_VERSION }}.tar
- name: Run action cluster-init
uses: ./.github/actions/run-cluster-init
with:
cluster_name: ${{ env.CLUSTER_NAME}}
istio_version: ${{ env.ISTIO_VERSION}}
knative_version: ${{ env.KNATIVE_VERSION}}
knative_istio_version: ${{ env.KNATIVE_ISTIO_VERSION}}
local_registry: ${{ env.LOCAL_REGISTRY}}
cluster_init_version: ${{ env.CLUSTER_INIT_VERSION }}
- name: Smoke Test
run: |
# Create hello world knative service
tee service.yaml <<EOF
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: helloworld-go
namespace: default
spec:
template:
spec:
containers:
- image: gcr.io/knative-samples/helloworld-go
env:
- name: TARGET
value: "Hello Knative Serving is up and running!!"
EOF
kubectl apply -f service.yaml
# wait till service is up
timeout --foreground 120 bash -c 'until kubectl get service.serving.knative.dev/helloworld-go --output=jsonpath='{.status.conditions[1]}' | grep "True"; do : ; done'
kubectl get ksvc
curl -f http://helloworld-go.default.127.0.0.1.nip.io/
kubectl delete service helloworld-go
# Invoke helm hooks on delete
- name: Tear down infrastructure job
run: helm delete --namespace infrastructure turing-init --timeout 15m
publish:
# Automatically publish release and pre-release artifacts.
#
# As for dev releases, make it possible to publish artifacts
# manually by approving 'deployment' in the 'manual' environment.
#
# Dev build can be released either from the 'main' branch or
# by running this workflow manually with `workflow_dispatch` event.
if: >-
contains('release,pre-release', needs.release-rules.outputs.release-type)
|| ( github.event_name != 'pull_request' )
|| ( github.event.pull_request.head.repo.full_name == github.repository )
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
runs-on: ubuntu-latest
needs:
- release-rules
- build-cluster-init
- test-e2e
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download Cluster Init Docker tar archieve
uses: actions/download-artifact@v2
with:
name: cluster-init.${{ needs.build-cluster-init.outputs.cluster-init-version }}.tar
- name: Publish Cluster Init Docker Image
env:
DOCKER_REPOSITORY: ghcr.io/${{ github.repository }}
run: |
docker image load --input cluster-init.${{ needs.build-cluster-init.outputs.cluster-init-version }}.tar
docker tag \
cluster-init:${{ needs.build-cluster-init.outputs.cluster-init-version }} \
${{ env.DOCKER_REPOSITORY }}/cluster-init:${{ needs.build-cluster-init.outputs.cluster-init-version }}
docker push ${{ env.DOCKER_REPOSITORY }}/cluster-init:${{ needs.build-cluster-init.outputs.cluster-init-version }}