Skip to content

tukue/githubactionrepo

Repository files navigation

03_04_ci_cd_for_container_images

This lesson demonstrates how to set up a CI/CD workflow for container images.

Specifically, this demo implements a delivery workflow that:

  • Reuses a workflow to run integration tests
  • Collects metadata
  • Builds the image
  • Publishes the image to GitHub Packages

Using the Exercise Files

  1. Create a new repo and upload the files for this lesson.

  2. Rename the file python-ci-workflow.yml so that its located in the .github/workflows directory.

     Completing this step is key to having the workflow run properly!
    
  3. In the repo select the Actions tab.

  4. Select and configure the workflow Publish Docker Container.

  5. Under jobs, add an ID named “integration” and the keyword uses followed by the path to python-ci-workflow.yml.

    NOTE that the path to the workflow starts with ./ and contains the full path the workflow file.

    Add a permissions block followed by contents: read and checks: write.

    The completed call to the reused workflow should be similar to the following:

     jobs:
         integration:
             uses: ./.github/workflows/python-ci-workflow.yml
             permissions:
             contents: read
             checks: write
    
  6. Under the job with the ID build, add needs, followed by the ID for the integration job. This will cause the build job to wait for the integration job to complete.

     build:
         needs: [integration]
    
  7. Select Start Commit and then select Commit New File.

  8. Select the Actions tab.

  9. Select the running workflow.

  10. Observe the integration/build job followed by the build job.

  11. Observe the updates to the Actions UI as the integration/build job completes.

  12. Once the workflow completes, select the Code tab.

  13. Refresh the page as needed until the package is listed under Packages.

  14. Select the package and review the details on the package page.

Fixing Warnings in the Annotations Section

At the time this course was published, the Publish Docker Container workflow contained actions based on Node 12.

Node 12 has been out of support since April 2022 and has been deprecated by Github Actions.

This causes warnings to be written to the Actions UI.

To remove these warnings, the version for actions used in this workflow need to be updated.

Update your workflow to use the following actions with the indicated versions. Also, check the provided Marketplace page to see if newer versions are available.

Action Marketplace Page Action Name and Version
Docker Setup Buildx docker/[email protected]
Docker Login docker/[email protected]
Docker Metadata action docker/[email protected]
Build and push Docker images docker/[email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published