Skip to content

Commit a9e9bec

Browse files
ci: skeleton
Signed-off-by: viktor-kurchenko <viktor.kurchenko@isovalent.com>
1 parent 6b24d37 commit a9e9bec

File tree

1 file changed

+180
-0
lines changed

1 file changed

+180
-0
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
name: OpenShift Operator certification pipeline
2+
on:
3+
push:
4+
workflow_dispatch:
5+
inputs:
6+
aws_region:
7+
description: 'AWS region'
8+
default: 'eu-central-1'
9+
type: choice
10+
options:
11+
- 'us-east-1'
12+
- 'us-east-2'
13+
- 'us-west-2'
14+
- 'us-west-1'
15+
- 'eu-west-1'
16+
- 'eu-central-1'
17+
- 'sa-east-1'
18+
- 'ap-northeast-1'
19+
- 'ap-southeast-1'
20+
- 'ap-southeast-2'
21+
- 'ap-northeast-2'
22+
ocp_version:
23+
description: 'Openshift version'
24+
default: 'ocp-4-17'
25+
type: choice
26+
options:
27+
- 'ocp-4-14'
28+
- 'ocp-4-15'
29+
- 'ocp-4-16'
30+
- 'ocp-4-17'
31+
cilium_version:
32+
description: 'Cilium Version to use (ex: 1.16.4)'
33+
default: "1.16.4"
34+
required: true
35+
is_released:
36+
description: 'Is this version released ? No: `-ci` will be added to cilium_version'
37+
required: false
38+
type: boolean
39+
default: false
40+
run_tests:
41+
description: 'Run tests on the deployed cluster'
42+
required: false
43+
type: boolean
44+
default: false
45+
do_not_destroy:
46+
description: 'Do not destroy the cluster'
47+
required: false
48+
type: boolean
49+
default: false
50+
51+
permissions:
52+
contents: read
53+
id-token: write
54+
pull-requests: read
55+
statuses: write
56+
57+
env:
58+
TERRAFORM_VERSION: 1.10.3
59+
TEKTON_VERSION: 0.39.0
60+
OC_VERSION: 4.17.0
61+
OCP_VERSION: ocp-4-17
62+
PULL_SECRET_FILE: pull_secret.json
63+
REGION: eu-west-3
64+
AVAILABILITY_ZONES: '["eu-west-3a", "eu-west-3b", "eu-west-3c"]'
65+
CLUSTER_NAME: ocp-cert
66+
OWNER: ci
67+
BASE_DOMAIN: ci.covalent.lol
68+
WORKER_INSTANCE_TYPE: m5.xlarge
69+
WORKER_COUNT: 2
70+
CILIUM_ENABLED: true
71+
CILIUM_OLM_REPO_BRANCH: main-ce
72+
CILIUM_VERSION: v1.16.3
73+
OPENSHIFT_VERSION: 4.14.2
74+
INSTALL_TETRAGON: false
75+
CREATE_SUBSCRIPTION: false
76+
77+
jobs:
78+
deploy:
79+
runs-on: ubuntu-24.04
80+
timeout-minutes: 120
81+
steps:
82+
- name: Checkout workflow context branch
83+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
84+
with:
85+
persist-credentials: false
86+
87+
- name: Install Terraform
88+
uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # 3.1.2
89+
with:
90+
terraform_version: "${{ env.TERRAFORM_VERSION }}"
91+
terraform_wrapper: false
92+
93+
- name: Install Tekton CLI
94+
run: |
95+
curl -LO https://github.com/tektoncd/cli/releases/download/v${{ env.TEKTON_VERSION }}/tkn_${{ env.TEKTON_VERSION }}_Linux_x86_64.tar.gz
96+
sudo tar xvzf tkn_${{ env.TEKTON_VERSION }}_Linux_x86_64.tar.gz -C /usr/local/bin/ tkn
97+
98+
- name: Checkout OpenShift CuTE repository
99+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
100+
with:
101+
repository: isovalent/cute-openshift-aws
102+
token: ${{ secrets.READ_PRIVATE_REPOSITORIES }} # TODO: replace with ISOVALENT_BOT_READ_PRIVATE_REPOSITORIES
103+
path: ocp
104+
105+
- name: Configure Git
106+
run: |
107+
# TODO: replace with ISOVALENT_BOT_READ_PRIVATE_REPOSITORIES
108+
git config --global url."https://oauth2:${{ secrets.READ_PRIVATE_REPOSITORIES }}@github.com".insteadOf ssh://git@github.com
109+
git config --global url."https://oauth2::${{ secrets.READ_PRIVATE_REPOSITORIES }}@github.com".insteadOf git@github.com
110+
111+
git config --global --list
112+
113+
- name: Install OpenShift CLI tools
114+
uses: redhat-actions/openshift-tools-installer@144527c7d98999f2652264c048c7a9bd103f8a82 # v1.13.1
115+
with:
116+
source: "mirror"
117+
oc: "${{ env.OC_VERSION }}"
118+
119+
- name: Set up AWS credentials
120+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
121+
with:
122+
role-to-assume: arn:aws:iam::478566851380:role/CuTE_CIAccessRole
123+
aws-region: ${{ env.REGION }}
124+
role-duration-seconds: 43200 # 12 hours
125+
126+
- name: Configure terraform variables
127+
working-directory: ./ocp/${{ env.OCP_VERSION }}
128+
run: |
129+
# TODO: replace RH_PULL_SECRET secret
130+
echo '${{ secrets.RH_PULL_SECRET }}' | python -m json.tool > ${{ env.PULL_SECRET_FILE }}
131+
132+
# Use less loaded region
133+
cat > terraform.tfvars<<EOF
134+
region = "${{ env.REGION }}"
135+
availability_zones = ${{ env.AVAILABILITY_ZONES }}
136+
cluster_name = "${{ env.CLUSTER_NAME }}"
137+
owner = "${{ env.OWNER }}"
138+
base_domain = "${{ env.BASE_DOMAIN }}"
139+
pull_secret_path = "${{ env.PULL_SECRET_FILE }}"
140+
worker_instance_type = "${{ env.WORKER_INSTANCE_TYPE }}"
141+
workers_count = ${{ env.WORKER_COUNT }}
142+
cilium_enabled = ${{ env.CILIUM_ENABLED }}
143+
cilium_olm_repo_branch = "${{ env.CILIUM_OLM_REPO_BRANCH }}"
144+
cilium_version = "${{ env.CILIUM_VERSION }}"
145+
openshift_version = "${{ env.OPENSHIFT_VERSION }}"
146+
install_tetragon = ${{ env.INSTALL_TETRAGON }}
147+
create_subscription = ${{ env.CREATE_SUBSCRIPTION }}
148+
EOF
149+
150+
cat terraform.tfvars
151+
152+
- name: Provision OpenShift cluster
153+
working-directory: ./ocp/${{ env.OCP_VERSION }}
154+
timeout-minutes: 60
155+
run: |
156+
make apply AUTO_APPROVE=true
157+
export KUBECONFIG=$(terraform output -json | jq .path_to_kubeconfig_file.value -r)
158+
159+
- name: Test OC CLI
160+
working-directory: ./ocp/${{ env.OCP_VERSION }}
161+
run: |
162+
oc get nodes
163+
cat $KUBECONFIG
164+
admpass=$(echo ${KUBECONFIG/kubeconfig/kubeadmin-password})
165+
echo "kubeadmin-password: $admpass"
166+
echo "sleeping..."
167+
sleep 180
168+
169+
- name: Clean
170+
if: always()
171+
working-directory: ./ocp/${{ env.OCP_VERSION }}
172+
timeout-minutes: 60
173+
run: |
174+
make destroy AUTO_APPROVE=true
175+
176+
- name: Remove sensitive data
177+
if: always()
178+
working-directory: ./ocp/${{ env.OCP_VERSION }}
179+
run: |
180+
rm -f ${{ env.PULL_SECRET_FILE }}

0 commit comments

Comments
 (0)