A part of developing your GitOps skillset, this lab introduces the student to GitHub Actions Workflow and challenges the student to build and push a container to Docker Hub. The application container may then be deployed to Kubernetes Clusters through Flux and the Deployment YAML required.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Fork the linuxacademycontent/gitops Repo in GitHub
Use your personal account to fork the course repo into your own GitHub Account.
- Create a Docker Hub Folder to Receive the Pushed Container Images
Set up a folder for the container images in Docker Hub.
- Enable Actions WorkFlows In The Forked Repository
Go the to Actions tab and enable workflows.
NOTE: You will also need to add a secret to the repo for the Docker Hub Password. Use Settings and Secrets to add the password so the docker login in the workflow will push the image to your dockerhub registry.
- Edit the Workflow to Push Your Container Images to Your Docker Hub Registry
Edit the workflow provided with your Docker Hub information.
1) You must add a DOCKERPW secret to your repo with the docker hub password for your dockerhub account.
This is done in GitHub under Settings->Secrets2) You will need to edit the actions workflow to replace the [your docerhub userneme] clause with your actual dockerhub username.
This configure the actions workflow to push the container image to your docker hub registery.
You can test this on a push, command by just changing the python program a bit and watching the actions workflow run.
Once you have the workflow running, you can then edit the workflow to run for a pull request instead of a push.
Change the event that fires the workflow from push to pull_request.
- Change The Python Application And Open A Pull Request
Create a feature branch. Change the Python application, then commit the change. Then create a pull request and merge the change in. Examine the workflow actions run afterward and verify the container was pushed to the Docker Hub Registry.