Set Up a Repository and CI
Create a managed GitHub repository with generated CI, branch protection and a container image in Artifact Registry. Two manifests do this work: a GithubRepository and a BuildDefinition. See CI/CD for what the engine generates.
Prerequisites
- An
Organizationmanifest and aGithubConnectionmanifest. The platform team sets them up. - An
ArtifactRegistrymanifest. Declare it before theBuildDefinitionthat names it, or validation fails. - A
ReleaseTrackmanifest and anApplicationSetmanifest. See Get Started.
Steps
-
Create the
GithubRepositorymanifest.apiVersion: lowops.manifests.v1
kind: GithubRepository
metadata:
name: payment-api
github-connection: default
organization: fincorp
spec:
description: "Backend API service for payment processing"
strategy: GITHUB_FLOW # GITHUB_FLOW | GIT_FLOW | TRUNK_BASED
template: go-service-template # optional: a GithubRepositoryTemplate
codeOwners:
- path: "*"
owners: [platform-team]
permissions:
administrators:
groups: [platform-admins]
contributors:
groups: [backend-team]
viewers:
groups: [engineering] -
Create the
BuildDefinitionmanifest.apiVersion: lowops.manifests.v1
kind: BuildDefinition
metadata:
name: payment-api
github-repository: payment-api
github-connection: default
organization: fincorp
spec:
description: "CI pipeline for the payment API (Go backend)"
type: GOLANG
stages: [test, containerize]
golang:
buildType: bin # bin = executable, lib = library
target: "./cmd/server"
versions: ["1.23"]
containerize:
- name: payment-api
dockerfile: Dockerfile
platforms: [linux/amd64, linux/arm64]
registries: [fincorp-docker-registry] # an ArtifactRegistry manifest -
Create an
Applicationthat names the build.apiVersion: lowops.manifests.v1
kind: Application
metadata:
name: payment-api
application-set: payments
release-track: main-track
organizational-unit: retail-banking
organization: fincorp
spec:
buildDefinition: payment-api
target: CLOUD_RUN
project: payment-gateway -
Commit the three manifests in one pull request and merge it.
Verify
The repository exists with its branch rules and CODEOWNERS file. The engine commits the CI workflows to .github/workflows/. A push builds, tests and publishes an image. The CD system then deploys new versions through your ReleaseTrack.
Next
- Adopt a Repository, DNS and Sign-in: use a repository that already exists.
GithubRepositoryreference andBuildDefinitionreference