A Jenkins job is a configured task that runs automation, such as a CI pipeline. In a containerized workflow, it can connect a Gogs repository to a Jenkinsfile, run pipeline stages, and show build status and logs. section 11.2
Create and use a Jenkins job through this practical workflow:
- Create or select the repository that contains the application and Jenkinsfile. section 11.2
- In Jenkins, click New Item and configure the job to use the appropriate Jenkinsfile path. section 11.6
- Push changes to Gogs, or manually start a build from the job page. section 11.2
- Inspect the build status, pipeline steps, and logs when a build fails; adjust the configuration and try again. section 11.6 section 11.2
Lab pipeline job
Create a job for the lab application by copying the existing diamol job configuration, changing the Jenkinsfile path from the exercises folder to the lab folder, and pushing the completed changes to Gogs. Expect an initial failure or two while checking logs and correcting the setup. section 11.6
# add registry domain to local hosts file on Mac or Linux: sudo ./scripts/add-to-hosts.sh registry.local 127.0.0.1 # OR using PowerShell (run as admin) ./scripts/add-to-hosts.ps1 registry.local 127.0.0.1 # switch to infrastructure folder: cd ch11/exercises/infrastructure # start the app with Linux containers: docker compose -f docker-compose.yml -f docker-compose-linux.yml up -d # OR start with Windows Server containers: docker compose -f docker-compose.yml -f docker-compose-windows.yml up -d # check containers: docker container ls
Use the infrastructure commands to start the containerized build environment, choose Linux or Windows container settings, and verify that the containers are running before opening Jenkins. section 11.2
