-
Notifications
You must be signed in to change notification settings - Fork 133
142 lines (120 loc) · 4.69 KB
/
openshift.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
name: MicroShift Tests
on:
workflow_call:
inputs:
dc_app:
required: true
type: string
secrets:
BITBUCKET_LICENSE:
description: 'Bitbucket license'
CONFLUENCE_LICENSE:
description: 'Confluence license'
JIRA_LICENSE:
description: 'Jira license'
BAMBOO_LICENSE:
description: 'Bamboo license'
OPENSHIFT_PULL_SECRET:
description: 'OpenShift Pull Secret'
jobs:
microshift:
if: ${{ github.event.label.name == 'e2e' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
runs-on: ubuntu-24.04
env:
DC_APP: ${{inputs.dc_app}}
LICENSE: ${{ secrets[format('{0}_LICENSE', inputs.dc_app)] }}
OPENSHIFT_PULL_SECRET: ${{ secrets.OPENSHIFT_PULL_SECRET }}
KUBECONFIG: /home/runner/.crc/machines/crc/kubeconfig
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Write pull secret file
run: |
echo "${OPENSHIFT_PULL_SECRET}" | base64 -d > pull-secret.txt
- name: Fetch crc binary
run: |
CRC_VERSION="2.31.0"
wget -q https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/${CRC_VERSION}/crc-linux-amd64.tar.xz
tar -xvf crc-linux-amd64.tar.xz
sudo cp crc-linux-${CRC_VERSION}-amd64/crc /usr/bin/crc
sudo chmod a+x /usr/bin/crc
- name: Fetch oc binary
run: |
wget -q https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.14/openshift-client-linux.tar.gz
tar -xvf openshift-client-linux.tar.gz
sudo cp oc /usr/bin/oc
sudo chmod a+x /usr/bin/oc
- name: Install required virtualization software
run: |
sudo apt-get update
sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system virtiofsd
sudo usermod -a -G libvirt $USER
- name: Free up disk
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo swapoff -a
sudo rm -f /mnt/swapfile
- name: Set crc config and microshift profile
run: |
crc config set consent-telemetry no
crc config set network-mode user
crc config set preset microshift
- name: Setup the crc
run: sudo -su $USER crc setup
- name: Start MicroShift
run: sudo -su $USER crc start -p pull-secret.txt --log-level debug
- name: Create atlassian namespace
run: |
oc create namespace atlassian
- name: Grant anyuid SCC for the default service account
run: |
SCC=("anyuid")
for i in ${SCC[@]} ; do
oc adm policy add-scc-to-user ${i} system:serviceaccount:atlassian:default
done
- name: Create shared home pvc
run: |
oc apply -f src/test/config/openshift/shared-home-pvc.yaml
- name: Deploy postgres database
run: |
source src/test/scripts/kind/deploy_app.sh
deploy_postgres
- name: Create db, admin and license secrets
run: |
source src/test/scripts/kind/deploy_app.sh
create_secrets
- name: Deploy ${{inputs.dc_app}}
run: |
export OPENSHIFT_VALUES="-f ./src/test/config/openshift/openshift.yaml --set ${DC_APP}.resources.container.requests.cpu=20m --set ${DC_APP}.resources.container.requests.memory=5Mi --set synchrony.resources.container.requests.cpu=20m --set synchrony.resources.container.requests.memory=5Mi"
source src/test/scripts/kind/deploy_app.sh
deploy_app
- name: Verify ${{inputs.dc_app}} status
run: |
export OPENSHIFT_VALUES="1"
source src/test/scripts/kind/deploy_app.sh
verify_ingress
- name: Verify ${{inputs.dc_app}} metrics availability
run: |
source src/test/scripts/kind/deploy_app.sh
verify_metrics
- name: Verify ${{inputs.dc_app}} analytics value
run: |
source src/test/scripts/kind/deploy_app.sh
verify_openshift_analytics
- name: Get debug info
if: always()
run: |
curl -s https://raw.githubusercontent.com/atlassian-labs/data-center-terraform/main/scripts/collect_k8s_logs.sh | bash -s -- dummy dummy logs/${{inputs.dc_app}}
- name: Upload test log files
if: always()
uses: actions/[email protected]
with:
name: kind-artifacts
path: logs/