Skip to content

Commit f2294c2

Browse files
authored
Merge pull request #71 from kairos-io/add-linters
Add lint workflow
2 parents d8a56ba + 9437413 commit f2294c2

File tree

11 files changed

+61
-19
lines changed

11 files changed

+61
-19
lines changed

.github/workflows/lint.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
paths:
8+
- '**'
9+
env:
10+
FORCE_COLOR: 1
11+
jobs:
12+
call-workflow:
13+
uses: kairos-io/linting-composite-action/.github/workflows/[email protected]
14+
with:
15+
yamldirs: ".github/workflows/ config/ tools-image/"
16+
is-go: true

.shellcheckrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
disable=SC2086
2+
disable=SC2034
3+
disable=SC2046
4+
disable=SC2068
5+
disable=SC2154

.yamllint

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
extends: default
2+
3+
rules:
4+
# 80 chars should be enough, but don't fail if a line is longer
5+
line-length:
6+
max: 150
7+
level: warning
8+
9+
# accept both key:
10+
# - item
11+
#
12+
# and key:
13+
# - item
14+
indentation:
15+
indent-sequences: whatever
16+
17+
truthy:
18+
check-keys: false
19+
20+
document-start:
21+
present: false

config/default/kustomization.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,11 @@ vars:
7373
# kind: Service
7474
# version: v1
7575
# name: webhook-service
76-
77-
vars:
7876
- name: NGINX_NAMESPACE
7977
objref:
8078
kind: Namespace
8179
name: system
82-
apiVersion: v1
80+
apiVersion: v1
8381

8482
- name: ARTIFACT_COPIER_ROLE
8583
objref:

config/manager/controller_manager_config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ webhook:
99
leaderElection:
1010
leaderElect: true
1111
resourceName: 98ca89ca.kairos.io
12-
# leaderElectionReleaseOnCancel defines if the leader should step down volume
12+
# leaderElectionReleaseOnCancel defines if the leader should step down volume
1313
# when the Manager ends. This requires the binary to immediately end when the
1414
# Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
1515
# speeds up voluntary leader transitions as the new leader don't have to wait
1616
# LeaseDuration time first.
17-
# In the default scaffold provided, the program ends immediately after
18-
# the manager stops, so would be fine to enable this option. However,
19-
# if you are doing or is intended to do any operation such as perform cleanups
17+
# In the default scaffold provided, the program ends immediately after
18+
# the manager stops, so would be fine to enable this option. However,
19+
# if you are doing or is intended to do any operation such as perform cleanups
2020
# after the manager stops then its usage might be unsafe.
2121
# leaderElectionReleaseOnCancel: true

config/prometheus/monitor.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Prometheus Monitor Service (Metrics)
32
apiVersion: monitoring.coreos.com/v1
43
kind: ServiceMonitor

script/test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ set -e
2626
kubectl cluster-info --context kind-$CLUSTER_NAME
2727
echo "Sleep to give times to node to populate with all info"
2828
kubectl wait --for=condition=Ready node/$CLUSTER_NAME-control-plane
29-
export EXTERNAL_IP=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}')
29+
EXTERNAL_IP=$(kubectl get nodes -o jsonpath='{.items[].status.addresses[?(@.type == "InternalIP")].address}')
30+
export EXTERNAL_IP
3031
export BRIDGE_IP="172.18.0.1"
3132
kubectl get nodes -o wide
3233
cd $ROOT_DIR/tests && $GINKGO -r -v ./e2e

tools-image/build-arm-image.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ get_url()
131131
esac
132132
}
133133

134-
trap "cleanup" 1 2 3 6 9 14 15 EXIT
134+
trap "cleanup" 1 2 3 6 14 15 EXIT
135135

136136
load_vars
137137

@@ -223,6 +223,7 @@ else
223223
fi
224224

225225
if [ -n "$cos_config" ] && [ -e "$cos_config" ]; then
226+
# shellcheck source=/dev/null
226227
source "$cos_config"
227228
fi
228229

@@ -283,7 +284,7 @@ ensure_dir_structure $TARGET
283284
# Download the container image
284285
if [ -z "$directory" ]; then
285286
echo ">>> Downloading container image"
286-
elemental pull-image $( (( $local_build == 'true')) && printf %s '--local' ) $container_image $TARGET
287+
elemental pull-image $( (( local_build == 'true')) && printf %s '--local' ) $container_image $TARGET
287288
else
288289
echo ">>> Copying files from $directory"
289290
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}
354355
if [ "$disable_lvm" == 'true' ]; then
355356
sgdisk -n 3:0:+${recovery_size}M -c 3:recovery -t 3:8300 ${output_image}
356357
else
357-
sgdisk -n 3:0:+$(( ${recovery_size} + ${oem_size} ))M -c 3:lvm -t 3:8e00 ${output_image}
358+
sgdisk -n 3:0:+$(( recovery_size + oem_size ))M -c 3:lvm -t 3:8e00 ${output_image}
358359
fi
359360
sgdisk -n 4:0:+64M -c 4:persistent -t 4:8300 ${output_image}
360361

@@ -366,7 +367,8 @@ fi
366367

367368
# Prepare the image and copy over the files
368369

369-
export DRIVE=$(losetup -f "${output_image}" --show)
370+
DRIVE=$(losetup -f "${output_image}" --show)
371+
export DRIVE
370372
if [ -z "${DRIVE}" ]; then
371373
echo "Cannot execute losetup for $output_image"
372374
exit 1

tools-image/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ iso:
33
- dir:/efi
44
image:
55
- dir:/efi
6-
- dir:/grub2
6+
- dir:/grub2

tools-image/defaults.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#cloud-config
22
name: "Default user"
33
stages:
4-
initramfs:
5-
- name: "Set default user/pass"
6-
users:
4+
initramfs:
5+
- name: "Set default user/pass"
6+
users:
77
kairos:
8-
passwd: "kairos"
8+
passwd: "kairos"

0 commit comments

Comments
 (0)