Jenkins Kata 6: Deploying Containers (Step 4–6)
Explore how to define deployment jobs in Jenkins for Dev, QA, and Production environments. Understand implementing manual approval steps within the deployment pipeline and adding pipeline views for visualizing CI/CD workflow connections. Gain practical skills in managing controlled and automated container deployments.
Step 4: Define a QA environment deployment job
The following are the steps to define a QA environment deployment job:
- Return to the Jenkins tab.
- Click the “Jenkins” icon at the top left.
- Click “New Item.”
- Enter “qa-deploy-storelist” in the item name field.
- Select “Freestyle project.”
- Click “OK.”
- Click the “Build Steps” tab.
- Select “Add build step.”
- Select “Execute shell.”
- Enter the following commands:
- Click “Save”
Commands
Command / Parameter | Description |
| This is the Docker parent command for containers. |
| This removes a container. |
| This forces the removal of a container even if it's running. If the container is running, it's killed and then removed. |
| This is the name of the container to remove. |
| The double-pipe character is a “logicial OR.” If the `qa-storelist` container is not running, the Docker `rm` command will fail. This is expected; however, it would cause the command to return a failure code, causing the job to fail. The OR statement returns true from the command even if the docker `rm` command fails. This ensures that this command will return a success code, whether the `qa-storelist` container was running or not. |
| This is the Docker parent command for containers. |
| This runs a new container. |
| This runs a disconnected container. |
| This maps ports from the host to the container. |
| This maps port 8002 on the host to port 80 in the container. |
| This assigns a user-defined Docker bridge network to the container. |
| This assigns a static IP to the container within the subnet range defined on the user-defined network. |
| This assigns a name to the container. |
| This is the name assigned to the container. |
| This is the URL to the private repository and the name of the image to run. |
- Click “Build Now.”
- Click back to “Dashboard.”
- Select the “dev-deploy-storelist” job.
- Click “Configure.”
- Click the “Post-build Actions” tab.
- Select “Add post-build action.”
- Select “Build other projects (manual step).”
- Enter “qa-deploy-storelist” in the “Downstream Project Names” field.
- Click