-
Notifications
You must be signed in to change notification settings - Fork 11
134 lines (107 loc) · 4.9 KB
/
E2E_CI.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
name: E2E Build
on:
pull_request
jobs:
extract_metadata:
runs-on: ubuntu-latest
name: Extract supported_features
outputs:
supported-features: ${{ steps.supported-features.outputs.value }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: extract supported features
id: supported-features
run: echo "value=$(node -p -e "require('./px_metadata.json').supported_features?.join(' or ') || ''")" >> "$GITHUB_OUTPUT"
CI:
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- extract_metadata
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Build local cluster
run: ./ci_files/build_cluster.sh
- name: Set up Docker
uses: docker/setup-buildx-action@v1
- name: Build Sample-site Docker image
run: |
docker build -t localhost:5001/node-sample-site:1.0.0 . && docker images && docker push localhost:5001/node-sample-site:1.0.0
env:
DOCKER_BUILDKIT: 1
- name: install helm
run: |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm=3.12.1-1
- name: Clone helm charts repo - mock-collector
uses: actions/checkout@v2
with:
repository: PerimeterX/connect-helm-charts
token: ${{ secrets.CONNECT_PULL_TOKEN }}
ref: mock-collector-0.1.0
path: ./deploy_charts/mock-collector
- name: Clone helm charts repo - enforcer-tests
uses: actions/checkout@v2
with:
repository: PerimeterX/connect-helm-charts
token: ${{ secrets.CONNECT_PULL_TOKEN }}
ref: enforcer-spec-tests-0.6.0
path: ./deploy_charts/enforcer-spec-tests
- name: Clone helm charts repo - sample-site
uses: actions/checkout@v2
with:
repository: PerimeterX/connect-helm-charts
token: ${{ secrets.CONNECT_PULL_TOKEN }}
ref: sample-site-0.1.0
path: ./deploy_charts/sample-site
- name: deploy sample site
run: |
helm install sample-site ./deploy_charts/sample-site/charts/sample-site --set image.name=localhost:5001/node-sample-site --set image.tag=1.0.0 --set imagePullPolicy=Always --set collectorURL=http://mock-collector-mock-collector:3001 --wait
- name: Set up Google Cloud SDK
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCR_SA_KEY }}'
- name: Configure Docker credentials
run: |
gcloud auth configure-docker gcr.io
- name: pull mock collector image
run: |
docker pull gcr.io/px-docker-repo/connecteam/mock-collector:1.0.2 && \
docker tag gcr.io/px-docker-repo/connecteam/mock-collector:1.0.2 localhost:5001/mock-collector:1.0.2 && \
docker push localhost:5001/mock-collector:1.0.2 && \
docker images
- name: deploy mock collector
run: |
helm install mock-collector ./deploy_charts/mock-collector/charts/mock-collector --set image.repository=localhost:5001/mock-collector --set image.tag=1.0.2 --set imagePullPolicy=Always --wait
- run: kubectl get pods
- name: pull enforcer tests image
run: |
docker pull gcr.io/px-docker-repo/connecteam/enforcer-specs-tests:1.1.0 && \
docker tag gcr.io/px-docker-repo/connecteam/enforcer-specs-tests:1.1.0 localhost:5001/enforcer-spec-tests:1.1.0 && \
docker push localhost:5001/enforcer-spec-tests:1.1.0 && \
docker images
- name: run enforcer tests
run: |
helm install enforcer-spec-tests ./deploy_charts/enforcer-spec-tests/charts/enforcer-spec-tests --set image.repository=localhost:5001/enforcer-spec-tests --set image.tag=1.1.0 --set imagePullPolicy=Always \
--set internalMockCollectorURL=http://mock-collector-mock-collector:3001 \
--set appID=PXnEpdw6lS \
--set siteURL=http://sample-site-sample-site:3000 \
--set cookieSecret=${{ secrets.TEST_COOKIE_SECRET }} \
--set supportedFeatures="${{ needs.extract_metadata.outputs.supported-features }}" \
--set-file enforcerMetadataContent=./px_metadata.json
- name: wait until test is over
run: ./ci_files/wait-for-job.sh
env:
JOB_NAME: enforcer-spec-tests
- name: get tests results
if: ${{ always() }}
run: kubectl logs job/enforcer-spec-tests