diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..7457664 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,16 @@ +--- +name: Bug Report +about: Report a bug +labels: kind/bug + +--- + +**What happened**: + +**What you expected to happen**: + +**How to reproduce it (as minimally and precisely as possible)**: + +**Anything else we need to know**: + +**Environment**: diff --git a/.github/ISSUE_TEMPLATE/enhancement_request.md b/.github/ISSUE_TEMPLATE/enhancement_request.md new file mode 100644 index 0000000..4179e17 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/enhancement_request.md @@ -0,0 +1,10 @@ +--- +name: Enhancement Request +about: Suggest an enhancement +labels: kind/enhancement + +--- + +**What would you like to be added**: + +**Why is this needed**: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..1fe33e5 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,20 @@ +**What this PR does / why we need it**: + +**Which issue(s) this PR fixes**: +Fixes # + +**Special notes for your reviewer**: + +**Release note**: + +```feature user + +``` diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..cb8b3d6 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,18 @@ +name: CI + +on: + push: + tags: + - v* + branches: + - master + - main + pull_request: + +permissions: + contents: read + +jobs: + build_validate_test: + uses: openmcp-project/build/.github/workflows/ci.lib.yaml@main + secrets: inherit diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..fdcd53c --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,15 @@ +name: Publish + +on: + push: + tags: + - v* + workflow_dispatch: + +permissions: + packages: write + +jobs: + release_publish: + uses: openmcp-project/build/.github/workflows/publish.lib.yaml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..bbdc43f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,15 @@ +name: Versioned Release + +on: + push: + branches: + - main + +permissions: + contents: write # we need this to be able to push tags + pull-requests: read + +jobs: + release_tag: + uses: openmcp-project/build/.github/workflows/release.lib.yaml@main + secrets: inherit diff --git a/.github/workflows/reuse.yaml b/.github/workflows/reuse.yaml new file mode 100644 index 0000000..aa0ba49 --- /dev/null +++ b/.github/workflows/reuse.yaml @@ -0,0 +1,11 @@ +name: REUSE Compliance Check + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + run_reuse: + uses: openmcp-project/build/.github/workflows/reuse.lib.yaml@main + secrets: inherit diff --git a/.github/workflows/validate-pr-content.yaml b/.github/workflows/validate-pr-content.yaml new file mode 100644 index 0000000..52a07c0 --- /dev/null +++ b/.github/workflows/validate-pr-content.yaml @@ -0,0 +1,15 @@ +name: Validate Pull Request Content + +on: + pull_request: + types: + - opened + - edited + +permissions: + contents: read + +jobs: + validate_pr_content: + uses: openmcp-project/build/.github/workflows/validate-pr-content.lib.yaml@main + secrets: inherit \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1406b72 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ + + +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib +bin/ +Dockerfile.cross + +# Test binary, build with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Kubernetes Generated files - skip generated files, except for vendored files + +!vendor/**/zz_generated.* + +# editor and IDE paraphernalia +.idea +.vscode +*.swp +*.swo +*~ + +tmp/ +go.work* +components/ +!**/components/ +/**/cover.html +/**/cover.*.html + +*.tmp +.task/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c0425ec --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "hack/common"] + path = hack/common + url = https://github.com/openmcp-project/build diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 0000000..9a69a7f --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,46 @@ +version: "2" +run: + allow-parallel-runners: true +linters: + default: none + enable: + - copyloopvar + - dupl + - errcheck + - ginkgolinter + - goconst + - gocyclo + - govet + - ineffassign + - misspell + - nakedret + - prealloc + - revive + - staticcheck + - unconvert + - unparam + - unused + settings: + revive: + rules: + - name: comment-spacings + exclusions: + generated: lax + rules: + - linters: + - dupl + path: internal/* + paths: + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - third_party$ + - builtin$ + - examples$ diff --git a/Makefile b/Makefile new file mode 120000 index 0000000..c21893a --- /dev/null +++ b/Makefile @@ -0,0 +1 @@ +./hack/common/Makefile \ No newline at end of file diff --git a/README.md b/README.md index acca88d..ad6fd83 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,20 @@ The openmcp bootstrapper is a command line tool that is able to set up an openmc ## Requirements and Setup -*Insert a short description what is required to get your project running...* +This project uses the [cobra library](https://github.com/spf13/cobra) for command line parsing. +To install the `cobra-cli`, call the following command: + +```shell +go install github.com/spf13/cobra-cli@latest +``` + +To add a new command, run the following command in the root directory of this project: + +```shell +cobra-cli add +``` + +See more details in the [cobra-cli documentation](https://github.com/spf13/cobra-cli/blob/main/README.md) ## Support, Feedback, Contributing diff --git a/Taskfile.yaml b/Taskfile.yaml new file mode 100644 index 0000000..95d3144 --- /dev/null +++ b/Taskfile.yaml @@ -0,0 +1,16 @@ +version: 3 + +includes: + shared: + taskfile: hack/common/Taskfile_controller.yaml + flatten: true + excludes: [] # put task names in here which are overwritten in this file + vars: + NESTED_MODULES: '' + API_DIRS: '' + MANIFEST_OUT: '' + CODE_DIRS: '{{.ROOT_DIR}}/cmd/...' + COMPONENTS: 'openmcp-bootstrapper' + REPO_URL: 'https://github.com/openmcp-project/bootstrapper' + GENERATE_DOCS_INDEX: "true" + CHART_COMPONENTS: "[]" diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..e3e41a5 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v0.0.1-dev \ No newline at end of file diff --git a/cmd/openmcp-bootstrapper/main.go b/cmd/openmcp-bootstrapper/main.go new file mode 100644 index 0000000..1acb0bb --- /dev/null +++ b/cmd/openmcp-bootstrapper/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/openmcp-project/bootstrapper/cmd" + +func main() { + cmd.Execute() +} diff --git a/cmd/root.go b/cmd/root.go new file mode 100644 index 0000000..f640773 --- /dev/null +++ b/cmd/root.go @@ -0,0 +1,43 @@ +package cmd + +import ( + "os" + + "github.com/spf13/cobra" +) + +// rootCmd represents the base command when called without any subcommands +var rootCmd = &cobra.Command{ + Use: "bootstrapper", + Short: "A brief description of your application", + Long: `A longer description that spans multiple lines and likely contains +examples and usage of using your application. For example: + +Cobra is a CLI library for Go that empowers applications. +This application is a tool to generate the needed files +to quickly create a Cobra application.`, + // Uncomment the following line if your bare application + // has an action associated with it: + // Run: func(cmd *cobra.Command, args []string) { }, +} + +// Execute adds all child commands to the root command and sets flags appropriately. +// This is called by main.main(). It only needs to happen once to the rootCmd. +func Execute() { + err := rootCmd.Execute() + if err != nil { + os.Exit(1) + } +} + +func init() { + // Here you will define your flags and configuration settings. + // Cobra supports persistent flags, which, if defined here, + // will be global for your application. + + // rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bootstrapper.yaml)") + + // Cobra also supports local flags, which will only run + // when this action is called directly. + rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle") +} diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..a3c6441 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,3 @@ + +# Documentation Index + diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..2946cb0 --- /dev/null +++ b/go.mod @@ -0,0 +1,10 @@ +module github.com/openmcp-project/bootstrapper + +go 1.24.5 + +require github.com/spf13/cobra v1.9.1 + +require ( + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/spf13/pflag v1.0.7 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..4aae07f --- /dev/null +++ b/go.sum @@ -0,0 +1,11 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt new file mode 100644 index 0000000..221dcbe --- /dev/null +++ b/hack/boilerplate.go.txt @@ -0,0 +1,15 @@ +/* +Copyright 2025. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ \ No newline at end of file diff --git a/hack/common b/hack/common new file mode 160000 index 0000000..68a2b00 --- /dev/null +++ b/hack/common @@ -0,0 +1 @@ +Subproject commit 68a2b00b04600e6f58c15a69e0c8db3af6d7242c diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..b81e603 --- /dev/null +++ b/renovate.json @@ -0,0 +1,40 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "git-submodules": { + "enabled": true + }, + "minimumReleaseAge": "3 days", + "extends": [ + "config:recommended", + "config:best-practices", + "security:openssf-scorecard", + "helpers:pinGitHubActionDigests", + ":rebaseStalePrs" + ], + "postUpdateOptions": [ + "gomodTidy" + ], + "packageRules": [ + { + "matchManagers": [ + "gomod" + ], + "matchDepNames": [ + "go" + ], + "matchDepTypes": [ + "golang" + ], + "rangeStrategy": "bump" + }, + { + "matchPackageNames": [ + "github.com/openmcp-project/*" + ], + "description": "Update all components from openmcp-project immediately", + "rebaseWhen": "auto", + "minimumReleaseAge": "0 days", + "enabled": true + } + ] +}