Skip to content

Commit

Permalink
Setup base project
Browse files Browse the repository at this point in the history
Throw out everything we do not need, including base CLI setup as we will
switch to a kubebuilder based setup.
  • Loading branch information
glrf committed Apr 1, 2022
1 parent 7c3bf8c commit 0118712
Show file tree
Hide file tree
Showing 32 changed files with 23 additions and 1,417 deletions.
6 changes: 0 additions & 6 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
blank_issues_enabled: false

# TODO: Redirect support questions
# contact_links:
# - name: ❓ Question
# url: https://github.com/<org>/<repo>/discussions
# about: Ask or discuss with us, we're happy to help 🙋
82 changes: 0 additions & 82 deletions .github/workflows/docs.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
- name: Upload code coverage report to Code Climate
uses: paambaati/[email protected]
env:
# TODO: Update Reporter ID after importing in codeclimate.com
CC_TEST_REPORTER_ID: 8297d060a2a57278046db1ec5bb0e831a5e1c4e3624ad3991492157b60fc8433
CC_TEST_REPORTER_ID: 0225380e1c351d978d26eb4a05280c6ec029f15e1660a98328d3da8c4ada76a5
with:
coverageLocations: cover.out:gocov
prefix: github.com/${{ github.repository }}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ dist/
.github/release-notes.md

# Build
# TODO: Adjust binary file name
go-bootstrap
appuio-cloud-agent
*.out

# Docs
Expand Down
3 changes: 0 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ snapshot:
name_template: "{{ incpatch .Version }}-snapshot"

dockers:
# TODO: Adjust image locations
- goarch: amd64
use: buildx
build_flag_templates:
Expand All @@ -38,8 +37,6 @@ dockers:
- "{{ .Env.REGISTRY }}/{{ .Env.IMAGE_NAME }}:v{{ .Version }}-arm64"

docker_manifests:
# TODO: Adjust image locations

## ghcr.io
# For prereleases, updating `latest` does not make sense.
# Only the image for the exact version should be pushed.
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ RUN \
ca-certificates \
tzdata

# TODO: Adjust binary file name
ENTRYPOINT ["go-bootstrap"]
COPY go-bootstrap /usr/bin/
ENTRYPOINT ["appuio-cloud-agent"]
COPY appuio-cloud-agent /usr/bin/

USER 65536:0
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ MAKEFLAGS += --no-builtin-variables
# General variables
include Makefile.vars.mk

# Following includes do not print warnings or error if files aren't found
# Optional Documentation module.
-include docs/antora-preview.mk docs/antora-build.mk
# Optional kind module
-include kind/kind.mk

Expand Down
5 changes: 2 additions & 3 deletions Makefile.vars.mk
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
## These are some common variables for Make

PROJECT_ROOT_DIR = .
# TODO: Adjust project meta
PROJECT_NAME ?= go-bootstrap
PROJECT_OWNER ?= vshn
PROJECT_NAME ?= appuio-cloud-agent
PROJECT_OWNER ?= appuio

## BUILD:go
BIN_FILENAME ?= $(PROJECT_NAME)
Expand Down
132 changes: 11 additions & 121 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,16 @@
# go-bootstrap
# APPUiO Cloud Agent

[![Build](https://img.shields.io/github/workflow/status/vshn/go-bootstrap/Test)][build]
![Go version](https://img.shields.io/github/go-mod/go-version/vshn/go-bootstrap)
[![Version](https://img.shields.io/github/v/release/vshn/go-bootstrap)][releases]
[![Maintainability](https://img.shields.io/codeclimate/maintainability/vshn/go-bootstrap)][codeclimate]
[![Coverage](https://img.shields.io/codeclimate/coverage/vshn/go-bootstrap)][codeclimate]
[![GitHub downloads](https://img.shields.io/github/downloads/vshn/go-bootstrap/total)][releases]
[![Build](https://img.shields.io/github/workflow/status/appuio/appuio-cloud-agent/Test)][build]
![Go version](https://img.shields.io/github/go-mod/go-version/appuio/appuio-cloud-agent)
[![Version](https://img.shields.io/github/v/release/appuio/appuio-cloud-agent)][releases]
[![Maintainability](https://img.shields.io/codeclimate/maintainability/appuio/appuio-cloud-agent)][codeclimate]
[![Coverage](https://img.shields.io/codeclimate/coverage/appuio/appuio-cloud-agent)][codeclimate]
[![GitHub downloads](https://img.shields.io/github/downloads/appuio/appuio-cloud-agent/total)][releases]

[build]: https://github.com/vshn/go-bootstrap/actions?query=workflow%3ATest
[releases]: https://github.com/vshn/go-bootstrap/releases
[codeclimate]: https://codeclimate.com/github/vshn/go-bootstrap
[build]: https://github.com/appuio/appuio-cloud-agent/actions?query=workflow%3ATest
[releases]: https://github.com/appuio/appuio-cloud-agent/releases
[codeclimate]: https://codeclimate.com/github/appuio/appuio-cloud-agent

Template repository for common Go setups
The APPUiO Cloud Agent is a controller running on every APPUiO Cloud Zone.

## Features

* GitHub Workflows
- Build (Go & Docker image)
- Test (including CodeClimate)
- Lint (Go)
- Release (Goreleaser & Changelog generator)

* GitHub issue templates
- PR template
- Issue templates using GitHub issue forms

* Goreleaser
- Go build for `amd64`, `armv8`
- Docker build for `latest` and `vx.y.z` tags
- Push Docker image to GitHub's registry `ghcr.io`

* Antora documentation
- Build default documentation with VSHN styling
- Publish to GitHub Pages by default (opt-out)
- Automated with GitHub workflows to build in `master` branch and (pre-)releases.
- Available `make` targets are prefixed with `docs-`

* Local Kubernetes environment
- Setup Kubernetes-In-Docker (kind)
- Prepares a kubeconfig file in `.kind/`
- Optionally install NGINX as ingress controller
- Available `make` targets are prefixed with `kind-`

* CLI and logging framework
- To help get you started with CLI subcommands, flags and environment variables
- If you don't need subcommands, remove `example_command.go` and adjust `cli.App` settings in `main.go`

## TODO's after generating from this template

TIP: You can search for these tasks using `grep -n -r "TODO:" .`

1. `go.mod`: Adjust module name.
1. `.goreleaser.yml`: Adjust Docker image location in `dockers` and `docker_manifests` parameters.
1. `.gitignore`: Adjust binary file name.
1. `Dockerfile`: Adjust binary file name.
1. `Makefile.vars.mk`: Adjust project meta.
1. `.github/ISSUE_TEMPLATE/config.yml` (optional): Enable forwarding questions to GitHub Discussions or other page.
1. `.github/workflows/test.yml`: Update CodeClimate reporter ID (to be found in codeclimate.com Test coverage settings)
1. `docs/antora.yml`: Adjust project meta.
1. `docs/antora-playbook.yml`: Adjust project meta.
1. `docs/modules/pages/index.adoc`: Edit start page.
1. `docs/modules/nav.adoc`: Edit navigation.
1. `main.go`: Adjust variables.
1. Edit this README (including badges links)
1. Start hacking in `example_command.go`.

After completing a task, you can remove the comment in the files.

## Other repository settings

1. GitHub Settings
- "Options > Wiki" (disable)
- "Options > Allow auto-merge" (enable)
- "Options > Automatically delete head branches" (enable)
- "Collaborators & Teams > Add Teams and users to grant maintainer permissions
- "Branches > Branch protection rules":
- Branch name pattern: `master`
- Require status check to pass before merging: `["lint"]` (you may need to push come commits first)
- "Pages > Source": Branch `gh-pages`

1. GitHub Issue labels
- "Issues > Labels > New Label" for the following labels with color suggestions:
- `change` (`#D93F0B`)
- `dependency` (`#ededed`)
- `breaking` (`#FBCA04`)

1. CodeClimate Settings
- "Repo Settings > GitHub > Pull request status updates" (install)
- "Repo Settings > Test coverage > Enforce {Diff,Total} Coverage" (configure to your liking)

## Antora documentation

This template comes with an Antora documentation module to help you create Asciidoctor documentation.
By default, it is automatically published to GitHub Pages in `gh-pages` branch, however it can also be included in external Antora playbooks.

### Setup GitHub Pages

Once you generated a new repository using this template, the initial commit automatically runs a Job that creates the documentation in the `gh-pages` branch.
All you need to do is then to enable Pages in the settings.

The `gh-pages` branch is a parent-less commit that only contains the Antora-generated files.

However, if that's not the case or if you are setting up Antora in an existing repository, here's how you can achieve the same, but make sure to **commit or stash current changes first!**
```bash
current_branch=$(git rev-parse --abbrev-ref HEAD)
initial_commit=$(git rev-list --max-parents=0 HEAD)
git switch --create gh-pages $initial_commit
git rm -r --cached .
git commit -m "Prepare gh-pages branch"
git push --set-upstream origin gh-pages
git switch -f $current_branch
```

And you're done!
GitHub automatically recognizes activity and sets up Pages if there's a `gh-pages` branch.

---

If you want to skip deployment to GitHub Pages you need to delete specific files and references:
`rm -f .github/workflows/docs.yml docs/package*.json docs/antora-playbook.yml docs/antora-build.mk`.
Also don't forget to delete the branch and disable Pages in the repository settings.

---

If you want to remove documentation completely simply run `rm -rf docs .github/workflows/docs.yml`.
24 changes: 0 additions & 24 deletions docs/antora-build.mk

This file was deleted.

19 changes: 0 additions & 19 deletions docs/antora-playbook.yml

This file was deleted.

7 changes: 0 additions & 7 deletions docs/antora-preview.mk

This file was deleted.

7 changes: 0 additions & 7 deletions docs/antora.yml

This file was deleted.

Empty file.
Empty file.
15 changes: 0 additions & 15 deletions docs/modules/ROOT/nav.adoc

This file was deleted.

Empty file.
Empty file.
Empty file.
21 changes: 0 additions & 21 deletions docs/modules/ROOT/pages/index.adoc

This file was deleted.

Empty file.
Empty file.
Empty file.
Loading

0 comments on commit 0118712

Please sign in to comment.