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

CI pipelines should be code! Dagger Go SDK

CI pipelines should be code! Dagger Go SDK

Pipelines as Code, using Dagger GO SDK for manage own pipelines with buildkit.

Ladislav Prskavec

November 30, 2022
Tweet

More Decks by Ladislav Prskavec

Other Decks in Technology

Transcript

  1. C p pe in s ho ld e od !

    D gg r o DK L v P c (@a ) - M P #9, 3 .1 . 2 1
  2. W at s ag er? 4 D a p m

    C /C e a n y p e c e . 4 Y a e i P e C L v P c (@a ) - M P #9, 3 .1 . 2 2
  3. W at s ag er? 4 S d C c

    e (D ) + u l 4 s D (C , G , P , N .J ) L v P c (@a ) - M P #9, 3 .1 . 2 3
  4. D gg r s. C (G tH b ct on

    , G tL b, C rc eC , J nk ns, e c.) 4 D e o r u C : i s a a p e d m l o i . 4 D n l m p s. i r l -i : y a c w r n l u p e . 4 D s n u e m . i a d /C p : h m p e a e n d m . L v P c (@a ) - M P #9, 3 .1 . 2 4
  5. H w oe i w rk? L v P c

    (@a ) - M P #9, 3 .1 . 2 5
  6. B ne t 4 I l t 4 P l

    (l , C ) 4 S r c 4 C b t h D e e 4 C -l e i e n L v P c (@a ) - M P #9, 3 .1 . 2 6
  7. W y ho ld se od i st ad AM

    ? 4 Y t s z l e 4 N l e o c g n 4 I e d 4 G r H 's N 4 M T j Y : p y o g a a L v P c (@a ) - M P #9, 3 .1 . 2 7
  8. W y ue an a d ot AM 4 C

    g n l e 4 S d e f s 4 S i l 4 T i 4 S p c g 4 P S L v P c (@a ) - M P #9, 3 .1 . 2 8
  9. D gg r o DK 4 C v 0.4 -

    o 2 4 G s L v P c (@a ) - M P #9, 3 .1 . 2 9
  10. P ac ic l xa pl 4 G S p

    4 N b /t a s v s (1.1 , 1.1 , 1.1 ) n l i a c (a , a ) n O (w , d , l ) L v P c (@a ) - M P #9, 3 .1 . 2 1
  11. G th b ct on xa pl name: Go on:

    [push] jobs: build: runs-on: ubuntu-latest strategy: matrix: go-version: ['1.19', '1.18', '1.17'] steps: - uses: actions/checkout@v3 - name: Setup Go ${{ matrix.go-version }} uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} # You can test your matrix by printing the current Go version - name: Display Go version run: go version L v P c (@a ) - M P #9, 3 .1 . 2 1
  12. S mp e ui d func build(repoUrl string) error {

    ... client, err := dagger.Connect(ctx, dagger.WithLogOutput(os.Stdout)) ... repo := client.Git(repoUrl) src, err := repo.Branch("main").Tree().ID(ctx) workdir := client.Host().Workdir() for _, version := range goVersions { for _, goos := range oses { for _, goarch := range arches { goos, goarch, version := goos, goarch, version g.Go(func() error { ... build := golang.WithEnvVariable("GOOS", goos) build = build.WithEnvVariable("GOARCH", goarch) build = build.Exec(dagger.ContainerExecOpts{ Args: []string{"go", "build", "-o", path}, }) output, err := build.Directory(path).ID(ctx) ... }) } } } ... L v P c (@a ) - M P #9, 3 .1 . 2 1
  13. M no ep s 4 E h -m o t

    M 4 E i n e g p - h ://g .c /a /g -b /p /4 L v P c (@a ) - M P #9, 3 .1 . 2 1
  14. R fe en es 4 D .i 4 D D

    a p 4 G S v 4 I i D o i v 4 D u S 4 D P S 4 D N .J S 4 C l L v P c (@a ) - M P #9, 3 .1 . 2 1
  15. Q&A I ec mm nd ol ow ag er lo

    f r ew o j in he r is or c mm ni y. 4 L D L v P c (@a ) - M P #9, 3 .1 . 2 1