User Tools

Site Tools


services:downstream_ci

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
services:downstream_ci [2026/10/14 13:22] – [Overview] akraitmanservices:downstream_ci [2026/11/23 16:14] (current) – akraitman
Line 1: Line 1:
-====== Downstream CI ======+====== Downstream CI (RDU3)======
  
 ===== Overview ===== ===== Overview =====
Line 57: Line 57:
  
 Once the migration to the RDU3 Jenkins instance is complete, the temporary migration branch can be retired and the normal production configuration workflow can be used. Once the migration to the RDU3 Jenkins instance is complete, the temporary migration branch can be retired and the normal production configuration workflow can be used.
 +
 +
 +===== Job Definitions =====
 +
 +Jobs are Jenkins Job Builder YAML in:
 +
 +<code>
 +https://gitlab.cee.redhat.com/ceph/rhcs-jenkins-jobs
 +</code>
 +
 +  * Definition: ''<job>/config/definitions/<job>.yaml''
 +  * Build script: ''<job>/build/build''
 +
 +To change a job:
 +
 +  - Branch from ''master'', edit, open an MR.
 +  - Merge. The ''jenkins-job-builder'' job runs on every push to ''master'' and updates all jobs.
 +
 +To test a branch before merging:
 +
 +  - Run ''jenkins-job-builder'' with ''GITLAB_BRANCH=<branch>'' and ''JOB_NAME=<job>''.
 +  - Only that job is updated. It stays on the branch version until the next ''master'' run.
 +
 +Do not edit jobs in the Jenkins UI. The next ''master'' run overwrites them.
 +
 +
 +===== Jenkins Access =====
 +
 +Login is Red Hat SSO. Permissions are roles in ''casc.yaml'' in the [[https://gitlab.cee.redhat.com/ccit/jenkins-csb-customers/storage-casc-ceph-downstream/-/blob/main/casc.yaml#L675|configuration repository]], under ''jenkins.authorizationStrategy''.
 +
 +Roles: ''admin'', ''admin_read'', ''ceph-dev-qe-config'', ''schedule_build'', ''readonly''.
 +
 +To give someone access:
 +
 +  - Add ''%%- user: "<kerberos id>"%%'' under the role's ''entries''. Use ''%%- group: "<name>"%%'' for an SSO group.
 +  - Open an MR to ''main''. Merge.
 +  - Restart the Jenkins pod to load it (repository README).
 +
 +Notes:
 +
 +  * "<user> is missing the Overall/Read permission" means the user is in no role.
 +  * Roles assigned in the Jenkins UI are lost at the next restart.
  
  
Line 62: Line 104:
  
 The Jenkins build agents are RHEL 9 virtual machines running through OpenShift Virtualization. The Jenkins build agents are RHEL 9 virtual machines running through OpenShift Virtualization.
 +
 +Builders/OCP VM's subnet is 10.5.225.0/24
  
 Example agent types include: Example agent types include:
Line 372: Line 416:
  
  
-===== Migration =====+===== Accessing Running Jenkins Builders (RDU3) =====
  
-The RDU3 Jenkins environment is intended to become the new home for the downstream Jenkins controller and builder workloads.+Jenkins builders run as KubeVirt Virtual Machines (VMs) in the RDU3 OpenShift cluster. Developers can access running builders via SSH using ''virtctl port-forward''.
  
-During the migration period, the RDU3-specific Jenkins configuration is maintained in the:+==== 1. List running builders ====
  
-<code> +Log in to the RDU3 OpenShift cluster and select the Jenkins tenant namespace. 
-rdu3-migration+ 
 +<code bash> 
 +oc project ceph-downstream-tenant--pipeline 
 +oc get vmi
 </code> </code>
  
-branch of:+Example output:
  
 <code> <code>
-git@gitlab.cee.redhat.com:ccit/jenkins-csb-customers/storage-casc-ceph-downstream.git+NAME                        AGE     PHASE     IP             NODENAME                                    READY 
 +rhel8medium-rdu3-c36e1a98   8h      Running   172.17.44.37   worker07.itup-003.prod.rdu3.dc.redhat.com   True 
 +rhel9large-rdu3-8f20a52c    5h38m   Running   172.19.12.11   worker26.itup-003.prod.rdu3.dc.redhat.com   True 
 +</code> 
 + 
 +Identify the running builder you want to access. 
 + 
 +==== 2. Forward the builder's SSH port ==== 
 + 
 +Open a terminal and run: 
 + 
 +<code bash> 
 +virtctl port-forward \ 
 +  vmi/rhel8medium-rdu3-c36e1a98 \ 
 +  2222:22 
 +</code> 
 + 
 +This forwards local TCP port ''2222'' to SSH port ''22'' on the selected VM. 
 + 
 +**Keep this terminal running** while connected to the builder. 
 + 
 +==== 3. Connect to the builder via SSH ==== 
 + 
 +Open a second terminal and run: 
 + 
 +<code bash> 
 +ssh -i jenkins-build.id \ 
 +  -o IdentitiesOnly=yes \ 
 +  -p 2222 \ 
 +  jenkins-build@127.0.0.1 
 +</code> 
 + 
 +Replace ''jenkins-build.id'' with the path to your authorized SSH private key. 
 + 
 +==== Notes ==== 
 + 
 +  * You must be logged in to the RDU3 OpenShift cluster and have the required namespace permissions. 
 +  * VM names are dynamic. Always use ''oc get vmi'' to find the current running builder. 
 +  * Production builders may be in ''ceph-downstream-tenant--pipeline''. Select the namespace containing your target VM. 
 +  * SSH access requires an authorized private key for the ''jenkins-build'' user. 
 +  * Do not modify or interrupt active Jenkins builds. 
 +  * Stop the port-forward process using ''Ctrl+C'' when finished. 
 + 
 + 
 +===== Debugging Failed Builds and Builders ===== 
 + 
 +==== A build fails ==== 
 + 
 +  - Open the build console. Read the first ''ERROR''. 
 +  - Bare ''java.lang.NullPointerException'' with no stack trace: open the first failed build after the last green one. It has the trace. 
 +  - List the recent builds. Note the time the failure started or changed. 
 +  - Match that time against commits in ''rhcs-jenkins-jobs'' and ''storage-casc-ceph-downstream''. 
 +  - Open ''<jenkins url>/job/<job>/config.xml'' and compare it with ''master''. The job may be running a test branch (see Job Definitions). 
 + 
 +Known signatures: 
 + 
 +  * ''NullPointerException'' in ''SecretBuildWrapper.buildEnvVars'': a credential binding in the job has no ''variable''. 
 +  * ''Permission denied (publickey)'' from GitHub: the credential is named in the ''[ssh-agent] Using credentials'' line. Check the key is still on the GitHub account at ''https://github.com/<account>.keys''. 
 + 
 +==== A build waits for a builder ==== 
 + 
 +  - Manage Jenkins -> Nodes. Open the log of any offline agent. 
 +  - List the builder VMs and their disks. 
 +  - Read the namespace events. 
 +  - DataVolume in ''ErrExceededQuota'': the storage quota is full. No new builder starts until a running one finishes. Check the quota. 
 +  - Read the controller log. It holds about 30 minutes. 
 + 
 +<code bash> 
 +oc -n ceph-downstream-tenant--pipeline get vm,vmi,dv,pvc 
 +oc -n ceph-downstream-tenant--pipeline get events --sort-by=.lastTimestamp | tail -40 
 +oc -n ceph-downstream-tenant--pipeline get appliedclusterresourcequota -o yaml 
 +oc -n ceph-downstream-tenant--pipeline logs deploy/ceph-downstream-jenkins | grep -iE 'kubevirt|Timed out waiting' 
 +</code> 
 + 
 +===== Managing Jenkins Secrets with git-crypt ===== 
 + 
 +Jenkins secrets are stored encrypted in the ''storage-casc-ceph-downstream'' repository using ''git-crypt''. Never commit a secret in plaintext. 
 + 
 +==== Updating an existing secret ==== 
 + 
 +Create a new branch from ''main'': 
 + 
 +<code bash> 
 +git switch main 
 +git pull --ff-only 
 +git switch -c update-jenkins-secret 
 +</code> 
 + 
 +Verify that git-crypt is unlocked and that the secret is configured for encryption: 
 + 
 +<code bash> 
 +git-crypt status 
 +git check-attr filter diff -- secrets/ceph-jenkins-api-token 
 +</code> 
 + 
 +Update the secret without putting its value in the shell history: 
 + 
 +<code bash> 
 +read -s SECRET_VALUE 
 +echo 
 +printf '%s' "$SECRET_VALUE" > secrets/ceph-jenkins-api-token 
 +unset SECRET_VALUE 
 +</code> 
 + 
 +Verify the file is still managed by git-crypt: 
 + 
 +<code bash> 
 +git check-attr filter diff -- secrets/ceph-jenkins-api-token 
 +git-crypt status 
 +</code> 
 + 
 +Stage and review the change: 
 + 
 +<code bash> 
 +git add secrets/ceph-jenkins-api-token 
 +git status 
 +git diff --cached --stat 
 +</code> 
 + 
 +Commit and push the feature branch: 
 + 
 +<code bash> 
 +git commit -m "Update Jenkins API token" 
 +git push -u origin update-jenkins-secret 
 +</code> 
 + 
 +Create an MR to ''main'' after verifying that no plaintext secret was committed. 
 + 
 +==== Adding a new secret ==== 
 + 
 +Create the new secret under ''secrets/'': 
 + 
 +<code bash> 
 +read -s SECRET_VALUE 
 +echo 
 +printf '%s' "$SECRET_VALUE" > secrets/&lt;secret-name&gt; 
 +unset SECRET_VALUE 
 +</code> 
 + 
 +Make sure the new file is covered by the git-crypt rules in ''secrets/.gitattributes''. 
 + 
 +Verify encryption before committing: 
 + 
 +<code bash> 
 +git check-attr filter diff -- secrets/&lt;secret-name&gt; 
 +git-crypt status 
 +</code> 
 + 
 +Then stage ''secrets/.gitattributes'' if it was changed, along with the new secret: 
 + 
 +<code bash> 
 +git add secrets/.gitattributes secrets/&lt;secret-name&gt; 
 +git status 
 +git diff --cached --stat
 </code> </code>
  
-This allows the RDU3 environment to be configured and validated without affecting the existing production Jenkins deployment.+Commit and push the feature branch, then create an MR to ''main''.
  
-Once the migration is complete and the RDU3 Jenkins instance becomes the primary production environment, the temporary migration configuration can be consolidated into the normal production configuration.+<note important> 
 +Never paste secret values into Git commit messages, merge requests, Slack, tickets, or command-line arguments. Always verify that git-crypt recognizes a new secret before pushing it. 
 +</note>
  
  
Line 400: Line 602:
   * Jenkins Sorter plugin   * Jenkins Sorter plugin
   * RDU3 TenantEgress / EgressFirewall   * RDU3 TenantEgress / EgressFirewall
 +  * Managing Jenkins Secrets git-crypt
services/downstream_ci.1791984177.txt.gz · Last modified: by akraitman