This is a simple example application written in Go and a mock test to go along with it. The application makes a request
to https://icanhazdadjoke.com
which returns a random dad joke and prints it to the terminal.
Packaging the application is done with Dagger, GoReleaser, and the pipeline executed in Github Actions on
these events; pull_request
, push [tags]
.
The Dagger Pipeline accepts one of two arguments which in turn execute the corresponding task. Below is the flow diagram of the Dagger Pipeline.
flowchart
1[Github Action Event] --> 2[Checkout]-->3[Install Go]-->4[Execute Dagger Pipeline]-->A
subgraph Dagger Pipeline
A[Input] -->|validate| B[Start Dagger Engine]-->C{Switch Command}
C --> D[Test]
C --> E[GoReleaser]
subgraph pull-request
D --> D1[Build]
D1 -->D2{is_local}-->D3[Export]
end
subgraph release
E
end
D1 --> K
D3 --> K
E --> K
K[Output]
end
- clone the repository, or fork your own copy
- create a new branch off
main
- make your changes
- commit and push your changes to the remote repository
- creating a pull request against
main
will trigger thepull-request
command - merge the pull request
- creating a new tag and pushing it to the remote repository will trigger the
release
command - review your release and publish it when ready
- clone the repository, or fork your own copy
- create a new branch off
main
- make your changes and commit them
- run
go run ./ci/dagger.go --local pull-request
to execute thepull-request
command locally - test the binaries in the
dist
directory
- implement conventional commit validation on every
push
to the repo. - implement vulnerability scanning in
pull-request
command against the SBOMs generated bygoreleaser
- implement a automated version bumping on
release
command usinggo-sematic-release
andgoreleaser
- create library package of commands and components to be used in other Dagger Pipelines