Certified Jenkins Engineer
Setting up CI Pipeline
Demo Create Organization Folder Project
In this step-by-step tutorial, you'll learn how to use Jenkins' Organization Folder project type with Gitea-hosted repositories. You'll:
- Migrate a GitHub repository to Gitea
- Install and configure the Gitea plugin in Jenkins
- Create and configure an Organization Folder
- Observe automatic multibranch pipeline creation and webhook-triggered builds
1. Migrate the Solar System Repository to Gitea
First, copy the clone URL of the Solar System repository from GitHub:
Sign in to your Gitea instance:
Go to your organization (e.g., dasher-org
) and click + → New Migration:
Paste the GitHub URL, set the owner to dasher-org
, and name the repo solar-system:
Once migration completes, verify the new repository by visiting its Gitea page:
2. Why Use an Organization Folder?
Manually creating a separate Pipeline job for each repository or branch can quickly become a maintenance headache. With the Organization Folder, Jenkins automatically scans your SCM, creates or removes jobs based on your configuration, and keeps everything in sync.
Aspect | Manual Pipelines | Organization Folder |
---|---|---|
Setup per repo | Manual each time | Single configuration |
Branch management | Manual updates | Automatic discovery |
Scalability | Limited by manual processes | Scales with your codebase |
Note
Organization Folders streamline multibranch pipeline management and support GitHub, Bitbucket, Gitea, and more.
For further details, see the Jenkins documentation:
3. Create an Organization Folder in Jenkins
- From the Jenkins dashboard, click New Item.
- Enter GitHub Organization (or any descriptive name).
- Select Organization Folder and click OK:
4. Install and Configure the Gitea Plugin
Install the Plugin
- Navigate to Manage Jenkins → Manage Plugins.
- In the Available tab, search for Gitea plugin.
- Select and install it, checking Restart Jenkins when installation is complete and no jobs are running:
Wait for the installation to finish:
After Jenkins restarts, verify the plugin is listed under Installed:
Configure Gitea Server
- Go to Manage Jenkins → Configure System.
- Scroll to Gitea Servers and click Add Gitea Server.
- Enter:
- Name: Gitea server
- API URL:
https://<your-gitea-url>/api/v1
- Check Manage hooks to enable automatic webhook creation.
- Next to Credentials, click Add, select Username with password, and enter your Gitea credentials (scope: Global):
- Click Apply and Save:
5. Configure the Organization Folder
- Open the GitHub Organization item and click Configure.
- Under Repository Sources, click Add Source → GitHub Organization.
- Select:
- GitHub Server: your configured server
- Credentials: the admin credential you added
- Owner:
dasher-org
- Leave discovery and project recognizer settings at default (looks for
Jenkinsfile
):
- Click Save. Jenkins begins scanning the organization immediately.
6. Organization Scan and Job Creation
During the scan, Jenkins inspects each repository and its branches for a Jenkinsfile
. Only those that match will have jobs created or updated.
Example scan output:
Checking repository parameterized-pipeline-job-init
Proposing parameterized-pipeline-job-init
Looking up repository dasher-org/parameterized-pipeline-job-init
Checking branches...
Checking branch main
'Jenkinsfile' found
Met criteria
1 branches were processed (query completed)
Checking repository solar-system
Proposing solar-system
Looking up repository dasher-org/solar-system
Checking branches...
Checking branch main
'Jenkinsfile' not found
Does not meet criteria
1 branches were processed
Checking pull requests...
0 pull requests were processed
3 repositories were processed
[Mon Sep 23 07:23:10 UTC 2024] Finished organization scan. Scan took 1.8 sec
Finished: SUCCESS
In this example:
parameterized-pipeline-job-init
→ multibranch pipeline createdsolar-system
→ skipped (noJenkinsfile
)
7. Inspecting Branch Pipelines
Click the parameterized-pipeline-job-init item to view branch-level pipelines:
Repository details such as files and commit history are pulled from Gitea:
8. Webhook Configuration and Automatic Triggers
By enabling Manage hooks, Jenkins automatically adds webhooks to each repository. These webhooks trigger builds on push, branch/tag creation, and pull request events.
For example, edit the README
in the main
branch:
git checkout main
# edit README.md
git add README.md
git commit -m "Edited README"
git push origin main
The webhook notifies Jenkins, triggering a new build:
Warning
Ensure your Gitea API token has permissions to create webhooks and read repositories.
Conclusion
After adding a Jenkinsfile
to the solar-system
repository, Jenkins picks it up in the next scan and automatically creates a pipeline:
Links and References
Watch Video
Watch video content