Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename tk binary to gotk #180

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:

{
# install script
cp install/tk.sh docs/install.sh
cp install/gotk.sh docs/install.sh
}
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
Expand Down
88 changes: 44 additions & 44 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@ jobs:
exit 1
fi
- name: Build
run: sudo go build -o ./bin/tk ./cmd/tk
- name: tk check --pre
run: sudo go build -o ./bin/gotk ./cmd/gotk
- name: gotk check --pre
run: |
./bin/tk check --pre
- name: tk install --version
./bin/gotk check --pre
- name: gotk install --version
run: |
./bin/tk install --version=master --namespace=test --verbose --components="source-controller,kustomize-controller"
- name: tk uninstall
./bin/gotk install --version=master --namespace=test --verbose --components="source-controller,kustomize-controller"
- name: gotk uninstall
run: |
./bin/tk uninstall --namespace=test --crds --silent
- name: tk install --manifests
./bin/gotk uninstall --namespace=test --crds --silent
- name: gotk install --manifests
run: |
./bin/tk install --manifests ./manifests/install/ --version=""
- name: tk create source git
./bin/gotk install --manifests ./manifests/install/ --version=""
- name: gotk create source git
run: |
./bin/tk create source git podinfo \
./bin/gotk create source git podinfo \
--url https://github.com/stefanprodan/podinfo \
--tag-semver=">=3.2.3"
- name: tk get sources git
- name: gotk get sources git
run: |
./bin/tk get sources git
- name: tk create kustomization
./bin/gotk get sources git
- name: gotk create kustomization
run: |
./bin/tk create kustomization podinfo \
./bin/gotk create kustomization podinfo \
--source=podinfo \
--path="./deploy/overlays/dev" \
--prune=true \
Expand All @@ -69,54 +69,54 @@ jobs:
--health-check="Deployment/frontend.dev" \
--health-check="Deployment/backend.dev" \
--health-check-timeout=3m
- name: tk sync kustomization --with-source
- name: gotk sync kustomization --with-source
run: |
./bin/tk reconcile kustomization podinfo --with-source
- name: tk get kustomizations
./bin/gotk reconcile kustomization podinfo --with-source
- name: gotk get kustomizations
run: |
./bin/tk get kustomizations
- name: tk suspend kustomization
./bin/gotk get kustomizations
- name: gotk suspend kustomization
run: |
./bin/tk suspend kustomization podinfo
- name: tk resume kustomization
./bin/gotk suspend kustomization podinfo
- name: gotk resume kustomization
run: |
./bin/tk resume kustomization podinfo
- name: tk export
./bin/gotk resume kustomization podinfo
- name: gotk export
run: |
./bin/tk export source git --all
./bin/tk export kustomization --all
- name: tk delete kustomization
./bin/gotk export source git --all
./bin/gotk export kustomization --all
- name: gotk delete kustomization
run: |
./bin/tk delete kustomization podinfo --silent
- name: tk delete source git
./bin/gotk delete kustomization podinfo --silent
- name: gotk delete source git
run: |
./bin/tk delete source git podinfo --silent
- name: tk create source helm
./bin/gotk delete source git podinfo --silent
- name: gotk create source helm
run: |
./bin/tk create source helm podinfo \
./bin/gotk create source helm podinfo \
--url https://stefanprodan.github.io/podinfo
- name: tk create helmrelease
- name: gotk create helmrelease
run: |
./bin/tk create hr podinfo \
./bin/gotk create hr podinfo \
--target-namespace=default \
--source=podinfo \
--chart-name=podinfo \
--chart-version=">4.0.0 <5.0.0"
- name: tk get helmreleases
- name: gotk get helmreleases
run: |
./bin/tk get helmreleases
- name: tk export helmrelease
./bin/gotk get helmreleases
- name: gotk export helmrelease
run: |
./bin/tk export hr --all
- name: tk delete helmrelease
./bin/gotk export hr --all
- name: gotk delete helmrelease
run: |
./bin/tk delete hr podinfo --silent
- name: tk delete source helm
./bin/gotk delete hr podinfo --silent
- name: gotk delete source helm
run: |
./bin/tk delete source helm podinfo --silent
- name: tk check
./bin/gotk delete source helm podinfo --silent
- name: gotk check
run: |
./bin/tk check
./bin/gotk check
- name: Debug failure
if: failure()
run: |
Expand Down
4 changes: 2 additions & 2 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
builds:
- main: ./cmd/tk
- main: ./cmd/gotk
ldflags:
- -s -w -X main.VERSION={{ .Version }}
binary: tk
binary: gotk
goos:
- darwin
- linux
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION?=$(shell grep 'VERSION' cmd/tk/main.go | awk '{ print $$4 }' | tr -d '"')
VERSION?=$(shell grep 'VERSION' cmd/gotk/main.go | awk '{ print $$4 }' | tr -d '"')

all: test build

Expand All @@ -15,14 +15,14 @@ test: tidy fmt vet docs
go test ./... -coverprofile cover.out

build:
CGO_ENABLED=0 go build -o ./bin/tk ./cmd/tk
CGO_ENABLED=0 go build -o ./bin/gotk ./cmd/gotk

install:
go install cmd/tk
go install cmd/gotk

.PHONY: docs
docs:
mkdir -p ./docs/cmd && go run ./cmd/tk/ docgen
mkdir -p ./docs/cmd && go run ./cmd/gotk/ docgen

install-dev:
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/tk
CGO_ENABLED=0 go build -o /usr/local/bin ./cmd/gotk
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

Experimental toolkit for assembling CD pipelines the GitOps way.

![overview](docs/diagrams/tk-feature.png)
![overview](docs/diagrams/gotk-feature.png)

To get started with the toolkit please read the [docs](https://toolkit.fluxcd.io/).
10 changes: 5 additions & 5 deletions cmd/tk/bootstrap.go → cmd/gotk/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ func init() {
}

func generateInstallManifests(targetPath, namespace, tmpDir string) (string, error) {
tkDir := path.Join(tmpDir, ".tk")
defer os.RemoveAll(tkDir)
gotkDir := path.Join(tmpDir, ".gotk")
defer os.RemoveAll(gotkDir)

if err := os.MkdirAll(tkDir, os.ModePerm); err != nil {
if err := os.MkdirAll(gotkDir, os.ModePerm); err != nil {
return "", fmt.Errorf("generating manifests failed: %w", err)
}

if err := genInstallManifests(bootstrapVersion, namespace, bootstrapComponents, bootstrapRegistry, bootstrapImagePullSecret, tkDir); err != nil {
if err := genInstallManifests(bootstrapVersion, namespace, bootstrapComponents, bootstrapRegistry, bootstrapImagePullSecret, gotkDir); err != nil {
return "", fmt.Errorf("generating manifests failed: %w", err)
}

Expand All @@ -88,7 +88,7 @@ func generateInstallManifests(targetPath, namespace, tmpDir string) (string, err
}

manifest := path.Join(manifestsDir, bootstrapInstallManifest)
if err := buildKustomization(tkDir, manifest); err != nil {
if err := buildKustomization(gotkDir, manifest); err != nil {
return "", fmt.Errorf("build kustomization failed: %w", err)
}

Expand Down
16 changes: 8 additions & 8 deletions cmd/tk/bootstrap_github.go → cmd/gotk/bootstrap_github.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ the bootstrap command will perform an upgrade if needed.`,
export GITHUB_TOKEN=<my-token>

# Run bootstrap for a private repo owned by a GitHub organization
tk bootstrap github --owner=<organization> --repository=<repo name>
gotk bootstrap github --owner=<organization> --repository=<repo name>

# Run bootstrap for a private repo and assign organization teams to it
tk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>
gotk bootstrap github --owner=<organization> --repository=<repo name> --team=<team1 slug> --team=<team2 slug>

# Run bootstrap for a repository path
tk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster
gotk bootstrap github --owner=<organization> --repository=<repo name> --path=dev-cluster

# Run bootstrap for a public repository on a personal account
tk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true
gotk bootstrap github --owner=<user> --repository=<repo name> --private=false --personal=true

# Run bootstrap for a private repo hosted on GitHub Enterprise
tk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
gotk bootstrap github --owner=<organization> --repository=<repo name> --hostname=<domain>
`,
RunE: bootstrapGitHubCmdRun,
}
Expand Down Expand Up @@ -93,7 +93,7 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("%s environment variable not found", git.GitHubTokenName)
}

repository, err := git.NewRepository(ghRepository, ghOwner, ghHostname, ghToken, "tk", ghOwner+"@users.noreply.github.com")
repository, err := git.NewRepository(ghRepository, ghOwner, ghHostname, ghToken, "gotk", ghOwner+"@users.noreply.github.com")
if err != nil {
return err
}
Expand Down Expand Up @@ -194,9 +194,9 @@ func bootstrapGitHubCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("generating deploy key failed: %w", err)
}

keyName := "tk"
keyName := "gotk"
if ghPath != "" {
keyName = fmt.Sprintf("tk-%s", ghPath)
keyName = fmt.Sprintf("gotk-%s", ghPath)
}

if changed, err := provider.AddDeployKey(ctx, repository, key, keyName); err != nil {
Expand Down
14 changes: 7 additions & 7 deletions cmd/tk/bootstrap_gitlab.go → cmd/gotk/bootstrap_gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ the bootstrap command will perform an upgrade if needed.`,
export GITLAB_TOKEN=<my-token>

# Run bootstrap for a private repo owned by a GitLab group
tk bootstrap gitlab --owner=<group> --repository=<repo name>
gotk bootstrap gitlab --owner=<group> --repository=<repo name>

# Run bootstrap for a repository path
tk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster
gotk bootstrap gitlab --owner=<group> --repository=<repo name> --path=dev-cluster

# Run bootstrap for a public repository on a personal account
tk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true
gotk bootstrap gitlab --owner=<user> --repository=<repo name> --private=false --personal=true

# Run bootstrap for a private repo hosted on a GitLab server
tk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
gotk bootstrap gitlab --owner=<group> --repository=<repo name> --hostname=<domain>
`,
RunE: bootstrapGitLabCmdRun,
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("%s environment variable not found", git.GitLabTokenName)
}

repository, err := git.NewRepository(glRepository, glOwner, glHostname, glToken, "tk", glOwner+"@users.noreply.gitlab.com")
repository, err := git.NewRepository(glRepository, glOwner, glHostname, glToken, "gotk", glOwner+"@users.noreply.gitlab.com")
if err != nil {
return err
}
Expand Down Expand Up @@ -178,9 +178,9 @@ func bootstrapGitLabCmdRun(cmd *cobra.Command, args []string) error {
return fmt.Errorf("generating deploy key failed: %w", err)
}

keyName := "tk"
keyName := "gotk"
if glPath != "" {
keyName = fmt.Sprintf("tk-%s", glPath)
keyName = fmt.Sprintf("gotk-%s", glPath)
}

if changed, err := provider.AddDeployKey(ctx, repository, key, keyName); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/tk/check.go → cmd/gotk/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ var checkCmd = &cobra.Command{
Long: `The check command will perform a series of checks to validate that
the local environment is configured correctly and if the installed components are healthy.`,
Example: ` # Run pre-installation checks
tk check --pre
gotk check --pre

# Run installation checks
tk check
gotk check
`,
RunE: runCheckCmd,
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/tk/completion.go → cmd/gotk/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ var completionCmd = &cobra.Command{
Short: "Generates bash completion scripts",
Example: `To load completion run

. <(tk completion)
. <(gotk completion)

To configure your bash shell to load completions for each session add to your bashrc

# ~/.bashrc or ~/.profile
. <(tk completion)
. <(gotk completion)
`,
Run: func(cmd *cobra.Command, args []string) {
rootCmd.GenBashCompletion(os.Stdout)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ var createHelmReleaseCmd = &cobra.Command{
Short: "Create or update a HelmRelease resource",
Long: "The helmrelease create command generates a HelmRelease resource for a given HelmRepository source.",
Example: ` # Create a HelmRelease from a source
tk create hr podinfo \
gotk create hr podinfo \
--interval=10m \
--release-name=podinfo \
--target-namespace=default \
Expand All @@ -51,15 +51,15 @@ var createHelmReleaseCmd = &cobra.Command{
--chart-version=">4.0.0"

# Create a HelmRelease with values for a local YAML file
tk create hr podinfo \
gotk create hr podinfo \
--target-namespace=default \
--source=podinfo \
--chart-name=podinfo \
--chart-version=4.0.5 \
--values=./my-values.yaml

# Create a HelmRelease definition on disk without applying it on the cluster
tk create hr podinfo \
gotk create hr podinfo \
--target-namespace=default \
--source=podinfo \
--chart-name=podinfo \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var createKsCmd = &cobra.Command{
Short: "Create or update a Kustomization resource",
Long: "The kustomization source create command generates a Kustomize resource for a given GitRepository source.",
Example: ` # Create a Kustomization resource from a source at a given path
tk create kustomization contour \
gotk create kustomization contour \
--source=contour \
--path="./examples/contour/" \
--prune=true \
Expand All @@ -51,7 +51,7 @@ var createKsCmd = &cobra.Command{
--health-check-timeout=3m

# Create a Kustomization resource that depends on the previous one
tk create kustomization webapp \
gotk create kustomization webapp \
--depends-on=contour \
--source=webapp \
--path="./deploy/overlays/dev" \
Expand All @@ -60,7 +60,7 @@ var createKsCmd = &cobra.Command{
--validation=client

# Create a Kustomization resource that runs under a service account
tk create kustomization webapp \
gotk create kustomization webapp \
--source=webapp \
--path="./deploy/overlays/staging" \
--prune=true \
Expand Down
File renamed without changes.
Loading