Skip to content

Commit

Permalink
chore: continue migration to initium-cli
Browse files Browse the repository at this point in the history
* change remaining names
* setup release please
* setup goreleaser
  • Loading branch information
LucaLanziani committed Aug 10, 2023
1 parent 677885d commit f37acd0
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 38 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: go
package-name: release-please-action
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: goreleaser

on:
push:
# run only against tags
tags:
- '*'

permissions:
contents: write
# packages: write
# issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: git fetch --force --tags

- uses: actions/setup-go@v4
with:
go-version: stable

- uses: goreleaser/goreleaser-action@v4
with:
# either 'goreleaser' (default) or 'goreleaser-pro':
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19 changes: 0 additions & 19 deletions .github/workflows/tests.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
Dockerfile.initium
*.init_test*
initium_onmain.yaml
initium_onbranch.yaml
initium_onbranch.yaml
dist/
45 changes: 45 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ All with a nice development workflow in mind like ephemeral environment for your
- [Rancher Desktop](https://rancherdesktop.io/) ( cross-platform, FOSS )
- [lima](https://github.com/lima-vm/lima) + [nerdctl](https://github.com/containerd/nerdctl) ( macOS only )


### Run from code

1. Run `go run main.go --project-directory example build`
2. Run `docker run ghcr.io/nearform/initium-cli:latest`
3. You should see the `KKA-CLI from NearForm` output in your console
4. Remove the image `docker image rmi -f ghcr.io/nearform/k8s-kurated-addons-cli:latest`

### Build the executable

In order to build the executable you simply need to run
Expand Down
4 changes: 2 additions & 2 deletions assets/github/onbranch.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- name: delete application
if: github.event.action == 'closed'
uses: docker://ghcr.io/nearform/k8s-kurated-addons-cli:latest
uses: docker://ghcr.io/nearform/initium-cli:latest
with:
args: onbranch --clean
env:
Expand All @@ -28,7 +28,7 @@ jobs:

- name: build and deploy application
if: github.event.action != 'closed'
uses: docker://ghcr.io/nearform/k8s-kurated-addons-cli:latest
uses: docker://ghcr.io/nearform/initium-cli:latest
with:
args: onbranch
env:
Expand Down
2 changes: 1 addition & 1 deletion assets/github/onmain.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v2

- name: build and deploy on {{ .DefaultBranch }}
uses: docker://ghcr.io/nearform/k8s-kurated-addons-cli:latest
uses: docker://ghcr.io/nearform/initium-cli:latest
with:
args: onmain
env:
Expand Down
12 changes: 6 additions & 6 deletions quick-start.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Quick Start Guide

#### k8s-kurated-addons-cli
#### initium-cli

This is a guide to help developers start using this repository. Even though it's based on a cluster spawned by k8s-kurated-addons, as long as the destination cluster has knative, the CLI will work.

### Prerequisites

- The project's dependencies as described in [the README](README.md)
- `tilt` (if using `k8s-kurated-addons` to bring up the cluster)
- `tilt` (if using `initium-platform` to bring up the cluster)

### Using the software

Follow the steps:

1. Install kka-cli (run `make build` and copy the executable to PATH)
2. If you want to use `k8s-kurated-addons`, clone it and run `make`
2. If you want to use `initium-platform`, clone it and run `make`
* this will bring up a cluster using kind (kubernetes in Docker)
3. Wait for the cluster to stabilize
* it's easier to spot checking `tilt` and `argocd` (they will show everything green)
4. Create a repo and enable read and write permissions for the GitHub Actions workflows as described in the [GitHub docs](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-default-github_token-permissions)
5. Clone the new repo
6. Get argocd-password, enable and access the argocd port forward from Tilt
7. Create a new branch from main / master in the repo
8. Run `kka-cli --app-name <app name> init config > .kka`
8. Run `initium --app-name <app name> init config > .kka`
* the app name needs to be unique since it will be used by knative to expose its service
* it’s going to be on the domain GitHub Actions will output
* if the organization name or GitHub account has uppercase characters, you will need to edit the `.kka` file and change the repo-name to a fully lowercase string
9. Run `kka-cli init github`
10. Run `kka-cli init service-account | kubectl apply -f -` to create the service account
9. Run `initium init github`
10. Run `initium init service-account | kubectl apply -f -` to create the service account
11. Run the following script:
```
export KKA_LB_ENDPOINT="$(kubectl get service -n istio-ingress istio-ingressgateway -o go-template='{{(index .status.loadBalancer.ingress 0).ip}}'):80"
Expand Down
2 changes: 1 addition & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"prConcurrentLimit": 0,
"rebaseWhen": "auto",
"repositories": [
"nearform/k8s-kurated-addons-cli"
"nearform/initium-cli"
],
"username": "nearform-renovate-app[bot]",
"regexManagers": [
Expand Down

0 comments on commit f37acd0

Please sign in to comment.