Blame docs/operations/ci/adding_cico_tenant/adding_cico_tenants.md

792b29
# CentOS CI - On-boarding
792b29
792b29
Note to users:
792b29
792b29
Please note that Infra space is for Fedora and CentOS related projects to
792b29
consume. Decision may take some time (often up to 2 weeks) as these are decided
792b29
by the whole team.
792b29
Once decided as go, we will create you a namespace in a openshift cluster where
792b29
you can configure your CI. We do provide a Jenkins template in case you want to be
792b29
able to consume vms/baremetal nodes to perform your CI.
792b29
792b29
Please answer the following questions so that we understand your requirement.
792b29
792b29
* How does your project relates to Fedora/CentOS?
792b29
* Describe your work flow and if you need any special permissions (other than
792b29
  admin access to namespace), please tell us and provide a reason for them.
792b29
* Do you need bare-metal/vms checkout capability? (we prefer your workflow
792b29
  containerized)
792b29
* Resources required
792b29
  * PVs:
792b29
792b29
```
792b29
Project_name:
792b29
Project_members:
792b29
 - user1@ACO_registered_email_address
792b29
 - user2@ACO_registered_email_address
792b29
```
792b29
792b29
## Steps
97a9dc
97a9dc
1. Create an entry in duffy db (with ssh key) - [follow adding-duffy-api-key.md](/operations/ci/adding_cico_tenant/adding    -duffy-api-key/)
97a9dc
2. Create an OpenShift namespace/project (done with ansible)
97a9dc
3. Create a PV(Persistent Volume) and deploy Jenkins instance (done with ansible)
97a9dc
97a9dc
## Create an entry in duffy db (with ssh key) - [follow adding-duffy-api-key.md](/operations/ci/adding_cico_tenant/adding-duffy-api-key/)
792b29
792b29
792b29
### Create an OpenShift namespace
792b29
97a9dc
!!! important 
97a9dc
    we don't use the previous specific git repo for projects, as it's now all using the `ocp-admin` ansible role, see below
97a9dc
97a9dc
To create the openshift namespace/project, just add edit the inventory/host_vars/<ocp_controller_node> and add the new project to the existin `ocp_projects_list` ansible list.
97a9dc
97a9dc
Example:
97a9dc
97a9dc
```
97a9dc
# Declaring projects that will be created in ocp.ci
97a9dc
ocp_projects_list:
97a9dc
  - name: ci-infra-test
97a9dc
    members:
97a9dc
      - ci-user1@centos.org
97a9dc
      - ci-user2@centos.org
97a9dc
97a9dc
```
97a9dc
97a9dc
Once done, don't forget to commit/push and you can also play that role directly with a specific tag.
97a9dc
97a9dc
```
97a9dc
ansible-playbook playbooks/role-ocp-admin-node.yml --tags "projects"
97a9dc
97a9dc
PLAY [hostgroup-role-ocp-admin-node] *****************************************************************************
97a9dc
97a9dc
TASK [ocp-admin-node : Rendering template for projects] **********************************************************
97a9dc
Tuesday 21 December 2021  09:20:42 +0100 (0:00:00.116)       0:00:00.116 ****** 
97a9dc
ok: [ocp-admin.ci.centos.org] => (item=ci-infra-test)
97a9dc
changed: [ocp-admin.ci.centos.org] => (item=samba)
792b29
97a9dc
TASK [ocp-admin-node : Creating/modifying project if needed] *****************************************************
97a9dc
Tuesday 21 December 2021  09:20:47 +0100 (0:00:05.123)       0:00:05.240 ****** 
97a9dc
skipping: [ocp-admin.ci.centos.org] => (item=ci-infra-test) 
97a9dc
changed: [ocp-admin.ci.centos.org] => (item=samba)
792b29
97a9dc
PLAY RECAP *******************************************************************************************************
97a9dc
ocp-admin.ci.centos.org    : ok=2    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
792b29
97a9dc
Tuesday 21 December 2021  09:20:48 +0100 (0:00:01.075)       0:00:06.316 ****** 
97a9dc
```
792b29
b762e3
!!! note
b762e3
    If you need to also modify members and/or email addresses, you can just follow the same process and replay the same playbook : that will reflect changes in openshift. If you need access to that private git repository (to be fixed and moved elsewhere in the official `centos` namespace, reach out to another infra team member
b762e3
792b29
97a9dc
## Deploy a PV (Persistent Volume) and Jenkins instance
792b29
97a9dc
!!! note
97a9dc
    In case you just need to create a PV *outside* of jenkins, follow [Persistent storage via NFS](https://docs.infra.centos.org/operations/ci/installation/persistant_storage_nfs/). 
f1ccc7
97a9dc
We have an ad-hoc ansible task (adhoc-ocp-deploy-jenkins-for-ci-tenant.yml) that will create the needed PV , create a template and apply it with the correct ssh keys and duffy api key so ensure that you followed previous steps so that you have the project keys into pkistore git repo (using project name) and also duffy api key ready (as script will ask you for it):
f1ccc7
97a9dc
```
97a9dc
ansible-playbook-ci playbooks/adhoc-ocp-deploy-jenkins-for-ci-tenant.yml
97a9dc
```
f1ccc7
97a9dc
Just answer the following questions (project has to exist first ! :
f1ccc7
97a9dc
```
97a9dc
Existing project/namespace in ocp we'll deploy jenkins to/for (has to exist before !) : samba
97a9dc
Persistent Volume size (example 10Gi) : 10Gi
97a9dc
Existing Duffy API key : <duffy_api_key>
97a9dc
97a9dc
```
792b29
97a9dc
Now you just have to wait for jenkins to be up and running 
792b29
97a9dc
!!! important
97a9dc
    We recently had an issue with the default jenkins image having outdated (and not working) [openshift sync plugin](https://plugins.jenkins.io/openshift-sync/) so be sure that you have at least 1.0.51 running in openshift. If not, update it first, and then configmap will be synced to jenkins, for the `cico-workspace` pod template