Slide 1

Slide 1 text

Dockerhub & GitHub Container Registry Deployments mit GitHub Actions

Slide 2

Slide 2 text

Me Engineering Manager lotharschulz.info github.com/lotharschulz @lothar_schulz lnkd.in/lotharschulz

Slide 3

Slide 3 text

Einfacher Zugang zur täglichen Mobilität Mobimeo entwickelt die Plattform, die öffentliche Nahverkehrs- und Sharing-Angebote vernetzt - modular, flexibel zu integrieren und einfach zu nutzen. Dabei berücksichtigen wir die jeweilige Situation und Präferenz des Einzelnen. Unterwegs sein wird individueller, intuitiver und entspannter. Für mehr Mobilität bei weniger Verkehr. Mobimeo – Wir ändern wie sich Menschen in Städten bewegen

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

https://github.blog/2019-08-08-github-actions-now-supports-ci-cd/ What are GitHub Actions? Mit GitHub Actions sind Workflows und Schritte Code in einem Git Repository, sodass alle Vorteile von verteiltem Code genutzt werden können.

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

github.com/sdras/awesome-actions#community-resources

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

github.com/simonw/simonw/

Slide 12

Slide 12 text

Open Source Projects using GitHub actions (incomplete list)

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Matrix - Builds auf Linux, macOS, Windows 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 }} @lothar_schulz

Slide 15

Slide 15 text

Matrix - 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 @lothar_schulz

Slide 16

Slide 16 text

Matrix - 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 include: - os: macOS-10.14 goos: darwin - os: ubuntu-18.04 goos: linux ! @lothar_schulz

Slide 17

Slide 17 text

Matrix

Slide 18

Slide 18 text

Matrix

Slide 19

Slide 19 text

Matrix

Slide 20

Slide 20 text

Matrix - Baue nur was Du brauchst (gradle) 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 @lothar_schulz

Slide 21

Slide 21 text

Matrix - Baue nur was Du brauchst (gradle) 2 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 @lothar_schulz

Slide 22

Slide 22 text

Jobs Jobs können gleichzeitig und parallel laufen oder vom Status eines vorherigen Jobs abhängig sein und sequentiell laufen. build-and-dockerhub-push-if-linux: needs: [benchmark, test] @lothar_schulz

Slide 23

Slide 23 text

Conditionals if: matrix.os == 'ubuntu-18.04' env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} run: | d=$(date +%Y-%m-%d) tag=$d-${{ matrix.os }}-${{ github.sha }} docker build -t lotharschulz/hello-github-actions:$tag . docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} docker push lotharschulz/hello-github-actions:$tag @lothar_schulz

Slide 24

Slide 24 text

Überraschungen test: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - uses: actions/setup-java@v1 with: java-version: 11 - uses: eskatos/gradle-command-action@v1 with: arguments: test - name: test the code @lothar_schulz

Slide 25

Slide 25 text

test: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - uses: actions/setup-java@v1 with: java-version: 11 - uses: eskatos/gradle-command-action@v1 with: arguments: test # - name: test the code Überraschungen @lothar_schulz

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Demo Code

Slide 28

Slide 28 text

Mehr Informationen

Slide 29

Slide 29 text

Noch mehr Informationen

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content