Skip to main content

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 Organization manifest and a GithubConnection manifest. The platform team sets them up.
  • An ArtifactRegistry manifest. Declare it before the BuildDefinition that names it, or validation fails.
  • A ReleaseTrack manifest and an ApplicationSet manifest. See Get Started.

Steps​

  1. Create the GithubRepository manifest.

    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]
  2. Create the BuildDefinition manifest.

    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
  3. Create an Application that 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
  4. 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​