diff --git a/.github/.stale.yaml b/.github/.stale.yaml new file mode 100644 index 00000000..8fa812eb --- /dev/null +++ b/.github/.stale.yaml @@ -0,0 +1,16 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 30 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 14 +# Issues with these labels will never be considered stale +exemptLabels: + - frozen +staleLabel: stale +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Any further update will + cause the issue/pull request to no longer be considered stale. Thank you for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: > + This issue is being automatically closed due to inactivity. diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 00000000..d95b0554 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,54 @@ +name: Bug Report +description: File a bug report +labels: [bug] +body: + - type: markdown + id: preface + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: markdown + id: environment + attributes: + value: "## Environment" + - type: input + id: version + validations: + required: true + attributes: + label: What is version of KubeKey has the issue? + description: "You can use the command to get `./kk version`" + - type: input + id: os + validations: + required: true + attributes: + label: What is your os environment? + description: "e.g. Ubuntu 16.04" + - type: textarea + id: config + attributes: + label: KubeKey config file + description: "If applicable, add the KubeKey config file content to help explain your problem." + render: yaml + - type: markdown + id: main + attributes: + value: "## Main" + - type: textarea + id: what + validations: + required: true + attributes: + label: A clear and concise description of what happend. + - type: textarea + id: logs + attributes: + label: "Relevant log output" + description: "Please copy and paste any relevant log output." + render: shell + - type: textarea + id: additional-information + attributes: + label: "Additional information" + description: "Add any other context about the information here (screenshots, video, etc.)." \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/custom.yaml b/.github/ISSUE_TEMPLATE/custom.yaml new file mode 100644 index 00000000..09e153b2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.yaml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Any other questions about KubeKey + url: https://kubesphere.slack.com/ + about: If you have any other questions, you can join our slack channel. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 00000000..34d4ff1a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,38 @@ +name: Feature Request +description: File a feature request +body: + - type: markdown + id: preface + attributes: + value: "Thank you for submitting new features for KubeKey." + - type: markdown + id: environment + attributes: + value: "## Environment" + - type: input + id: version + attributes: + label: "Your current KubeKey version" + description: "You can use the command to get `./kk version`" + - type: markdown + id: main + attributes: + value: "## Main" + - type: textarea + id: description + attributes: + label: "Describe this feature" + validations: + required: true + - type: textarea + id: solution + attributes: + label: "Describe the solution you'd like" + description: "You can have a concise description of any alternative solutions or ideas you've considered." + validations: + required: true + - type: textarea + id: additional-information + attributes: + label: "Additional information" + description: "Add any other context about the information here (screenshots, video, etc.)." \ No newline at end of file diff --git a/.github/OWNERS b/.github/OWNERS new file mode 100644 index 00000000..5cc21bae --- /dev/null +++ b/.github/OWNERS @@ -0,0 +1,17 @@ +approvers: + - pixiake + - rayzhou2017 + - LinuxSuRen + - ImitationImmortal + +reviewers: + - pixiake + - rayzhou2017 + - zryfish + - benjaminhuo + - calvinyv + - FeynmanZhou + - huanggze + - wansir + - LinuxSuRen + - ImitationImmortal diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..97b13092 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,64 @@ + + +### What type of PR is this? + + + +### What this PR does / why we need it: + +### Which issue(s) this PR fixes: + +Fixes # + +### Special notes for reviewers: +``` +``` + +### Does this PR introduced a user-facing change? + +```release-note + +``` + +### Additional documentation, usage docs, etc.: + +```docs + +``` diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..bcb619ec --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + pull-request-branch-name: + separator: "-" + - package-ecosystem: "gomod" + directory: "/" + schedule: + interval: "daily" + pull-request-branch-name: + separator: "-" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..f101c1f7 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,41 @@ +# Configuration for Release Drafter: https://github.com/toolmantim/release-drafter +name-template: 'v$NEXT_PATCH_VERSION 🌈' +tag-template: 'v$NEXT_PATCH_VERSION' +version-template: $MAJOR.$MINOR.$PATCH +# Emoji reference: https://gitmoji.carloscuesta.me/ +categories: + - title: 'πŸš€ Features' + labels: + - 'feature' + - 'enhancement' + - 'kind/feature' + - title: 'πŸ› Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - 'regression' + - 'kind/bug' + - title: πŸ“ Documentation updates + labels: + - 'documentation' + - 'kind/documentation' + - title: πŸ‘» Maintenance + labels: + - chore + - dependencies + - 'kind/cleanup' + - title: 🚦 Tests + labels: + - test + - tests +exclude-labels: + - reverted + - no-changelog + - skip-changelog + - invalid +change-template: '* $TITLE (#$NUMBER) @$AUTHOR' +template: | + ## What’s Changed + + $CHANGES diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 00000000..a412237e --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,68 @@ +repository: + name: kubekey + description: "KubeKey provides a flexible, rapid and convenient way to install Kubernetes only, both Kubernetes and KubeSphere, and related cloud-native add-ons. It is also an efficient tool to scale and upgrade your cluster." + homepage: https://kubesphere.io/ + private: false + has_issues: true + has_wiki: false + has_downloads: false + default_branch: master + allow_squash_merge: true + allow_merge_commit: true + allow_rebase_merge: true +labels: + - name: newbie + color: abe7f4 + description: These're friendly issues for new comers + - name: bug + color: d73a4a + description: Something isn't working + - name: feature + color: ffc6a3 + - name: enhancement + color: a2eeef + description: New feature or request + - name: help wanted + color: 008672 + description: Extra attention is needed + - name: bugfix + color: 0412d6 + - name: regression + color: c5def5 + - name: documentation + color: 5ce05e + - name: Hacktoberfest + description: More details from https://hacktoberfest.digitalocean.com/ + color: 5ce05e + - name: test + color: c2c2fc + - name: chore + color: c2c2fc + - name: dependencies + color: 0366d6 + description: Pull requests that update a dependency file + - name: no-changelog + color: c2c2fc + - name: priority-high + color: D93F0B + - name: priority-medium + color: FBCA04 + - name: priority-low + color: 006B75 +branches: + - name: master + protection: + required_pull_request_reviews: + required_approving_review_count: 1 + dismiss_stale_reviews: true + require_code_owner_reviews: true + dismissal_restrictions: + users: [] + teams: [] + required_status_checks: + strict: true + contexts: [] + enforce_admins: false + restrictions: + users: [] + teams: [] diff --git a/.github/workflows/build-multiarch.yaml b/.github/workflows/build-multiarch.yaml new file mode 100644 index 00000000..cebf7a33 --- /dev/null +++ b/.github/workflows/build-multiarch.yaml @@ -0,0 +1,65 @@ +name: BuildContainerImage + +on: + push: + tags: + - 'v4*' + +jobs: + build: + name: Build + runs-on: ubuntu-latest + if: github.repository == 'kubesphere/kubekey' + env: + GO111MODULE: on + steps: + - name: Prepare + id: prepare + run: | + VERSION=latest + + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Checkout code + uses: actions/checkout@v3 + + - name: Login to Aliyun + uses: docker/login-action@v3 + with: + registry: registry.cn-beijing.aliyuncs.com + username: ${{ secrets.ALIYUNCS_USERNAME }} + password: ${{ secrets.ALIYUNCS_PASSWORD }} + + - name: Login to Hub_Kubesphere + uses: docker/login-action@v3 + with: + registry: hub.kubesphere.com.cn + username: ${{ secrets.HUB_KUBESPHERE_USERNAME }} + password: ${{ secrets.HUB_KUBESPHERE_PASSWORD }} + + - name: Login to DOCKER + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: Set up Docker buildx + uses: docker/setup-buildx-action@v3 + + + - name: Build and push Docker images + run: | + tag=${{ steps.prepare.outputs.version }} + if [[ $tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + REGISTRY=docker.io/kubesphere TAG=$tag make docker-build + else + REGISTRY=docker.io/kubespheredev TAG=$tag make docker-build + fi diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 00000000..c3544980 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,41 @@ +name: goreleaser + +on: + push: + tags: + - 'v4*' + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + if: github.repository == 'kubesphere/kubekey' + steps: + - name: Prepare + id: prepare + run: | + LDFLAGS=$(shell hack/version.sh) + + echo "ldflags=${LDFLAGS}" >> "$GITHUB_OUTPUT" + + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: 1.21 + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: ${{ env.GITHUB_REF_NAME }} + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LDFLAGS: ${{ steps.prepare.outputs.ldflags }} diff --git a/.goreleaser.yml b/.goreleaser.yml new file mode 100644 index 00000000..4af8d410 --- /dev/null +++ b/.goreleaser.yml @@ -0,0 +1,33 @@ +env: + - GO111MODULE=on + - CGO_ENABLED=0 + +before: + hooks: + - go mod tidy + +builds: + - main: ./cmd/kk/kubekey.go + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + binary: kubekey + ldflags: "{{ .Env.LDFLAGS }}" + flags: + - builtin + +archives: + - name_template: "{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - none* + + +release: + prerelease: auto + +universal_binaries: + - replace: true diff --git a/Makefile b/Makefile index fa3286e7..ce0c72f4 100644 --- a/Makefile +++ b/Makefile @@ -89,10 +89,11 @@ DOCKERCMD ?= $(shell which docker) DOCKER_BUILD_ENV = DOCKER_BUILDKIT=1 DOCKER_BUILD ?= $(DOCKER_BUILD_ENV) $(DOCKERCMD) buildx build PLATFORM ?= linux/amd64,linux/arm64 -DOCKER_PUSH ?= $(DOCKER_BUILD) --platform $(PLATFORM) --push +DOCKER_OUT_TYPE ?= --push +DOCKER_PUSH ?= $(DOCKER_BUILD) --platform $(PLATFORM) $(DOCKER_OUT_TYPE) # Define Docker related variables. Releases should modify and double check these vars. -REGISTRY ?= hub.kubesphere.com.cn/kubekey +REGISTRY ?= docker.io/kubespheredev #REGISTRY ?= docker.io/kubespheredev #PROD_REGISTRY ?= docker.io/kubesphere diff --git a/OWNERS b/OWNERS index dd18c95f..d75890f9 100644 --- a/OWNERS +++ b/OWNERS @@ -2,7 +2,7 @@ approvers: - pixiake - 24sama - rayzhou2017 - - littleBlackHouse + - ImitationImmortal reviewers: - pixiake @@ -15,4 +15,4 @@ reviewers: - wansir - LinuxSuRen - 24sama - - littleBlackHouse + - ImitationImmortal