From b92f59a737d3bb2797fd85747dd8c3df17430043 Mon Sep 17 00:00:00 2001 From: Fabian Arrotin Date: Jun 30 2022 13:16:42 +0000 Subject: Simple notes for openshift/ocp.ci (user perspective) Signed-off-by: Fabian Arrotin --- diff --git a/docs/ci.md b/docs/ci.md index 032dd5f..dd224db 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -11,10 +11,49 @@ We offer the following resources : ## Openshift +We provide access to an [Openshift](https://console-openshift-console.apps.ocp.ci.centos.org/) cluster, hosted (actually) next to the Duffy ephemeral nodes infra. +Once [Infra ticket/request](https://pagure.io/centos-infra/new_issue?template=ci-migration) is validated you'll be granted access (through ACO/FAS account) to a namespace on that cluster. + +### Authentication + +The openshift cluster is linked/tied to accounts.centos.org so it will be using SSO to let you login (no need for additional credentials) + +### Interacting with Openshift + +One can use the [web console](https://console-openshift-console.apps.ocp.ci.centos.org/) to interact with deployed pods, see openshift logs, and also eventually interact with terminal on running pods. + +But it's also possible to [download](https://console-openshift-console.apps.ocp.ci.centos.org/command-line-tools) the `oc` cli tool and so interact with openshift from cli. Don't forget that for that to work, you need first to login through web console and then you'll have a `copy login command` under your user name (top left corner) , that will basically take you to [oauth token](https://oauth-openshift.apps.ocp.ci.centos.org/oauth/token/display) display. +You can just copy that command in your own terminal (be sure to have up2date oc binary !) and start interacting with openshift + + +### Jenkins +We provide a Jenkins template that can be provisioned for you automatically. It's using the jenkins image from openshift catalog but we modified it with some extra parameters : Deployed jenkins will be able to launch ephemeral pods as jenkins executor (nothing should run on the jenkins pod itself) + +For that you need to configure your job to use the `cico-workspace` label, as that will be automatically trigger a pod deployment in openshift from a template (cico-worspace) +That environment pod is using a centos 8-stream based container, that will automatically connect to jenkins as "agent" and also contains the following tools : + + * git + * ansible(-core) + * python-cicoclient (for legacy Duffy, see below) + * duffy[client] pip package (to interact with newer Duffy, see below) + +That pod will mount the ssh private key used for your project under /duffy-ssh-key/ssh-privatekey (see [ssh_config](https://github.com/centosci/images/blob/master/cico-workspace/ssh_config#L2)) and also have the `CICO_API_KEY` env variable set up to request duffy v2 nodes (through cico client) + +From that point, it's up to you to : + + * write a function/script that will request a Duffy node (see below) + * ssh into the machine[s] to run some tests (usually pulled from git repository somewhere) + * return ephemeral nodes to duffy + +!!! note + As a test job, to "play" with the concept, you can just configure a simple "Freestyle project" that would just run "/bin/bash" (so that jenkins job continue to run in background) , and from Openshift console, you can take the pod terminal to explore it and try things. ## Duffy (ephemeral bare-metal/Virtual Machines provider) +!!! warning + The following notes are only applicable for new Duffy v3 API that will be available around August 2022. Previous `cico client` will continue to work on actual Duffy v2 instance for the time being + Duffy is the middle layer running ci.centos.org that manages the provisioning, maintenance and teardown / rebuild of the Nodes (physical hardware and VMs) that are used to run the tests in the CI Cluster. We provide both bare-metal and VMs and support the following architectures : @@ -28,9 +67,6 @@ To be able to request ephemeral nodes to run your tests, you'll need both your ` !!! note It's worth knowing that there are quotas in place to ensure that you can't request infinite number of nodes in parallel and each `session` has a maximum lifetime of 6h. After that your nodes are automatically reclaimed by Duffy and are freshly reinstalled and put back in the Ready pool. -!!! warning - The following notes are only applicable for new Duffy v3 API that will be available around August 2022. Previous `cico client` will continue to work on actual Duffy v2 instance for the time being - ### Installing and configuring duffy client Use `pip` (or `pip3.8` on el8) to install duffy client.