Modern Continuous Integration and Continuous Deployment (CI/CD) pipelines automate software delivery from source control to production web servers. By leveraging Jenkins Pipelines as code, infrastructure teams can define build, test, and deployment workflows within declarative Groovy scripts.
In this challenge, we configure a Jenkins Declarative Pipeline job named datacenter-webapp-job to automate the deployment of a static web application hosted in a Gitea Git repository onto an Apache HTTP web server running on App Server 1 (stapp01).
Key tasks accomplished:
App Server 1) with label stapp01 and remote root directory /home/sarah/jenkins_agent.datacenter-webapp-job.stapp01 and defines a single stage named Deploy to pull updates directly into the web root directory (/var/www/html).graph TD
subgraph SCM ["Gitea Version Control"]
GitRepo["Git Repository<br/>sarah/web_app master branch"]
end
subgraph JenkinsController ["Jenkins Controller"]
Job["Pipeline Job:<br/>datacenter-webapp-job"]
Script["Declarative Jenkinsfile<br/>agent { label 'stapp01' }"]
end
subgraph AppServer ["App Server 1: stapp01"]
Agent["Jenkins Agent Process<br/>Root: /home/sarah/jenkins_agent"]
WebRoot["Apache Web Root<br/>/var/www/html"]
Apache["Apache Web Server<br/>Port 8091"]
end
GitRepo -->|"1. Source Code Push"| Job
Job -->|"2. Parse Pipeline"| Script
Script -->|"3. Schedule Job on stapp01"| Agent
Agent -->|"4. Execute Shell: git pull"| WebRoot
WebRoot -->|"5. Serve Updated Web Content"| Apache
Unlike classic Freestyle jobs, Jenkins Pipelines use a domain-specific language (DSL) written in Groovy to define execution steps:
pipeline { ... }: The root block enclosing the pipeline definition.agent { label 'stapp01' }: Directs the Jenkins controller to schedule and execute stages exclusively on agent nodes tagged with the stapp01 label.stages { stage('Deploy') { ... } }: Defines explicit build phases. The Deploy stage executes shell commands directly within the agent environment.The deployment mechanism navigates to /var/www/html on stapp01 and executes git pull origin master:
sarah/web_app repository branch.8080admin / Adm!n321App Server 1 (stapp01)http://gitea:3000/sarah/web_appPipeline, SSH Build Agents| Setting | Value |
|---|---|
| Node Name | App Server 1 |
| Node Label | stapp01 |
| Remote Root Directory | /home/sarah/jenkins_agent |
| Launch Method | Launch agents via SSH |
| Host | stapp01 |
| SSH Credentials | sarah |
| Pipeline Job Name | datacenter-webapp-job |
| Pipeline Stage Name | Deploy |
| Web Server Document Root | /var/www/html |
adminAdm!n321
Navigate to Manage Jenkins -> Plugins -> Available plugins and verify that both Pipeline and SSH Build Agents plugins are installed and available.

App Server 1 SSH Build Agent NodeApp Server 1 configuration:
/home/sarah/jenkins_agentstapp01Launch agents via SSHstapp01sarahNon verifying Verification Strategy
Confirm on the Nodes overview page that App Server 1 is online and connected with label stapp01.

datacenter-webapp-job
In the job configuration page under the Pipeline section, set Definition to Pipeline script and input the following Groovy code:
pipeline {
agent { label 'stapp01' }
stages {
stage('Deploy') {
steps {
sh '''
cd /var/www/html
git pull origin master
'''
}
}
}
}
Click Save.

If the agent node is not tagged with stapp01 or is offline, Jenkins will queue the build with the message:
Still waiting to schedule task: There are no nodes with the label 'stapp01'

Once App Server 1 is properly online with label stapp01, click Build Now.
Open Console Output for Build #3 to verify successful execution:
App Server 1 inside workspace /home/sarah/jenkins_agent/workspace/datacenter-webapp-job.cd /var/www/html && git pull origin master.http://gitea:3000/sarah/web_app.Finished: SUCCESS.
Navigate to the web server URL (port 8091). Verify the initial output served from /var/www/html/index.html:
Welcome to xFusionCorp Industries!

Access the Gitea repository at http://gitea:3000/sarah/web_app and open index.html.

index.html to append additional text:
Welcome to xFusionCorp Industries!
This verify the deployment job is running successfully.
master branch.
datacenter-webapp-job in Jenkins.Refresh the web application URL on port 8091. Confirm the live web page reflects the latest commit:
Welcome to xFusionCorp Industries! This verify the deployment job is running successfully.

pipeline {
agent {
label 'stapp01'
}
stages {
stage('Deploy') {
steps {
sh '''
cd /var/www/html
git pull origin master
'''
}
}
}
}
App Server 1 configured with label stapp01 and remote root /home/sarah/jenkins_agent.datacenter-webapp-job created in Jenkins.agent { label 'stapp01' } and stage 'Deploy'.git pull origin master inside /var/www/html.SUCCESS.stapp01 correctly serves updated contents from /var/www/html/index.html.