Skip to content

Commit 8da32eb

Browse files
Merge pull request #132 from Manimaran-MM/jjb-29012026
include jjb config for existing pipelines
2 parents b16fe01 + 398a8c3 commit 8da32eb

File tree

12 files changed

+352
-114
lines changed

12 files changed

+352
-114
lines changed

docs/dev_onborading.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,21 @@
44

55
- **Goal**: Run and develop CI tests for **NFS-Ganesha** using the `sanity_dev` Jenkins job.
66
- **Key pieces**:
7-
- `jobs/distributed_test_runner/sanity_dev.groovy` – defines the Jenkins job & parameters.
7+
- `jobs/jjb/dev_sanity.yaml` – defines the Jenkins job & parameters.
88
- `jobs/Jenkinsfile.sanity_dev` – actual pipeline (checkout, install, run tests).
99
- `tests/dev_space/` – dev-focused pytest suites (e.g. `test_fsal.py`).
1010
- `ci_utils/` – shared Python helpers.
1111
- `ci_utils/dev_space/` – dev-only helpers (dependencies, node reservation, etc.).
12-
- **Sanity dev pipeline**: [`sanity_dev` Jenkins job](https://jenkins-nfs-ganesha.apps.ocp.cloud.ci.centos.org/view/all/job/sanity_dev/)
12+
- **Sanity dev pipeline**: [`dev-sanity-tests` Jenkins job](https://jenkins-nfs-ganesha.apps.ocp.cloud.ci.centos.org/view/all/job/dev-sanity-tests/)
1313

1414
---
1515

1616
## How the Jenkins Job Works
1717

18-
- **Job definition (`sanity_dev.groovy`)**
18+
- **Job definition (`dev_sanity.yaml`)**
1919
- **Defines parameters**:
2020
- **`TEST_SUITE`**: which test file to run (e.g. `test_fsal``test_fsal.py`).
2121
- **`SERVER_NODE_COUNT`**, **`CLIENT_NODE_COUNT`**: how many nodes to reserve.
22-
- **`CI_REPO`/`CI_BRANCH`**: repo/branch for this CI framework (default is this repo).
2322
- **`GIT_REPO`/`GIT_BRANCH`**: NFS-Ganesha source to test.
2423
- **`CMAKE_FLAGS`**, **`CMAKE_OVERRIDE`**: extra/override CMake options.
2524
- **`CENTOS_VERSION`**, **`CENTOS_ARCH`**: OS/arch to use.
@@ -72,7 +71,7 @@ Use this pattern (fixtures + managers from `ci_utils`) for any new dev tests.
7271
## Typical Dev Workflow
7372

7473
- **To run via Jenkins**:
75-
- Open **`sanity_dev`** job.
74+
- Open **`dev-sanity-tests`** job.
7675
- Set:
7776
- **`TEST_SUITE`**: e.g. `test_fsal`.
7877
- **Node counts**: `SERVER_NODE_COUNT`, `CLIENT_NODE_COUNT`.
@@ -93,7 +92,7 @@ Use this pattern (fixtures + managers from `ci_utils`) for any new dev tests.
9392
- Reserve nodes, connect via SSH, setup backends, run tests.
9493

9594
- **2. Wire it up in Jenkins**
96-
- In `jobs/distributed_test_runner/sanity_dev.groovy`:
95+
- In `jobs/jjb/dev_sanity.yaml`:
9796
- Add your test suite name to `TEST_SUITE` choices (e.g. `'test_newbackend'`).
9897
- In `jobs/Jenkinsfile.sanity_dev`:
9998
- Make sure `pytest` call matches the pattern:

docs/github_actions_workflow.md

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
# GitHub Actions Workflow - Quick Guide
2+
3+
## Overview
4+
5+
This repository uses GitHub Actions to automatically validate and deploy Jenkins Job Builder (JJB) configurations.
6+
7+
**Two Workflows:**
8+
1. **Validation** (`test.yaml`) - Runs on Pull Requests
9+
2. **Deployment** (`deploy.yaml`) - Runs on merge to `centos-ci` branch
10+
11+
---
12+
13+
## Workflow Architecture
14+
15+
![Workflow Diagram](../docs/images/github_actions_flow.png)
16+
17+
**Simple Flow:**
18+
```
19+
Developer → Pull Request → test.yaml (Validate) → Merge → deploy.yaml (Deploy) → Jenkins Updated
20+
```
21+
22+
---
23+
24+
## 1. Validation Workflow (`test.yaml`)
25+
26+
**Trigger:** Pull Request to any branch
27+
28+
**What it does:**
29+
- Builds Docker container with JJB
30+
- Validates YAML syntax
31+
- Checks macro references
32+
- **Does NOT** connect to Jenkins
33+
34+
**File:** `.github/workflows/test.yaml`
35+
36+
```yaml
37+
on:
38+
pull_request:
39+
branches: ['*']
40+
steps:
41+
- Checkout code
42+
- Build Docker image
43+
- Run: jenkins-jobs test (validation only)
44+
```
45+
46+
---
47+
48+
## 2. Deployment Workflow (`deploy.yaml`)
49+
50+
**Trigger:** Push to `centos-ci` branch
51+
52+
**What it does:**
53+
- Builds Docker container with JJB
54+
- Injects Jenkins API key
55+
- Connects to Jenkins
56+
- Creates/updates jobs
57+
58+
**File:** `.github/workflows/deploy.yaml`
59+
60+
```yaml
61+
on:
62+
push:
63+
branches: ['centos-ci']
64+
steps:
65+
- Checkout code
66+
- Build Docker image
67+
- Run: jenkins-jobs update (actual deployment)
68+
```
69+
70+
---
71+
72+
## Supporting Files
73+
74+
### `tests/Containerfile`
75+
Docker image with JJB installed
76+
77+
### `tests/verify-yaml.sh`
78+
```bash
79+
jenkins-jobs test globals/macros:jobs
80+
```
81+
Validates syntax without Jenkins connection
82+
83+
### `tests/deploy-nfs-ganesha-ci.sh`
84+
```bash
85+
sed "s/JENKINS_API_KEY/$JENKINS_API_KEY/g" tests/jenkins.conf > jobs/jenkins.ini
86+
jenkins-jobs --conf jobs/jenkins.ini update jobs/:globals/macros/
87+
```
88+
Injects API key and deploys to Jenkins
89+
90+
### `tests/jenkins.conf`
91+
JJB configuration template with API key placeholder
92+
93+
### `globals/macros/macros.yml`
94+
Reusable JJB templates (SCM, parameters, triggers, etc.)
95+
96+
### `jobs/jjb/*.yaml`
97+
Jenkins job definitions using JJB format
98+
99+
---
100+
101+
## How Files Work Together
102+
103+
```
104+
Pull Request
105+
106+
test.yaml → Containerfile → verify-yaml.sh → JJB (test mode)
107+
108+
Validation Result → PR Status Check
109+
110+
Merge to centos-ci
111+
112+
deploy.yaml → Containerfile → deploy-nfs-ganesha-ci.sh
113+
114+
jenkins.conf + API Key → JJB (update mode)
115+
116+
macros.yml + jobs/jjb/*.yaml → Jenkins API
117+
118+
Jobs Created/Updated in Jenkins
119+
```
120+
121+
---
122+
123+
## Testing Locally
124+
125+
```bash
126+
# 1. Build container
127+
docker build -t nfs-ganesha-ci-tests -f tests/Containerfile .
128+
129+
# 2. Test validation (like test.yaml)
130+
docker run --rm nfs-ganesha-ci-tests:latest
131+
132+
# 3. Generate XML preview
133+
docker run --rm -v $(pwd)/output:/output nfs-ganesha-ci-tests:latest sh -c \
134+
"jenkins-jobs test globals/macros:jobs/jjb -o /output --config-xml"
135+
136+
# 4. View generated XML
137+
cat output/*/config.xml
138+
139+
# 5. Deploy to Jenkins (requires API key)
140+
docker run --rm --env="JENKINS_API_KEY=your-token" \
141+
--entrypoint=tests/deploy-nfs-ganesha-ci.sh \
142+
nfs-ganesha-ci-tests:latest
143+
```
144+
145+
---
146+
147+
## Quick Reference
148+
149+
**Jenkins Server:** https://jenkins-nfs-ganesha.apps.ocp.cloud.ci.centos.org
150+
151+
**Test locally:** `docker run --rm nfs-ganesha-ci-tests:latest`
152+
153+
**Deploy:** Push to `centos-ci` branch
154+
155+
**Monitor:** https://github.com/nfs-ganesha/ci-tests/actions
476 KB
Loading

globals/macros/macros.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
skip-tag: true
99
shallow-clone: true
1010
url: https://github.com/nfs-ganesha/ci-tests.git
11-
basedir: "$WORKSPACE/ci-tests"
11+
basedir: "ci-tests"
1212

1313
- builder:
1414
name: get-node
@@ -56,7 +56,7 @@
5656
exclude-drafts: true
5757
exclude-no-code-change: true
5858
- comment-added-contains-event:
59-
comment-contains-value: 'recheck {option}'
59+
comment-contains-value: '(?i)recheck {option}'
6060
projects:
6161
- project-compare-type: PLAIN
6262
project-pattern: 'ffilz/nfs-ganesha'
@@ -103,6 +103,10 @@
103103
default: refs/heads/next
104104
description: Git reference to fetch from the Gerrit project.
105105
name: GERRIT_REFSPEC
106+
- string:
107+
name: GERRIT_USER
108+
default: jenkins-glusterorg
109+
description: Gerrit user to comment with
106110

107111
- parameter:
108112
name: centos_variables

jobs/Jenkinsfile.sanity_dev

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,6 @@ pipeline {
1313

1414
stages {
1515

16-
stage('Checkout CI Tests') {
17-
steps {
18-
echo "Cloning CI repo: ${params.CI_REPO} (${params.CI_BRANCH})"
19-
20-
dir('ci-tests') {
21-
git url: params.CI_REPO, branch: params.CI_BRANCH
22-
}
23-
}
24-
}
25-
2616
stage('Checkout NFS-Ganesha') {
2717
steps {
2818
echo "Cloning Ganesha repo: ${params.GIT_REPO} (${params.GIT_BRANCH})"

jobs/distributed_test_runner/sanity_dev.groovy

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)