Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into flakery
Browse files Browse the repository at this point in the history
  • Loading branch information
Zebradil committed Jan 30, 2025
2 parents 61cb4cf + 0f0f8bb commit 029b962
Show file tree
Hide file tree
Showing 44 changed files with 475 additions and 267 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check-links-quickly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Restore lychee cache
id: restore-cache
uses: actions/cache/restore@v4
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- name: Run lychee
uses: lycheeverse/lychee-action@v1.10.0
uses: lycheeverse/lychee-action@f796c8b7d468feb9b8c0a46da3fac0af6874d374 # v2.2.0
with:
fail: true
args: "--base . --verbose --no-progress --cache --max-cache-age 3d 'docs/**/*.md'"

- name: Save lychee cache
uses: actions/cache/save@v4
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
if: always()
with:
path: .lycheecache
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/check-links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,31 @@ jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4

- name: Restore lychee cache
id: restore-cache
uses: actions/cache/restore@v4
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

- name: Run lychee
uses: lycheeverse/lychee-action@v1.10.0
uses: lycheeverse/lychee-action@f796c8b7d468feb9b8c0a46da3fac0af6874d374 # v2.2.0
with:
args: "--base . --verbose --no-progress --cache --max-cache-age 3d 'docs/**/*.md'"

- name: Save lychee cache
uses: actions/cache/save@v4
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
if: always()
with:
path: .lycheecache
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

- name: Create Issue From File
if: env.lychee_exit_code != 0
uses: peter-evans/create-issue-from-file@v5
uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/flow-pr-meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
validate-title:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
- uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
Expand All @@ -39,7 +39,7 @@ jobs:
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728 # v2
with:
header: pr-title-lint-error
delete: true
16 changes: 8 additions & 8 deletions .github/workflows/job-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "job-lint"
name: 'job-lint'

on:
workflow_call:
Expand All @@ -8,22 +8,22 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
with:
go-version: "1.22"
cache: false
go-version-file: go.mod
- name: Install gofumpt
uses: jaxxstorm/action-install-gh-release@v1.12.0
uses: jaxxstorm/action-install-gh-release@cd6b2b78ad38bdd294341cda064ec0692b06215b # v1.14.0
with:
repo: mvdan/gofumpt
tag: v0.5.0
cache: enable
extension-matching: nah
rename-to: gofumpt
chmod: 0700
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check code formatting
run: |
set -euo pipefail
Expand All @@ -34,4 +34,4 @@ jobs:
) \
| tee /dev/stderr \
| test $(wc -l) -eq 0
- uses: golangci/golangci-lint-action@v6
- uses: golangci/golangci-lint-action@ec5d18412c0aeab7936cb16880d708ba2a64e1ae # v6
18 changes: 8 additions & 10 deletions .github/workflows/job-test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: "job-test"
name: 'job-test'

on:
workflow_call:
Expand All @@ -9,25 +9,23 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5
with:
go-version: "1.22"
go-version-file: go.mod
- name: Build myks
run: go install .
- name: Test
run:
go test -failfast -race -coverpkg=./... -covermode=atomic
-coverprofile=coverage.txt ./...
run: go test -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./...
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
file: ./coverage.txt
- uses: goreleaser/goreleaser-action@v6
files: ./coverage.txt
- uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6
with:
version: latest
args: build --snapshot --clean
1 change: 1 addition & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
proseWrap: always
singleQuote: true
66 changes: 66 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,71 @@
# Changelog

## [4.4.0](https://github.com/mykso/myks/compare/v4.3.2...v4.4.0) (2025-01-28)


### Features

* add argocd.project.enabled option ([753ad11](https://github.com/mykso/myks/commit/753ad1112e9331cec7ae2b976a01f10a86add058))


### Bug Fixes

* skip creation of empty ArgoCD environment file ([dfcb78b](https://github.com/mykso/myks/commit/dfcb78b7f87d475e94c02c4008b8da709402636d))
* sort ArgoCD Application YAML ([600cfa9](https://github.com/mykso/myks/commit/600cfa9feda23c5455db799ff917a6a96e253d76))
* use argocd.project.name if set ([8e0fabd](https://github.com/mykso/myks/commit/8e0fabd4b107af4cffa733fce9463cb6da34a7b9))

## [4.3.2](https://github.com/mykso/myks/compare/v4.3.1...v4.3.2) (2025-01-27)


### Bug Fixes

* ensure buildDependencies is nullable ([#378](https://github.com/mykso/myks/issues/378)) ([4e65a3e](https://github.com/mykso/myks/commit/4e65a3ea59ec2429b18b0ae1434f514ae23c9f09))

## [4.3.1](https://github.com/mykso/myks/compare/v4.3.0...v4.3.1) (2025-01-23)


### Bug Fixes

* **deps:** update module github.com/alecthomas/chroma/v2 to v2.15.0 ([#370](https://github.com/mykso/myks/issues/370)) ([1916955](https://github.com/mykso/myks/commit/19169557ed40f7dc561dbd52db5d518b7e4a4d01))
* **deps:** update module golang.org/x/term to v0.28.0 ([#368](https://github.com/mykso/myks/issues/368)) ([cb36943](https://github.com/mykso/myks/commit/cb369437cf77cf4bb939a72115fa79e4c9e7e247))
* make per-chart helm options nullable ([#374](https://github.com/mykso/myks/issues/374)) ([4fd9713](https://github.com/mykso/myks/commit/4fd9713374519dec6593808b325480b4e7655dff))

## [4.3.0](https://github.com/mykso/myks/compare/v4.2.6...v4.3.0) (2025-01-01)


### Features

* allow multiple files for app and env-data on each level ([#366](https://github.com/mykso/myks/issues/366)) ([3b2f68f](https://github.com/mykso/myks/commit/3b2f68f382a32c18297dc9b612f21a2a4c6cb250))

## [4.2.6](https://github.com/mykso/myks/compare/v4.2.5...v4.2.6) (2024-12-27)


### Bug Fixes

* **deps:** update module carvel.dev/ytt to v0.51.1 ([#358](https://github.com/mykso/myks/issues/358)) ([e339a90](https://github.com/mykso/myks/commit/e339a90bf6fb0f38b883d44cfd9515e206f31926))
* **docs:** overhaul help messages ([#362](https://github.com/mykso/myks/issues/362)) ([aa1f941](https://github.com/mykso/myks/commit/aa1f941d13dc341ec5f58c6e1f1a7cc684ff3a6e))
* skip ArgoCD Application plugin if not set ([#365](https://github.com/mykso/myks/issues/365)) ([302667e](https://github.com/mykso/myks/commit/302667e607d5b7730b1dd28d5aca2cd584de53a8))

## [4.2.5](https://github.com/mykso/myks/compare/v4.2.4...v4.2.5) (2024-12-10)


### Bug Fixes

* **deps:** update module carvel.dev/vendir to v0.43.0 ([#357](https://github.com/mykso/myks/issues/357)) ([ebf51cd](https://github.com/mykso/myks/commit/ebf51cdc5ed433a3440e0c8082648e7295a198a6))
* **deps:** update module github.com/stretchr/testify to v1.10.0 ([#351](https://github.com/mykso/myks/issues/351)) ([a47b2ed](https://github.com/mykso/myks/commit/a47b2ed3fa1d77d49153a47246c5e09704919514))
* **deps:** update module golang.org/x/sync to v0.10.0 ([#354](https://github.com/mykso/myks/issues/354)) ([7ed5e20](https://github.com/mykso/myks/commit/7ed5e20a8f01ba373ccd70c6761f4d77a9d1cd1a))
* **deps:** update module golang.org/x/sync to v0.9.0 ([#345](https://github.com/mykso/myks/issues/345)) ([3abe265](https://github.com/mykso/myks/commit/3abe2650a586f83dc5417f7a63107bf0dee10743))
* **deps:** update module golang.org/x/term to v0.26.0 ([#346](https://github.com/mykso/myks/issues/346)) ([edd9944](https://github.com/mykso/myks/commit/edd994416da29ba288dbf79a788aff2c6f317cae))
* **deps:** update module golang.org/x/term to v0.27.0 ([#355](https://github.com/mykso/myks/issues/355)) ([78fe9b1](https://github.com/mykso/myks/commit/78fe9b1cb6dd17004e54cbfd81ee19fa42337fdb))

## [4.2.4](https://github.com/mykso/myks/compare/v4.2.3...v4.2.4) (2024-11-07)


### Bug Fixes

* **deps:** update module carvel.dev/ytt to v0.51.0 ([#342](https://github.com/mykso/myks/issues/342)) ([836e1fd](https://github.com/mykso/myks/commit/836e1fda537aefb1d66a7e0c3e5146529df9d09a))
* **deps:** update module golang.org/x/term to v0.25.0 ([#338](https://github.com/mykso/myks/issues/338)) ([b94de99](https://github.com/mykso/myks/commit/b94de998a349113a66feab8793ea8906d9449374))

## [4.2.3](https://github.com/mykso/myks/compare/v4.2.2...v4.2.3) (2024-09-11)


Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FROM downloader AS helm
ARG TARGETOS
ARG TARGETARCH
# renovate: datasource=github-releases depName=helm/helm
ARG HELM_VERSION=v3.16.1
ARG HELM_VERSION=v3.17.0
RUN curl -fsSL \
https://get.helm.sh/helm-${HELM_VERSION}-${TARGETOS}-${TARGETARCH}.tar.gz \
| tar -xzf - --strip-components=1 ${TARGETOS}-${TARGETARCH}/helm
Expand Down
3 changes: 2 additions & 1 deletion cmd/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import (
var allCmd = &cobra.Command{
Use: "all",
Short: "Run sync and render",
Long: "Run sync and render",
Long: "Run sync and render for specified environments and applications",
Args: cobra.RangeArgs(0, 2),
Annotations: map[string]string{
ANNOTATION_SMART_MODE: ANNOTATION_TRUE,
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
var renderCmd = &cobra.Command{
Use: "render",
Short: "Render manifests",
Long: "Render manifests",
Long: "Render manifests for specified environments and applications",
Annotations: map[string]string{
ANNOTATION_SMART_MODE: ANNOTATION_TRUE,
},
Expand Down
85 changes: 72 additions & 13 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,97 @@ var (
asyncLevel int
)

// Use this template for commands that accept environment and application arguments
const envAppCommandUsageTemplate = `Usage:
{{.CommandPath}} [environments [applications]] [flags]
Arguments:
0. When no arguments are provided, myks uses the Smart Mode to determine the environments and applications to process.
In Smart Mode, myks relies on git to only processes applications with changes.
1. environments (Optional) Comma-separated list of environments or ALL
ALL will process all environments
Examples: ALL
prod,stage,dev
prod/region1,stage/region1
dev
2. applications (Optional) Comma-separated list of applications or ALL
ALL will process all applications
Example: app1,app2 or ALL
{{if .HasAvailableFlags}}Flags:
{{.Flags.FlagUsages | trimTrailingWhitespaces}}{{end}}
Examples:
# Process all apps in production and staging
{{.CommandPath}} prod,stage ALL
# Process specific apps in all environments
{{.CommandPath}} ALL app1,app2
# Process specific apps in specific environments
{{.CommandPath}} prod,stage app1,app2
`

func NewMyksCmd(version, commit, date string) *cobra.Command {
cobra.OnInitialize(initLogger)
zerolog.SetGlobalLevel(zerolog.InfoLevel)
cmd := newRootCmd(version, commit, date)
cmd.AddCommand(allCmd)
cmd.AddCommand(renderCmd)
cmd.AddCommand(syncCmd)
cmd.AddCommand(newCleanupCmd())
cmd.AddCommand(newInitCmd())
cmd.AddCommand(newPrintConfigCmd())
cmd.AddCommand(newSyncCmd())
cmd.AddCommand(embedded.EmbeddedCmd("vendir", "Vendir is embedded in myks to manage vendir.yaml files."))
cmd.AddCommand(embedded.EmbeddedCmd("ytt", "Ytt is embedded in myks to manage yaml files."))
initConfig()
addPlugins(cmd)

allCmd.SetUsageTemplate(envAppCommandUsageTemplate)
renderCmd.SetUsageTemplate(envAppCommandUsageTemplate)
syncCmd.SetUsageTemplate(envAppCommandUsageTemplate)

return cmd
}

func newRootCmd(version, commit, date string) *cobra.Command {
rootCmd := &cobra.Command{
Use: "myks",
Short: "Myks helps to manage configuration for kubernetes clusters",
Long: `Myks fetches K8s workloads from a variety of sources, e.g. Helm charts or Git Repositories. It renders their respective yaml files to the file system in a structure of environments and their applications.
It supports prototype applications that can be shared between environments and inheritance of configuration from parent environments to their "children".
Myks supports two positional arguments:
- A comma-separated list of environments to render. If you provide "ALL", all environments will be rendered.
- A comma-separated list of applications to render. If you don't provide this argument or provide "ALL", all applications will be rendered.
If you do not provide any positional arguments, myks will run in "Smart Mode". In Smart Mode, myks will only render environments and applications that have changed since the last run.
`,
Short: "Myks generates Kubernetes manifests",
// TODO: Launch the documentation website and add a link here
Long: `
Myks - Kubernetes Manifest Generator
OVERVIEW
Myks simplifies Kubernetes manifest management through a standardized toolset
and GitOps-ready conventions.
CORE FEATURES
• External source management (via vendir)
• Helm chart rendering
• YAML templating and validation (via ytt)
• Idempotent output
• Automatic ArgoCD resource generation
• Environment-based configuration inheritance
• Intelligent change detection
BASIC COMMANDS
init Create a new Myks project in the current directory
sync Download external dependencies
render Generate Kubernetes manifests
all Perform sync and render in one step
GETTING STARTED
1. Create a new project: myks init
2. Download dependencies: myks sync
3. Generate manifests: myks render
LEARN MORE
• Use 'myks <command> --help' for detailed information about a command
• Report issues at https://github.com/example/myks/issues
`,
}

rootCmd.Version = fmt.Sprintf(`%s
Expand Down
Loading

0 comments on commit 029b962

Please sign in to comment.