From 188a9b965d35441c9b598e41ad7ffa34e0be7b27 Mon Sep 17 00:00:00 2001 From: Nicolas Lamirault Date: Fri, 1 Oct 2021 15:20:40 +0200 Subject: [PATCH] Add: Configure CICD and precommit Signed-off-by: Nicolas Lamirault --- .github/ISSUE_TEMPLATE/bug_report.md | 27 ++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++ .github/actions/tools/Dockerfile | 33 +++++++++ .github/actions/tools/action.yml | 23 +++++++ .github/actions/tools/entrypoint.sh | 44 ++++++++++++ .github/issue_label_bot.yaml | 18 +++++ .github/labeler.yml | 62 +++++++++++++++++ .github/labels.yaml | 82 ++++++++++++++++++++++ .github/release-drafter.yml | 58 ++++++++++++++++ .github/renovate.json5 | 83 +++++++++++++++++++++++ .github/stale.yml | 32 +++++++++ .github/workflows/draft-labels.yml | 30 ++++++++ .github/workflows/prow-labels.yml | 40 +++++++++++ .github/workflows/prow-lgtm-merge.yml | 31 +++++++++ .github/workflows/prow-lgtm-pull.yml | 25 +++++++ .github/workflows/prow.yml | 43 ++++++++++++ .github/workflows/rebase.yml | 33 +++++++++ .github/workflows/release-drafter.yml | 33 +++++++++ .github/workflows/renovate.yml | 47 +++++++++++++ .github/workflows/size.yaml | 38 +++++++++++ .pre-commit-config.yaml | 50 ++++++++++++++ hack/config/licence.txt | 13 ++++ 22 files changed, 865 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/actions/tools/Dockerfile create mode 100644 .github/actions/tools/action.yml create mode 100644 .github/actions/tools/entrypoint.sh create mode 100644 .github/issue_label_bot.yaml create mode 100644 .github/labeler.yml create mode 100644 .github/labels.yaml create mode 100644 .github/release-drafter.yml create mode 100644 .github/renovate.json5 create mode 100644 .github/stale.yml create mode 100644 .github/workflows/draft-labels.yml create mode 100644 .github/workflows/prow-labels.yml create mode 100644 .github/workflows/prow-lgtm-merge.yml create mode 100644 .github/workflows/prow-lgtm-pull.yml create mode 100644 .github/workflows/prow.yml create mode 100644 .github/workflows/rebase.yml create mode 100644 .github/workflows/release-drafter.yml create mode 100644 .github/workflows/renovate.yml create mode 100644 .github/workflows/size.yaml create mode 100644 .pre-commit-config.yaml create mode 100644 hack/config/licence.txt diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..1cf147e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: kind/bug, needs/cloud, needs/priority, needs/triage +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Configuration (please complete the following information):** + - Kubernetes: [e.g. GKE] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/actions/tools/Dockerfile b/.github/actions/tools/Dockerfile new file mode 100644 index 0000000..afe6eb0 --- /dev/null +++ b/.github/actions/tools/Dockerfile @@ -0,0 +1,33 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +FROM alpine:3.14 + +LABEL maintainer="Nicolas Lamirault " \ + org.opencontainers.image.title="Tools for Portefaix project" \ + org.opencontainers.image.description="Tools from the Kubernetes ecosystem" \ + org.opencontainers.image.authors="Nicolas Lamirault " \ + org.opencontainers.image.vendor="Portefaix" \ + org.opencontainers.image.documentation="https://github.com/portefaix/portefaix" \ + org.opencontainers.image.licenses="Apache 2.0" \ + org.opencontainers.image.url="https://github.com/portefaix/portefaix" \ + org.opencontainers.image.source="https://github.com/portefaix/portefaix" \ + org.opencontainers.image.version="0.1.0" + +RUN apk add --no-cache ca-certificates curl bash tar jq + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/.github/actions/tools/action.yml b/.github/actions/tools/action.yml new file mode 100644 index 0000000..da5dd81 --- /dev/null +++ b/.github/actions/tools/action.yml @@ -0,0 +1,23 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: 'portefaix' +description: 'A GitHub Action with tools from the Kubernetes echosystem' +author: 'Nicolas Lamirault' +branding: + icon: 'command' + color: 'blue' +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/tools/entrypoint.sh b/.github/actions/tools/entrypoint.sh new file mode 100644 index 0000000..acb372e --- /dev/null +++ b/.github/actions/tools/entrypoint.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +set -eu + +YQ_VERSION="v4.6.1" +KUSTOMIZE_VERSION="4.1.3" +KUBEVAL_VERSION="0.15.0" +KUBECONFORM_VERSION="v0.4.7" +OPA_VERSION="v0.28.0" +CONFTEST_VERSION="0.25.0" +JB_VERSION="v0.4.0" + + +mkdir -p "${GITHUB_WORKSPACE}/bin" +cd "${GITHUB_WORKSPACE}/bin" + +curl -sL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" -o yq +chmod +x "${GITHUB_WORKSPACE}/bin/yq" + +kustomize_url="https://github.com/kubernetes-sigs/kustomize/releases/download" && \ +curl -sL "${kustomize_url}/kustomize%2Fv${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_linux_amd64.tar.gz" | \ +tar xz +chmod +x "${GITHUB_WORKSPACE}/bin/kustomize" + +curl -sL "https://github.com/instrumenta/kubeval/releases/download/${KUBEVAL_VERSION}/kubeval-linux-amd64.tar.gz" | \ +tar xz +chmod +x "${GITHUB_WORKSPACE}/bin/kubeval" + +curl -sL "https://github.com/yannh/kubeconform/releases/download/${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" | \ +tar xz +chmod +x "${GITHUB_WORKSPACE}/bin/kubeconform" + +curl -sL "https://github.com/open-policy-agent/opa/releases/download/${OPA_VERSION}/opa_linux_amd64" -o opa +chmod +x "${GITHUB_WORKSPACE}/bin/opa" + +curl -sL "https://github.com/open-policy-agent/conftest/releases/download/v${CONFTEST_VERSION}/conftest_${CONFTEST_VERSION}_Linux_x86_64.tar.gz" | \ +tar xz +chmod +x "${GITHUB_WORKSPACE}/bin/conftest" + +curl -sL "https://github.com/jsonnet-bundler/jsonnet-bundler/releases/download/${JB_VERSION}/jb-linux-amd64" -o jb +chmod +x "${GITHUB_WORKSPACE}/bin/jb" + +echo "${GITHUB_WORKSPACE}/bin" >> "${GITHUB_PATH}" +echo "$RUNNER_WORKSPACE/$(basename "${GITHUB_REPOSITORY}")/bin" >> "${GITHUB_PATH}" diff --git a/.github/issue_label_bot.yaml b/.github/issue_label_bot.yaml new file mode 100644 index 0000000..eae2b86 --- /dev/null +++ b/.github/issue_label_bot.yaml @@ -0,0 +1,18 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +label-alias: + bug: 'kind/bug' + feature_request: 'kind/feature' + question: 'kind/question' diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..5518d42 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,62 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +# Labels for action/labeler + +area/kubernetes: + - kubernetes/* + - kubernetes/**/* + +cloud/gcp: + - iac/gcp/* + - iac/gcp/**/* + - kubernetes/overlays/gcp/**/* + +cloud/aws: + - iac/aws/* + - iac/aws/**/* + +cloud/azure: + - iac/azure/* + - iac/azure/**/* + +cloud/alicloud: + - iac/alicloud/* + - iac/alicloud/**/* + +cloud/digitalocean: + - iac/digitalocean/* + - iac/digitalocean/**/* + +cloud/exoscale: + - iac/exoscale/* + - iac/exoscale/**/* + +cloud/scaleway: + - iac/scaleway/* + - iac/scaleway/**/* + +cloud/homelab: + - iac/homelab/* + - iac/homelab/**/* + - kubernetes/overlays/k3s/homelab + +cloud/cicd: + - iac/cicd/* + - iac/cicd/**/* + - kubernetes/overlays/k3s/cicd/* + +kind/documentation: + - docs/* + - docs/**/* diff --git a/.github/labels.yaml b/.github/labels.yaml new file mode 100644 index 0000000..e55fcff --- /dev/null +++ b/.github/labels.yaml @@ -0,0 +1,82 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +# labels to be used with /area command +area: + - 'kubernetes' + - 'terraform' + - 'ansible' + - 'inspec' + - 'github' + +kind: + - 'bug' + - 'documentation' + - 'discussion' + - 'feature' + - 'question' + - 'support' + +priority: + - backlog + - 'low' + - 'medium' + - 'high' + - 'critical' + +status: + - available + - blocked + - in_progress + - on_hold + +# File globs for PR labeler +# tests: +# - '**/*.test.ts' + +'area/kubernetes': + - kubernetes/* + - kubernetes/**/* + +'cloud/gcp': + - iac/gcp/* + - iac/gcp/**/* + +'cloud/aws': + - iac/aws/* + - iac/aws/**/* + +'cloud/azure': + - iac/azure/* + - iac/azure/**/* + +'cloud/alicloud': + - iac/alicloud/* + - iac/alicloud/**/* + +'cloud/digitalocean': + - iac/digitalocean/* + - iac/digitalocean/**/* + +'cloud/exoscale': + - iac/exoscale/* + - iac/exoscale/**/* + +'cloud/scaleway': + - iac/scaleway/* + - iac/scaleway/**/* + +'kind/documentation': + - docs/* + - docs/**/* diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..b26a479 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,58 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +# https://gitmoji.carloscuesta.me/ +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - 'kind/feature' + - 'kind/enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'kind/bug' + - 'fix' + - 'bugfix' + - 'bug' + - title: '🚨 Maintenance' + labels: + - 'kind/renovate' + - 'dependency/flux' + - 'chore' + - title: '📝 Documentation' + labels: + - 'kind/documentation' + - title: '💡 Question' + labels: + - 'kind/question' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + ## 🚧 Changes + + $CHANGES diff --git a/.github/renovate.json5 b/.github/renovate.json5 new file mode 100644 index 0000000..bc42316 --- /dev/null +++ b/.github/renovate.json5 @@ -0,0 +1,83 @@ +{ + "extends": [ + "config:base", + ":gitSignOff" + ], + "enabled": true, + "timezone": "Europe/Paris", + "dependencyDashboard": true, + "dependencyDashboardTitle": "Renovate Dashboard", + // "gitAuthor": "Nicolas Lamirault ", + // "commitBody": "Signed-off-by: Nicolas Lamirault ", + // Do not notify on closed unmerged PRs + "suppressNotifications": ["prIgnoreNotification"], + // Do not rebase PRs + "rebaseWhen": "conflicted", + "assignees": ["@nlamirault"], + "reviewersFromCodeOwners": true, + // "labels": ["kind/renovate", "lifecycle/active", "status/review_needed"], + "packageRules": [ + // Labels for Docker + { + "datasources": ["docker"], + "updateTypes": ["major"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "dependency/docker", "priority/high", "size/xs"] + }, + { + "datasources": ["docker"], + "updateTypes": ["minor"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "dependency/docker", "priority/medium", "size/xs"] + }, + { + "datasources": ["docker"], + "updateTypes": ["patch"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "dependency/docker", "priority/low", "size/xs"] + }, + // Labels for Helm + { + "datasources": ["helm"], + "updateTypes": ["major"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "area/kubernetes", "dependency/helm", "priority/high", "size/xs"] + }, + { + "datasources": ["helm"], + "updateTypes": ["minor"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "area/kubernetes", "dependency/helm", "priority/medium", "size/xs"] + }, + { + "datasources": ["helm"], + "updateTypes": ["patch"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "area/kubernetes", "dependency/helm", "priority/low", "size/xs"] + }, + // Labels for Github Actions + { + "datasources": ["action"], + "updateTypes": ["major"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "area/github", "dependency/github", "priority/high", "size/xs"] + }, + { + "datasources": ["action"], + "updateTypes": ["minor"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "area/github", "dependency/github", "priority/medium", "size/xs"] + }, + { + "datasources": ["action"], + "updateTypes": ["patch"], + "labels": ["kind/renovate", "lifecycle/active", "status/review_needed", "area/github", "dependency/github", "priority/low", "size/xs"] + }, + // Enable auto-merge docker + // { + // "datasources": ["docker"], + // "automerge": true, + // "requiredStatusChecks": null, + // "updateTypes": ["minor", "patch"], + // }, + // Enable auto-merge helm + // { + // "datasources": ["helm"], + // "automerge": true, + // "requiredStatusChecks": null, + // "updateTypes": ["patch"], + // } + ] +} diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..de6160f --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,32 @@ + +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 60 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - security fix + - security vulnerability +# Label to use when marking an issue as stale +staleLabel: lifecycle/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. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.github/workflows/draft-labels.yml b/.github/workflows/draft-labels.yml new file mode 100644 index 0000000..a3e90c9 --- /dev/null +++ b/.github/workflows/draft-labels.yml @@ -0,0 +1,30 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Project / Draft PR Labels + +on: + pull_request: + types: [opened, ready_for_review] + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - name: label swapping + uses: jinmayamashita/ready-for-review@1.0.0 + with: + in-progress-label: 'status/in_progress' + ready-for-review-label: 'status/review_needed' + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prow-labels.yml b/.github/workflows/prow-labels.yml new file mode 100644 index 0000000..dcfc262 --- /dev/null +++ b/.github/workflows/prow-labels.yml @@ -0,0 +1,40 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +# name: "Label PRs from globs" +# on: +# schedule: +# - cron: "0 * * * *" + +# jobs: +# execute: +# runs-on: ubuntu-latest +# steps: +# - uses: jpmcb/prow-github-actions@v1.1.1 +# with: +# jobs: 'pr-labeler' +# github-token: "${{ secrets.GITHUB_TOKEN }}" + +name: Prow / Pull Request Labeler + +on: +- pull_request_target + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@main + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prow-lgtm-merge.yml b/.github/workflows/prow-lgtm-merge.yml new file mode 100644 index 0000000..978202d --- /dev/null +++ b/.github/workflows/prow-lgtm-merge.yml @@ -0,0 +1,31 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Prow / Merge on lgtm label +on: + schedule: + - cron: "0 * * * *" + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@v1.1.3 + with: + jobs: 'lgtm' + github-token: "${{ secrets.GITHUB_TOKEN }}" + + # this configuration is optional and will default to 'merge' + # possible options are 'merge', 'rebase', or 'squash' + merge-method: 'squash' diff --git a/.github/workflows/prow-lgtm-pull.yml b/.github/workflows/prow-lgtm-pull.yml new file mode 100644 index 0000000..935c213 --- /dev/null +++ b/.github/workflows/prow-lgtm-pull.yml @@ -0,0 +1,25 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Prow / Run Jobs on PR +on: pull_request + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@v1.1.3 + with: + jobs: 'lgtm' + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/prow.yml b/.github/workflows/prow.yml new file mode 100644 index 0000000..4d2fde7 --- /dev/null +++ b/.github/workflows/prow.yml @@ -0,0 +1,43 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Prow / Github Actions +on: + issue_comment: + types: [created] + +jobs: + execute: + runs-on: ubuntu-latest + steps: + - uses: jpmcb/prow-github-actions@v1.1.3 + with: + prow-commands: '/assign + /unassign + /approve + /retitle + /area + /kind + /priority + /status + /remove + /lgtm + /close + /reopen + /lock + /milestone + /hold + /cc + /uncc' + github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 0000000..f551ded --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,33 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Projet / Rebase +on: + issue_comment: + types: [created] +jobs: + rebase: + name: Rebase + if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') + runs-on: ubuntu-latest + steps: + - name: Checkout the latest code + uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo + - name: Automatic Rebase + uses: cirrus-actions/rebase@1.5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 0000000..8c49ab4 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,33 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Project / Release Drafter + +on: + push: + # branches to consider in the event; optional, defaults to all + branches: + - master + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml + # with: + # config-name: my-config.yml + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml new file mode 100644 index 0000000..c9519c2 --- /dev/null +++ b/.github/workflows/renovate.yml @@ -0,0 +1,47 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Renovate / Helm releases + +on: + workflow_dispatch: + schedule: + - cron: "0 * * * *" + +jobs: + renovate-helmrelease: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + # - name: Update Helm Releases + # run: | + # docker-compose run -T --rm builder bootstrap/renovate-helm-releases.sh + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: update/pre-commit-auto-update + delete-branch: true + title: Auto-update pre-commit hooks + signoff: true + committer: "Nicolas Lamirault " + author: "Nicolas Lamirault " + commit-message: Auto-update pre-commit hooks + body: | + Signed-off-by: Nicolas Lamirault + labels: dependencies, merge diff --git a/.github/workflows/size.yaml b/.github/workflows/size.yaml new file mode 100644 index 0000000..5bedb2b --- /dev/null +++ b/.github/workflows/size.yaml @@ -0,0 +1,38 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +name: Project / Size PR + +on: + pull_request: + types: [opened, synchronize] + +jobs: + update_labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions-ecosystem/action-size@v2 + id: size + + - uses: actions-ecosystem/action-remove-labels@v1 + with: + github_token: ${{ secrets.github_token }} + labels: ${{ steps.size.outputs.stale_labels }} + + - uses: actions-ecosystem/action-add-labels@v1 + with: + github_token: ${{ secrets.github_token }} + labels: ${{ steps.size.outputs.new_label }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..8836b7a --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,50 @@ +# Copyright (C) 2021 Nicolas Lamirault +# +# 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. + +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + args: + - '--allow-multiple-documents' + exclude: mkdocs.yml + - id: check-added-large-files +- repo: https://github.com/Lucas-C/pre-commit-hooks + rev: v1.1.10 + hooks: + - id: insert-license + files: \.yaml + args: + - --license-filepath + - hack/config/licence.txt + - id: insert-license + files: \.yml + args: + - --license-filepath + - hack/config/licence.txt + - id: insert-license + files: \.tf + args: + - --license-filepath + - hack/config/licence.txt +- repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 2.1.5 + hooks: + - id: shellcheck + exclude: hack/hooks/pre-commit.git-crypt.sh diff --git a/hack/config/licence.txt b/hack/config/licence.txt new file mode 100644 index 0000000..3c6f31f --- /dev/null +++ b/hack/config/licence.txt @@ -0,0 +1,13 @@ +Copyright (C) 2021 Nicolas Lamirault + +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.