Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Open Source CI/CD Components for GitHub Actions

Open Source CI/CD Components for GitHub Actions

A presentation in German about CI/CD with GitHub Actions including a live demo to deploy Docker image to Dockerhub and GitHub Container Registry.

Lothar Schulz

October 28, 2021
Tweet

More Decks by Lothar Schulz

Other Decks in Technology

Transcript

  1. TRACK: CI/CD CONTINUOUS EVERYTHING
    NOVEMBER 12, 2020
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD
    Components for
    GitHub Actions
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz

    View Slide

  2. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Lothar Schulz
    lotharschulz.info
    github.com/lotharschulz
    speakerdeck.com/lothar
    @lothar_schulz
    lnkd.in/in/lotharschulz
    Open Source CI/CD Components for GitHub Actions

    View Slide

  3. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    What are GitHub Actions?
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    With GitHub Actions, workflows and steps are just code in a repository,
    so you can create, share, reuse, and fork your software development practices.
    Open Source CI/CD Components for GitHub Actions

    View Slide

  4. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions

    View Slide

  5. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    github.com/sdras/awesome-actions#community-resources

    View Slide

  6. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Actions Internal Marketplace
    Open Source CI/CD Components for GitHub Actions
    Actions Internal Marketplace
    blog post
    Actions Marketplace repository

    View Slide

  7. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    How To
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions

    View Slide

  8. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Jobs
    Jobs can run at the same time in parallel
    or be dependent on the status of a
    previous job and run sequentially.
    build-and-dockerhub-push-if-linux:
    needs: [benchmark, test]
    Open Source CI/CD Components for GitHub Actions

    View Slide

  9. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Matrix
    strategy:
    fail-fast: false
    matrix:
    os: [macOS-10.14,
    ubuntu-18.04]
    goos: [linux, darwin]
    exclude:
    - os: macOS-10.14
    goos: linux
    - os: ubuntu-18.04
    goos: darwin
    runs-on: ${{ matrix.os }}
    Open Source CI/CD Components for GitHub Actions

    View Slide

  10. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Fail fast or slow
    strategy:
    fail-fast: false
    matrix:
    os: [macOS-10.14,
    ubuntu-18.04]
    goos: [linux, darwin]
    exclude:
    - os: macOS-10.14
    goos: linux
    - os: ubuntu-18.04
    goos: darwin
    runs-on: ${{ matrix.os }}
    Open Source CI/CD Components for GitHub Actions

    View Slide

  11. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Excludes
    strategy:
    fail-fast: false
    matrix:
    os: [macOS-10.14,
    ubuntu-18.04]
    goos: [linux, darwin]
    exclude:
    - os: macOS-10.14
    goos: linux
    - os: ubuntu-18.04
    goos: darwin
    runs-on: ${{ matrix.os }}
    exclude:
    - os: macOS-10.14
    goos: linux
    - os: ubuntu-18.04
    goos: darwin
    Open Source CI/CD Components for GitHub Actions

    View Slide

  12. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Includes
    strategy:
    fail-fast: false
    matrix:
    os: [macOS-10.14,
    ubuntu-18.04]
    goos: [linux, darwin]
    exclude:
    - os: macOS-10.14
    goos: linux
    - os: ubuntu-18.04
    goos: darwin
    runs-on: ${{ matrix.os }}
    exclude:
    - os: macOS-10.14
    goos: linux
    - os: ubuntu-18.04
    goos: darwin
    include:
    - os: macOS-10.14
    goos: darwin
    - os: ubuntu-18.04
    goos: linux
    !
    Open Source CI/CD Components for GitHub Actions

    View Slide

  13. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Build only what you need
    task testMatrix {
    project.afterEvaluate {
    def checkTasks = subprojects.collect {
    it.tasks.findByName("check")
    }.findAll { it != null }
    dependsOn(checkTasks)
    doLast {
    def checkTaskPaths = checkTasks
    .collect { it.path }
    println(JsonOutput.toJson(checkTaskPaths))
    }
    }
    }
    faster parallel github builds
    https://github.com/testcontainers/testcontainers-java/blob/master/gradle/ci-support.gradle#L4-L18
    Open Source CI/CD Components for GitHub Actions

    View Slide

  14. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Build only what you need
    TASKS=$(./gradlew --no-daemon --parallel -q testMatrix)
    echo $TASKS
    echo "::set-output name=matrix::{\"gradle_args\":$TASKS}"
    faster parallel github builds
    https://github.com/testcontainers/testcontainers-java/blob/master/gradle/ci-support.gradle#L4-L18
    Open Source CI/CD Components for GitHub Actions

    View Slide

  15. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Security
    ...
    run: echo ${{ github.event.issue.title }}
    ...
    env:
    TITLE: ${{ github.event.issue.title }}
    run: echo "$TITLE"
    ... https://securitylab.github.com/research/github-actions-untrusted-input/
    https://blog.ryotak.me/post/github-actions-supplychain/
    Open Source CI/CD Components for GitHub Actions

    View Slide

  16. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Code
    Open Source CI/CD Components for GitHub Actions

    View Slide

  17. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions

    View Slide

  18. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Self Hosted & Awesome Runners
    https://github.com/jonico/awesome-runners
    lotharschulz.info/2019/12/09/github-action-self-hosted-runners-on-aws-incl-spot-instances
    Open Source CI/CD Components for GitHub Actions

    View Slide

  19. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Issue Ops
    https://github.com/jonico/auto-scaling-github-runners-ec2-issueops
    https://github.com/jonico/auto-scaling-github-runners-kubernetes-issueops
    Open Source CI/CD Components for GitHub Actions

    View Slide

  20. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    There is more
    Open Source CI/CD Components for GitHub Actions
    Core concepts
    Encrypted secrets
    Reusing workflows & composite actions

    View Slide

  21. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    There is more
    Contexts available on run time
    Triggered by own events
    Package manager and gh docker registry integrated
    Open Source CI/CD Components for GitHub Actions

    View Slide

  22. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    There is more
    Open Source CI/CD Components for GitHub Actions
    Run github actions locally
    Organization Workflows
    first-issue-greeter & github-workflow-sync

    View Slide

  23. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Alternatives
    Open Source CI/CD Components for GitHub Actions
    Migrating from GitLab CI/CD to
    GitHub Actions
    GitLab CI/CD GitHub Actions
    Migration from GitHub Actions
    to GitLab CI/CD

    View Slide

  24. TRACK: CI/CD CONTINUOUS EVERYTHING
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    Open Source CI/CD Components for GitHub Actions
    ADDO 2021 10 28
    @lothar_schulz
    I am sure you have
    questions.
    Open Source CI/CD Components for GitHub Actions
    image: © https://pixabay.com/photos/girl-child-astonished-surprised-388652

    View Slide