Merge pull request #71 from kairos-io/add-linters

Add lint workflow
This commit is contained in:
Mauro Morales
2023-07-19 09:15:16 +02:00
committed by GitHub
11 changed files with 61 additions and 19 deletions

16
.github/workflows/lint.yaml vendored Normal file
View File

@@ -0,0 +1,16 @@
name: Lint
on:
push:
branches:
- master
pull_request:
paths:
- '**'
env:
FORCE_COLOR: 1
jobs:
call-workflow:
uses: kairos-io/linting-composite-action/.github/workflows/reusable-linting.yaml@v0.0.6
with:
yamldirs: ".github/workflows/ config/ tools-image/"
is-go: true

5
.shellcheckrc Normal file
View File

@@ -0,0 +1,5 @@
disable=SC2086
disable=SC2034
disable=SC2046
disable=SC2068
disable=SC2154

21
.yamllint Normal file
View File

@@ -0,0 +1,21 @@
extends: default
rules:
# 80 chars should be enough, but don't fail if a line is longer
line-length:
max: 150
level: warning
# accept both key:
# - item
#
# and key:
# - item
indentation:
indent-sequences: whatever
truthy:
check-keys: false
document-start:
present: false

View File

@@ -73,13 +73,11 @@ vars:
# kind: Service
# version: v1
# name: webhook-service
vars:
- name: NGINX_NAMESPACE
objref:
kind: Namespace
name: system
apiVersion: v1
apiVersion: v1
- name: ARTIFACT_COPIER_ROLE
objref:

View File

@@ -9,13 +9,13 @@ webhook:
leaderElection:
leaderElect: true
resourceName: 98ca89ca.kairos.io
# leaderElectionReleaseOnCancel defines if the leader should step down volume
# leaderElectionReleaseOnCancel defines if the leader should step down volume
# when the Manager ends. This requires the binary to immediately end when the
# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
# speeds up voluntary leader transitions as the new leader don't have to wait
# LeaseDuration time first.
# In the default scaffold provided, the program ends immediately after
# the manager stops, so would be fine to enable this option. However,
# if you are doing or is intended to do any operation such as perform cleanups
# In the default scaffold provided, the program ends immediately after
# the manager stops, so would be fine to enable this option. However,
# if you are doing or is intended to do any operation such as perform cleanups
# after the manager stops then its usage might be unsafe.
# leaderElectionReleaseOnCancel: true

View File

@@ -1,4 +1,3 @@
# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor

View File

@@ -26,7 +26,8 @@ set -e
kubectl cluster-info --context kind-$CLUSTER_NAME
echo "Sleep to give times to node to populate with all info"
kubectl wait --for=condition=Ready node/$CLUSTER_NAME-control-plane
export EXTERNAL_IP=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}')
EXTERNAL_IP=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}')
export EXTERNAL_IP
export BRIDGE_IP="172.18.0.1"
kubectl get nodes -o wide
cd $ROOT_DIR/tests && $GINKGO -r -v ./e2e

View File

@@ -131,7 +131,7 @@ get_url()
esac
}
trap "cleanup" 1 2 3 6 9 14 15 EXIT
trap "cleanup" 1 2 3 6 14 15 EXIT
load_vars
@@ -223,6 +223,7 @@ else
fi
if [ -n "$cos_config" ] && [ -e "$cos_config" ]; then
# shellcheck source=/dev/null
source "$cos_config"
fi
@@ -283,7 +284,7 @@ ensure_dir_structure $TARGET
# Download the container image
if [ -z "$directory" ]; then
echo ">>> Downloading container image"
elemental pull-image $( (( $local_build == 'true')) && printf %s '--local' ) $container_image $TARGET
elemental pull-image $( (( local_build == 'true')) && printf %s '--local' ) $container_image $TARGET
else
echo ">>> Copying files from $directory"
rsync -axq --exclude='host' --exclude='mnt' --exclude='proc' --exclude='sys' --exclude='dev' --exclude='tmp' ${directory}/ $TARGET
@@ -354,7 +355,7 @@ sgdisk -n 2:0:+${state_size}M -c 2:state -t 2:8300 ${output_image}
if [ "$disable_lvm" == 'true' ]; then
sgdisk -n 3:0:+${recovery_size}M -c 3:recovery -t 3:8300 ${output_image}
else
sgdisk -n 3:0:+$(( ${recovery_size} + ${oem_size} ))M -c 3:lvm -t 3:8e00 ${output_image}
sgdisk -n 3:0:+$(( recovery_size + oem_size ))M -c 3:lvm -t 3:8e00 ${output_image}
fi
sgdisk -n 4:0:+64M -c 4:persistent -t 4:8300 ${output_image}
@@ -366,7 +367,8 @@ fi
# Prepare the image and copy over the files
export DRIVE=$(losetup -f "${output_image}" --show)
DRIVE=$(losetup -f "${output_image}" --show)
export DRIVE
if [ -z "${DRIVE}" ]; then
echo "Cannot execute losetup for $output_image"
exit 1

View File

@@ -3,4 +3,4 @@ iso:
- dir:/efi
image:
- dir:/efi
- dir:/grub2
- dir:/grub2

View File

@@ -1,8 +1,8 @@
#cloud-config
name: "Default user"
stages:
initramfs:
- name: "Set default user/pass"
users:
initramfs:
- name: "Set default user/pass"
users:
kairos:
passwd: "kairos"
passwd: "kairos"

View File

@@ -71,7 +71,7 @@ truncate -s "+$((1024*1024))" $OUT
if [ -n "$EXTEND" ]; then
echo "Extending image of $EXTEND MB"
truncate -s "+$(($EXTEND*1024*1024))" $OUT
truncate -s "+$((EXTEND*1024*1024))" $OUT
fi
# Create the partition table in $OUT (assumes sectors of 512 bytes)