Skip to content

Commit

Permalink
Add: Configure CICD and precommit
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Lamirault <[email protected]>
  • Loading branch information
nlamirault committed Oct 1, 2021
1 parent 3a3c28b commit 188a9b9
Show file tree
Hide file tree
Showing 22 changed files with 865 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -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.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -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.
33 changes: 33 additions & 0 deletions .github/actions/tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copyright (C) 2021 Nicolas Lamirault <[email protected]>
#
# 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 <[email protected]>" \
org.opencontainers.image.title="Tools for Portefaix project" \
org.opencontainers.image.description="Tools from the Kubernetes ecosystem" \
org.opencontainers.image.authors="Nicolas Lamirault <[email protected]>" \
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"]
23 changes: 23 additions & 0 deletions .github/actions/tools/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (C) 2021 Nicolas Lamirault <[email protected]>
#
# 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'
44 changes: 44 additions & 0 deletions .github/actions/tools/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}"
18 changes: 18 additions & 0 deletions .github/issue_label_bot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (C) 2021 Nicolas Lamirault <[email protected]>
#
# 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'
62 changes: 62 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Copyright (C) 2021 Nicolas Lamirault <[email protected]>
#
# 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/**/*
82 changes: 82 additions & 0 deletions .github/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Copyright (C) 2021 Nicolas Lamirault <[email protected]>
#
# 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/**/*
58 changes: 58 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Copyright (C) 2021 Nicolas Lamirault <[email protected]>
#
# 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
Loading

0 comments on commit 188a9b9

Please sign in to comment.