Skip to content
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
12 changes: 10 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,16 @@ trim_trailing_whitespace = true
[*.go]
indent_size = 4

[Makefile]
indent_style = tab
[justfile]
indent_size = 4

[*.just]
indent_size = 4

[*.sh]
indent_size = 4
tab_width = 4

[.githooks/*]
indent_size = 4
tab_width = 4
10 changes: 6 additions & 4 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

source "$(dirname -- "${BASH_SOURCE[0]}")/../scripts/logger.sh"

export PATH="$HOME/.local/bin:$PATH"

OUTPUT_FILE=""
WORK_DIR=""

Expand Down Expand Up @@ -50,7 +52,7 @@ step_format() {
}

step_lint() {
if make lint >"$OUTPUT_FILE" 2>&1; then
if just cli::lint >"$OUTPUT_FILE" 2>&1; then
return 0
fi

Expand All @@ -59,7 +61,7 @@ step_lint() {
}

step_terraform() {
if bash scripts/terraform.check.sh >"$OUTPUT_FILE" 2>&1; then
if just tf::validate >"$OUTPUT_FILE" 2>&1; then
return 0
fi

Expand All @@ -68,7 +70,7 @@ step_terraform() {
}

step_environment() {
if make env-check ENV_FILE=.env.dev.example >"$OUTPUT_FILE" 2>&1; then
if just env::check .env.dev.example >"$OUTPUT_FILE" 2>&1; then
return 0
fi

Expand All @@ -77,7 +79,7 @@ step_environment() {
}

step_manifests() {
if bash scripts/manifests.check.sh >"$OUTPUT_FILE" 2>&1; then
if just k8::validate >"$OUTPUT_FILE" 2>&1; then
return 0
fi

Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,27 @@ jobs:
go-version-file: go.mod
cache: true

- name: Install just
run: |
mkdir -p "$HOME/.local/bin"
release=https://github.com/casey/just/releases/download/1.59.0
archive=just-1.59.0-x86_64-unknown-linux-musl.tar.gz
curl -fsSL "$release/$archive" -o /tmp/just.tar.gz
curl -fsSL "$release/SHA256SUMS" -o /tmp/just-SHA256SUMS
grep " $archive$" /tmp/just-SHA256SUMS |
sed "s@ $archive@ /tmp/just.tar.gz@" |
sha256sum -c -
tar -xzf /tmp/just.tar.gz -C "$HOME/.local/bin" just
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Verify dependencies
run: go mod verify

- name: Check formatting
run: test -z "$(gofmt -l main.go cli)"

- name: Lint
run: make lint
run: just cli::lint

- name: Check vulnerabilities
run: go run golang.org/x/vuln/cmd/govulncheck@v1.9.0 ./...
Expand All @@ -85,6 +98,19 @@ jobs:
go-version-file: go.mod
cache: true

- name: Install just
run: |
mkdir -p "$HOME/.local/bin"
release=https://github.com/casey/just/releases/download/1.59.0
archive=just-1.59.0-x86_64-unknown-linux-musl.tar.gz
curl -fsSL "$release/$archive" -o /tmp/just.tar.gz
curl -fsSL "$release/SHA256SUMS" -o /tmp/just-SHA256SUMS
grep " $archive$" /tmp/just-SHA256SUMS |
sed "s@ $archive@ /tmp/just.tar.gz@" |
sha256sum -c -
tar -xzf /tmp/just.tar.gz -C "$HOME/.local/bin" just
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: Set up Helm
uses: azure/setup-helm@2f5e7bc67f1f9972ab16657bb795f36d8f04de0e
with:
Expand All @@ -99,10 +125,10 @@ jobs:
run: go install github.com/yannh/kubeconform/cmd/kubeconform@v0.8.0

- name: Validate environment configuration
run: make env-check ENV_FILE=.env.dev.example
run: just env::check .env.dev.example

- name: Validate Kubernetes configuration
run: bash scripts/manifests.check.sh
run: just k8::validate

terraform:
name: Terraform (${{ matrix.root }})
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ secrets/terraform/.output/
secrets/terraform/*.auto.tfvars
secrets/terraform/*.auto.tfvars.json

# Vault - generated locally on first `make up`, never committed:
# Vault - generated locally when the stand starts, never committed:
secrets/tls/
secrets/init-keys/

Expand Down
163 changes: 0 additions & 163 deletions Makefile

This file was deleted.

6 changes: 6 additions & 0 deletions bootstrap/microk8s/resources.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Unit]
Requires=var-lib-monadiam-microk8s-volumes.mount
After=var-lib-monadiam-microk8s-volumes.mount

[Service]
Slice=monadiam.slice
11 changes: 11 additions & 0 deletions bootstrap/microk8s/var-lib-monadiam-microk8s-volumes.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Unit]
Description=MonadIAM MicroK8s persistent volume pool

[Mount]
What=/var/lib/monadiam/microk8s-volumes.ext4
Where=/var/lib/monadiam/microk8s/volumes
Type=ext4
Options=loop,nodev,nosuid

[Install]
WantedBy=multi-user.target
3 changes: 3 additions & 0 deletions bootstrap/zot/var-lib-monadiam-zot.mount
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ What=/var/lib/monadiam/zot.ext4
Where=/var/lib/monadiam/zot
Type=ext4
Options=loop,nodev,nosuid,noexec

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion cli/platform/stand/clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (platform Platform) Clusters(ctx context.Context) error {
return err
}

_, err = platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=redis", "terraform-apply"}})
_, err = platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "redis"}})
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cli/platform/stand/networking.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func (platform Platform) CertManager(ctx context.Context) error {
_, err := platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=bootstrap", "terraform-apply"}})
_, err := platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "bootstrap"}})
return err
}

Expand All @@ -32,7 +32,7 @@ func (platform Platform) Istio(ctx context.Context) error {
return err
}

_, err = platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=istio", "terraform-apply"}})
_, err = platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "istio"}})
if err != nil {
return err
}
Expand All @@ -53,7 +53,7 @@ func (platform Platform) Gateway(ctx context.Context) error {
return err
}

_, err = platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=gateway", "terraform-apply"}})
_, err = platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "gateway"}})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cli/platform/stand/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (platform Platform) Operators(ctx context.Context) error {
return err
}

_, err = platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=operators", "terraform-apply"}})
_, err = platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "operators"}})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cli/platform/stand/seaweedfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (platform Platform) SeaweedFS(ctx context.Context) error {
}
}

_, err = platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=seaweedfs", "terraform-apply"}})
_, err = platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "seaweedfs"}})
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cli/platform/stand/vault.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (platform Platform) Vault(ctx context.Context) error {
}

func (platform Platform) installVault(ctx context.Context) error {
_, err := platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=vault-server", "terraform-apply"}})
_, err := platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "vault-server"}})
if err != nil {
return err
}
Expand All @@ -55,7 +55,7 @@ func (platform Platform) installVault(ctx context.Context) error {
}

func (platform Platform) installVaultOperator(ctx context.Context) error {
_, err := platform.Runner.Run(ctx, command.Request{Name: "make", Args: []string{"ROOT=vault-operator", "terraform-apply"}})
_, err := platform.Runner.Run(ctx, command.Request{Name: "just", Args: []string{"tf::apply", "vault-operator"}})
if err != nil {
return err
}
Expand Down
Loading
Loading