A sample Go app for demonstrating Ko with
- build each application, where Go package main entrypoints are
- sign container images with Cosign
| Name | Description | Link |
|---|---|---|
| Build | Builds and signs Go based container images (ko, cosign) | link |
| Go test | Runs go test against the repo |
link |
| Lint | Lints for code quality (golangci) | link |
| Image promotion | Tags images using image digests | link |
| Conform | Ensures that commits in PRs are standardised | link |
| Update Go version | Ensures that the Go version which the applications use, is on the latest stable | link |
all of the actions are implementing reusable workflows.
-
under Settings -> Code and automation -> Actions -> General, set Allow GitHub Actions to create and approve pull requests to
true -
add a branch protection rule under Settings -> Code and automation -> Add rule entering
Branch name pattern: main
Require a pull request before merging: true
Require status checks to pass before merging: true
Require branches to be up to date before merging: true
Status checks:
- golangci / lint
- conform / conform
Require signed commitslaunch a local kind cluster, pre-installed with Knative
kn quickstart kindapply the pre-built release
kubectl apply -f https://github.com/BobyMCbobs/sample-ko-monorepo/raw/main/deploy/release.yamlgo run cmd/webthingy/main.gogo run cmd/mission-critical-service/main.goexport KO_DOCKER_REPO=ghcr.io/bobymcbobs/sample-ko-monorepo
ko resolve --bare -f config/cosign tree IMAGE_REFcontainer images are able to be verified with the following command
cosign verify ghcr.io/bobymcbobs/sample-ko-monorepo/mission-critical-service@sha256:405b54637c79a0b0934d0d7f01464f358fe1fd118fefb1d9b77c8a351e9471b6 --certificate-identity https://github.com/BobyMCbobs/sample-ko-monorepo/.github/workflows/reusable-build.yml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.comSBOMs attestations are able to be verified with the following command
cosign verify-attestation ghcr.io/bobymcbobs/sample-ko-monorepo/mission-critical-service@sha256:405b54637c79a0b0934d0d7f01464f358fe1fd118fefb1d9b77c8a351e9471b6 --certificate-identity https://github.com/BobyMCbobs/sample-ko-monorepo/.github/workflows/reusable-build.yml@refs/heads/main --certificate-oidc-issuer https://token.actions.githubusercontent.com | jq -r .payload | base64 -d | jq -r .predicate.Data | bom document outline -adjust the actions package access settings in
- go to github.com/{{org/user}}
- go to the packages tab
- click on the package failing
- ensure that the Actions repository access is set up to point to the source repo
- set manage Actions access role field to
write
- dependency security scanning
- automatic dependency updates
- Go version upgrade auto-PR
- add build dependency cache