Skip to content

Commit

Permalink
rename project to Kargo Render (#185)
Browse files Browse the repository at this point in the history
Signed-off-by: Kent <[email protected]>
  • Loading branch information
krancour authored Oct 11, 2023
1 parent 9e77bc5 commit e92d6d0
Show file tree
Hide file tree
Showing 52 changed files with 337 additions and 331 deletions.
2 changes: 1 addition & 1 deletion .github/governance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ issue:
- ux
- ci-process
- release-process
# bookkeeper component areas
# kargo-render component areas
multiple: true
needs: true
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/akuity/bookkeeper
images: ghcr.io/akuity/kargo-render
flavor: latest=false
tags: type=semver,pattern={{raw}}
- name: Build and push
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Code of conduct

See https://bookkeeper.akuity.io/contributor-guide/code-of-conduct/
See https://kargo-render.akuity.io/contributor-guide/code-of-conduct/
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Bookkeeper contributor guide
# Kargo Render contributor guide

See https://bookkeeper.akuity.io/contributor-guide/
See https://kargo-render.akuity.io/contributor-guide/
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ RUN curl -L -o /usr/local/bin/ytt \
https://github.com/vmware-tanzu/carvel-ytt/releases/download/${YTT_VERSION}/ytt-linux-${TARGETARCH} \
&& chmod 755 /usr/local/bin/ytt

ARG VERSION_PACKAGE=github.com/akuity/bookkeeper/internal/version
ARG VERSION_PACKAGE=github.com/akuity/kargo-render/internal/version
ARG CGO_ENABLED=0

WORKDIR /bookkeeper
WORKDIR /kargo-render
COPY go.mod .
COPY go.sum .
RUN go mod download
Expand All @@ -33,11 +33,11 @@ ARG GIT_TREE_STATE

RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build \
-ldflags "-w -X ${VERSION_PACKAGE}.version=${VERSION} -X ${VERSION_PACKAGE}.buildDate=$(date -u +'%Y-%m-%dT%H:%M:%SZ') -X ${VERSION_PACKAGE}.gitCommit=${GIT_COMMIT} -X ${VERSION_PACKAGE}.gitTreeState=${GIT_TREE_STATE}" \
-o bin/bookkeeper \
-o bin/kargo-render \
./cmd \
&& bin/bookkeeper version \
&& bin/kargo-render version \
&& cd bin \
&& ln -s bookkeeper bookkeeper-action
&& ln -s kargo-render kargo-render-action

FROM alpine:3.15.4 as final

Expand All @@ -49,8 +49,8 @@ RUN apk update \
COPY --from=builder /usr/local/bin/helm /usr/local/bin/
COPY --from=builder /usr/local/bin/kustomize /usr/local/bin/
COPY --from=builder /usr/local/bin/ytt /usr/local/bin/
COPY --from=builder /bookkeeper/bin/ /usr/local/bin/
COPY --from=builder /kargo-render/bin/ /usr/local/bin/

USER nonroot

CMD ["/usr/local/bin/bookkeeper"]
CMD ["/usr/local/bin/kargo-render"]
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ DOCKER_CMD := docker run \
-it \
--rm \
-v gomodcache:/go/pkg/mod \
-v $(dir $(realpath $(firstword $(MAKEFILE_LIST)))):/workspaces/bookkeeper \
-w /workspaces/bookkeeper \
bookkeeper:dev-tools
-v $(dir $(realpath $(firstword $(MAKEFILE_LIST)))):/workspaces/kargo-render \
-w /workspaces/kargo-render \
kargo-render:dev-tools

.PHONY: hack-build-dev-tools
hack-build-dev-tools:
docker build -f Dockerfile.dev -t bookkeeper:dev-tools .
docker build -f Dockerfile.dev -t kargo-render:dev-tools .

.PHONY: hack-lint
hack-lint: hack-build-dev-tools
Expand All @@ -57,5 +57,5 @@ hack-build:
docker build \
--build-arg GIT_COMMIT=$(shell git rev-parse HEAD) \
--build-arg GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi) \
--tag bookkeeper:dev \
--tag kargo-render:dev \
.
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# Bookkeeper -- Environment Branches Utility
# Kargo Render -- Rendered Branches Utility

![CI](https://github.com/akuity/bookkeeper/actions/workflows/ci.yaml/badge.svg)
[![codecov](https://codecov.io/gh/akuity/bookkeeper/branch/main/graph/badge.svg?token=MRKMA584M9)](https://codecov.io/gh/akuity/bookkeeper)
[![Netlify Status](https://api.netlify.com/api/v1/badges/f5d7d99b-ca3a-4477-a10b-67fb7a8328a9/deploy-status)](https://app.netlify.com/sites/docs-bookkeeper-akuity-io/deploys)
![CI](https://github.com/akuity/kargo-render/actions/workflows/ci.yaml/badge.svg)
[![codecov](https://codecov.io/gh/akuity/kargo-render/branch/main/graph/badge.svg?token=MRKMA584M9)](https://codecov.io/gh/akuity/kargo-render)
[![Netlify Status](https://api.netlify.com/api/v1/badges/f5d7d99b-ca3a-4477-a10b-67fb7a8328a9/deploy-status)](https://app.netlify.com/sites/docs-kargo-render-akuity-io/deploys)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)

<img width="80" align="left" src="logo.png" style="right-margin: 20px"/>

Placeholder

🟡&nbsp;&nbsp;Bookkeeper is highly experimental at this time and breaking
🟡&nbsp;&nbsp;Kargo Render is highly experimental at this time and breaking
changes should be anticipated between pre-GA minor releases.

<br clear="left"/>

## Getting Started

Read more about Bookkeeper in our [docs](https://bookkeeper.akuity.io).
Read more about Kargo Render in our [docs](https://kargo-render.akuity.io).

This documentation is very new, so please open issues against this repository if
you encounter any difficulties with it.

## Roadmap

Visit our [Roadmap](https://bookkeeper.akuity.io/roadmap) for frequently updated
details about what we've accomplished so far and what we're currently working
on.
Visit our [Roadmap](https://kargo-render.akuity.io/roadmap) for frequently
updated details about what we've accomplished so far and what we're currently
working on.

## Contributing

The Bookkeeper project accepts contributions via GitHub pull requests.
The Kargo Render project accepts contributions via GitHub pull requests.

Visit our
[Bookkeeper Contributor Guide](https://bookkeeper.akuity.io/contributor-guide/)
[Kargo Render Contributor Guide](https://kargo-render.akuity.io/contributor-guide/)
for more info on how to get started quickly and easily.

## Support & Feedback

To report an issue, request a feature, or ask a question, please open an issue
[here](https://github.com/akuity/bookkeeper/issues).
[here](https://github.com/akuity/kargo-render/issues).

## Code of Conduct

Participation in the Bookkeeper project is governed by the
[Contributor Covenant Code of Conduct](https://bookkeeper.akuity.io/contributor-guide/code-of-conduct/).
Participation in the Kargo Render project is governed by the
[Contributor Covenant Code of Conduct](https://kargo-render.akuity.io/contributor-guide/code-of-conduct/).
10 changes: 5 additions & 5 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: akuity-bookkeeper
name: kargo-render
description: Publish rendered manifests to an environment branch
inputs:
personalAccessToken:
description: A personal access token that allows Bookkeeper to write to your repository
description: A personal access token that allows Kargo Render to write to your repository
required: true
targetBranch:
description: The environment branch for which you want to render manifests
required: true
allowEmpty:
description: Whether to allow rendered manifests to be empty. If false this is disallowed as a safeguard against scenarios where a bug of any kind might otherwise cause Bookkeeper to wipe out the contents of the target branch in error.
description: Whether to allow rendered manifests to be empty. If false this is disallowed as a safeguard against scenarios where a bug of any kind might otherwise cause Kargo Render to wipe out the contents of the target branch in error.
required: false
default: 'false'
runs:
using: docker
image: docker://ghcr.io/akuity/bookkeeper:v0.1.0-rc.24
entrypoint: bookkeeper-action
image: docker://ghcr.io/akuity/kargo-render:v0.1.0-rc.25
entrypoint: kargo-render-action
22 changes: 11 additions & 11 deletions branches.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bookkeeper
package render

import (
"fmt"
Expand All @@ -8,11 +8,11 @@ import (
"github.com/ghodss/yaml"
"github.com/pkg/errors"

"github.com/akuity/bookkeeper/internal/file"
"github.com/akuity/kargo-render/internal/file"
)

// branchMetadata encapsulates details about an environment-specific branch for
// internal use by Bookkeeper.
// internal use by Kargo Render.
type branchMetadata struct {
// SourceCommit ia a back-reference to the specific commit in the repository's
// default branch (i.e. main or master) from which the manifests stored in
Expand All @@ -24,12 +24,12 @@ type branchMetadata struct {
}

// loadBranchMetadata attempts to load BranchMetadata from a
// .bookkeeper/metadata.yaml file relative to the specified directory. If no
// .kargo-render/metadata.yaml file relative to the specified directory. If no
// such file is found a nil result is returned.
func loadBranchMetadata(repoPath string) (*branchMetadata, error) {
path := filepath.Join(
repoPath,
".bookkeeper",
".kargo-render",
"metadata.yaml",
)
if exists, err := file.Exists(path); err != nil {
Expand All @@ -50,9 +50,9 @@ func loadBranchMetadata(repoPath string) (*branchMetadata, error) {
}

// writeBranchMetadata attempts to marshal the provided BranchMetadata and write
// it to a .bookkeeper/metadata.yaml file relative to the specified directory.
// it to a .kargo-render/metadata.yaml file relative to the specified directory.
func writeBranchMetadata(md branchMetadata, repoPath string) error {
bkDir := filepath.Join(repoPath, ".bookkeeper")
bkDir := filepath.Join(repoPath, ".kargo-render")
// Ensure the existence of the directory
if err := os.MkdirAll(bkDir, 0755); err != nil {
return errors.Wrapf(err, "error ensuring existence of directory %q", bkDir)
Expand All @@ -68,7 +68,7 @@ func writeBranchMetadata(md branchMetadata, repoPath string) error {
)
}

func switchToTargetBranch(rc renderRequestContext) error {
func switchToTargetBranch(rc requestContext) error {
logger := rc.logger.WithField("targetBranch", rc.request.TargetBranch)

// Check if the target branch exists on the remote
Expand Down Expand Up @@ -108,7 +108,7 @@ func switchToTargetBranch(rc renderRequestContext) error {
return nil
}

func switchToCommitBranch(rc renderRequestContext) (string, error) {
func switchToCommitBranch(rc requestContext) (string, error) {
logger := rc.logger.WithField("targetBranch", rc.request.TargetBranch)

var commitBranch string
Expand All @@ -119,9 +119,9 @@ func switchToCommitBranch(rc renderRequestContext) (string, error) {
)
} else {
if rc.target.branchConfig.PRs.UseUniqueBranchNames {
commitBranch = fmt.Sprintf("prs/bookkeeper/%s", rc.request.id)
commitBranch = fmt.Sprintf("prs/kargo-render/%s", rc.request.id)
} else {
commitBranch = fmt.Sprintf("prs/bookkeeper/%s", rc.request.TargetBranch)
commitBranch = fmt.Sprintf("prs/kargo-render/%s", rc.request.TargetBranch)
}
logger = logger.WithField("commitBranch", commitBranch)
logger.Debug("changes will be PR'ed to the target branch")
Expand Down
10 changes: 5 additions & 5 deletions branches_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package bookkeeper
package render

import (
"os"
Expand All @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/akuity/bookkeeper/internal/file"
"github.com/akuity/kargo-render/internal/file"
)

func TestLoadBranchMetadata(t *testing.T) {
Expand All @@ -33,7 +33,7 @@ func TestLoadBranchMetadata(t *testing.T) {
setup: func() string {
repoDir, err := os.MkdirTemp("", "")
require.NoError(t, err)
bkDir := filepath.Join(repoDir, ".bookkeeper")
bkDir := filepath.Join(repoDir, ".kargo-render")
err = os.Mkdir(bkDir, 0755)
require.NoError(t, err)
err = os.WriteFile(
Expand All @@ -54,7 +54,7 @@ func TestLoadBranchMetadata(t *testing.T) {
setup: func() string {
repoDir, err := os.MkdirTemp("", "")
require.NoError(t, err)
bkDir := filepath.Join(repoDir, ".bookkeeper")
bkDir := filepath.Join(repoDir, ".kargo-render")
err = os.Mkdir(bkDir, 0755)
require.NoError(t, err)
err = os.WriteFile(
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestWriteBranchMetadata(t *testing.T) {
)
require.NoError(t, err)
exists, err :=
file.Exists(filepath.Join(repoDir, ".bookkeeper", "metadata.yaml"))
file.Exists(filepath.Join(repoDir, ".kargo-render", "metadata.yaml"))
require.NoError(t, err)
require.True(t, exists)
}
20 changes: 10 additions & 10 deletions cmd/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

log "github.com/sirupsen/logrus"

"github.com/akuity/bookkeeper"
"github.com/akuity/bookkeeper/internal/version"
render "github.com/akuity/kargo-render"
"github.com/akuity/kargo-render/internal/version"
)

func Run() {
Expand All @@ -27,39 +27,39 @@ func Run() {
logger.WithFields(log.Fields{
"version": version.Version,
"commit": version.GitCommit,
}).Info("Starting Bookkeeper Action")
}).Info("Starting Kargo Render Action")

req, err := request()
if err != nil {
logger.Fatal(err)
}

res, err := bookkeeper.NewService(
&bookkeeper.ServiceOptions{
LogLevel: bookkeeper.LogLevel(logger.Level),
res, err := render.NewService(
&render.ServiceOptions{
LogLevel: render.LogLevel(logger.Level),
},
).RenderManifests(context.Background(), req)
if err != nil {
logger.Fatal(err)
}

switch res.ActionTaken {
case bookkeeper.ActionTakenNone:
case render.ActionTakenNone:
fmt.Println(
"\nThis request would not change any state. No action was taken.",
)
case bookkeeper.ActionTakenOpenedPR:
case render.ActionTakenOpenedPR:
fmt.Printf(
"\nOpened PR %s\n",
res.PullRequestURL,
)
case bookkeeper.ActionTakenPushedDirectly:
case render.ActionTakenPushedDirectly:
fmt.Printf(
"\nCommitted %s to branch %s\n",
res.CommitID,
req.TargetBranch,
)
case bookkeeper.ActionTakenUpdatedPR:
case render.ActionTakenUpdatedPR:
fmt.Printf(
"\nUpdated an existing PR to %s\n",
req.TargetBranch,
Expand Down
2 changes: 1 addition & 1 deletion cmd/action/logger.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package action

import libLog "github.com/akuity/bookkeeper/internal/log"
import libLog "github.com/akuity/kargo-render/internal/log"

var logger = libLog.LoggerOrDie()
10 changes: 5 additions & 5 deletions cmd/action/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package action
import (
"fmt"

"github.com/akuity/bookkeeper"
libOS "github.com/akuity/bookkeeper/internal/os"
render "github.com/akuity/kargo-render"
libOS "github.com/akuity/kargo-render/internal/os"
)

func request() (bookkeeper.RenderRequest, error) {
req := bookkeeper.RenderRequest{
RepoCreds: bookkeeper.RepoCredentials{
func request() (render.Request, error) {
req := render.Request{
RepoCreds: render.RepoCredentials{
Username: "git",
},
Images: libOS.GetStringSliceFromEnvVar("INPUT_IMAGES", nil),
Expand Down
Loading

0 comments on commit e92d6d0

Please sign in to comment.